mirror of https://github.com/OpenRCT2/OpenRCT2.git
Replace INVALID_IMAGE_ID with ImageIndexUndefined
This commit is contained in:
parent
3d05fce68e
commit
f7f7cd823f
|
@ -20,7 +20,6 @@
|
|||
|
||||
constexpr uint32_t BASE_IMAGE_ID = SPR_IMAGE_LIST_BEGIN;
|
||||
constexpr uint32_t MAX_IMAGES = SPR_IMAGE_LIST_END - BASE_IMAGE_ID;
|
||||
constexpr uint32_t INVALID_IMAGE_ID = UINT32_MAX;
|
||||
|
||||
static bool _initialised = false;
|
||||
static std::list<ImageList> _freeLists;
|
||||
|
@ -127,7 +126,7 @@ static uint32_t TryAllocateImageList(uint32_t count)
|
|||
return imageList.BaseId;
|
||||
}
|
||||
}
|
||||
return INVALID_IMAGE_ID;
|
||||
return ImageIndexUndefined;
|
||||
}
|
||||
|
||||
static uint32_t AllocateImageList(uint32_t count)
|
||||
|
@ -139,12 +138,12 @@ static uint32_t AllocateImageList(uint32_t count)
|
|||
InitialiseImageList();
|
||||
}
|
||||
|
||||
uint32_t baseImageId = INVALID_IMAGE_ID;
|
||||
uint32_t baseImageId = ImageIndexUndefined;
|
||||
uint32_t freeImagesRemaining = GetNumFreeImagesRemaining();
|
||||
if (freeImagesRemaining >= count)
|
||||
{
|
||||
baseImageId = TryAllocateImageList(count);
|
||||
if (baseImageId == INVALID_IMAGE_ID)
|
||||
if (baseImageId == ImageIndexUndefined)
|
||||
{
|
||||
// Defragment and try again
|
||||
MergeFreeLists();
|
||||
|
@ -190,14 +189,14 @@ uint32_t GfxObjectAllocateImages(const G1Element* images, uint32_t count)
|
|||
{
|
||||
if (count == 0 || gOpenRCT2NoGraphics)
|
||||
{
|
||||
return INVALID_IMAGE_ID;
|
||||
return ImageIndexUndefined;
|
||||
}
|
||||
|
||||
uint32_t baseImageId = AllocateImageList(count);
|
||||
if (baseImageId == INVALID_IMAGE_ID)
|
||||
if (baseImageId == ImageIndexUndefined)
|
||||
{
|
||||
LOG_ERROR("Reached maximum image limit.");
|
||||
return INVALID_IMAGE_ID;
|
||||
return ImageIndexUndefined;
|
||||
}
|
||||
|
||||
uint32_t imageId = baseImageId;
|
||||
|
@ -213,7 +212,7 @@ uint32_t GfxObjectAllocateImages(const G1Element* images, uint32_t count)
|
|||
|
||||
void GfxObjectFreeImages(uint32_t baseImageId, uint32_t count)
|
||||
{
|
||||
if (baseImageId != 0 && baseImageId != INVALID_IMAGE_ID)
|
||||
if (baseImageId != 0 && baseImageId != ImageIndexUndefined)
|
||||
{
|
||||
// Zero the G1 elements so we don't have invalid pointers
|
||||
// and data lying about
|
||||
|
|
Loading…
Reference in New Issue