Use OBJECT_ENTRY_INDEX_NULL in more places

This commit is contained in:
Gymnasiast 2020-04-27 18:57:34 +02:00
parent 99626e4fbb
commit a1cbaf9a46
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
4 changed files with 19 additions and 19 deletions

View File

@ -121,8 +121,8 @@ rct_window* window_land_open()
window_push_others_below(window); window_push_others_below(window);
gLandToolSize = 1; gLandToolSize = 1;
gLandToolTerrainSurface = 255; gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL;
gLandToolTerrainEdge = 255; gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL;
gLandMountainMode = false; gLandMountainMode = false;
gLandPaintMode = false; gLandPaintMode = false;
_selectedFloorTexture = TERRAIN_GRASS; _selectedFloorTexture = TERRAIN_GRASS;
@ -223,7 +223,7 @@ static void window_land_dropdown(rct_window* w, rct_widgetindex widgetIndex, int
if (gLandToolTerrainSurface == type) if (gLandToolTerrainSurface == type)
{ {
gLandToolTerrainSurface = 255; gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL;
} }
else else
{ {
@ -240,7 +240,7 @@ static void window_land_dropdown(rct_window* w, rct_widgetindex widgetIndex, int
if (gLandToolTerrainEdge == type) if (gLandToolTerrainEdge == type)
{ {
gLandToolTerrainEdge = 255; gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL;
} }
else else
{ {
@ -316,9 +316,9 @@ static void window_land_invalidate(rct_window* w)
} }
w->pressed_widgets = (1 << WIDX_PREVIEW); w->pressed_widgets = (1 << WIDX_PREVIEW);
if (gLandToolTerrainSurface != 255) if (gLandToolTerrainSurface != OBJECT_ENTRY_INDEX_NULL)
w->pressed_widgets |= (1 << WIDX_FLOOR); w->pressed_widgets |= (1 << WIDX_FLOOR);
if (gLandToolTerrainEdge != 255) if (gLandToolTerrainEdge != OBJECT_ENTRY_INDEX_NULL)
w->pressed_widgets |= (1 << WIDX_WALL); w->pressed_widgets |= (1 << WIDX_WALL);
if (gLandMountainMode) if (gLandMountainMode)
w->pressed_widgets |= (1 << WIDX_MOUNTAINMODE); w->pressed_widgets |= (1 << WIDX_MOUNTAINMODE);
@ -378,7 +378,7 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Draw paint price // Draw paint price
numTiles = gLandToolSize * gLandToolSize; numTiles = gLandToolSize * gLandToolSize;
price = 0; price = 0;
if (gLandToolTerrainSurface != 255) if (gLandToolTerrainSurface != OBJECT_ENTRY_INDEX_NULL)
{ {
auto& objManager = GetContext()->GetObjectManager(); auto& objManager = GetContext()->GetObjectManager();
const auto surfaceObj = static_cast<TerrainSurfaceObject*>( const auto surfaceObj = static_cast<TerrainSurfaceObject*>(
@ -389,7 +389,7 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi)
} }
} }
if (gLandToolTerrainEdge != 255) if (gLandToolTerrainEdge != OBJECT_ENTRY_INDEX_NULL)
price += numTiles * 100; price += numTiles * 100;
if (price != 0) if (price != 0)

View File

@ -661,7 +661,7 @@ static void window_mapgen_base_dropdown(rct_window* w, rct_widgetindex widgetInd
if (gLandToolTerrainSurface == type) if (gLandToolTerrainSurface == type)
{ {
gLandToolTerrainSurface = 255; gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL;
} }
else else
{ {
@ -678,7 +678,7 @@ static void window_mapgen_base_dropdown(rct_window* w, rct_widgetindex widgetInd
if (gLandToolTerrainEdge == type) if (gLandToolTerrainEdge == type)
{ {
gLandToolTerrainEdge = 255; gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL;
} }
else else
{ {
@ -998,7 +998,7 @@ static void window_mapgen_simplex_dropdown(rct_window* w, rct_widgetindex widget
if (gLandToolTerrainSurface == type) if (gLandToolTerrainSurface == type)
{ {
gLandToolTerrainSurface = 255; gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL;
} }
else else
{ {
@ -1015,7 +1015,7 @@ static void window_mapgen_simplex_dropdown(rct_window* w, rct_widgetindex widget
if (gLandToolTerrainEdge == type) if (gLandToolTerrainEdge == type)
{ {
gLandToolTerrainEdge = 255; gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL;
} }
else else
{ {

View File

@ -203,7 +203,7 @@ static void init_scenery_entry(rct_scenery_entry* sceneryEntry, const ScenerySel
Guard::ArgumentInRange<int32_t>(selection.EntryIndex, 0, WINDOW_SCENERY_TAB_SELECTION_UNDEFINED); Guard::ArgumentInRange<int32_t>(selection.EntryIndex, 0, WINDOW_SCENERY_TAB_SELECTION_UNDEFINED);
if (scenery_is_invented(selection) || gCheatsIgnoreResearchStatus) if (scenery_is_invented(selection) || gCheatsIgnoreResearchStatus)
{ {
if (sceneryTabId != 0xFF) if (sceneryTabId != OBJECT_ENTRY_INDEX_NULL)
{ {
for (int32_t i = 0; i < SCENERY_ENTRIES_PER_TAB; i++) for (int32_t i = 0; i < SCENERY_ENTRIES_PER_TAB; i++)
{ {

View File

@ -61,7 +61,7 @@ public:
MapRange validRange{ x0, y0, x1, y1 }; MapRange validRange{ x0, y0, x1, y1 };
auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
if (_surfaceStyle != 0xFF) if (_surfaceStyle != OBJECT_ENTRY_INDEX_NULL)
{ {
if (_surfaceStyle > 0x1F) if (_surfaceStyle > 0x1F)
{ {
@ -79,7 +79,7 @@ public:
} }
} }
if (_edgeStyle != 0xFF) if (_edgeStyle != OBJECT_ENTRY_INDEX_NULL)
{ {
if (_edgeStyle > 0xF) if (_edgeStyle > 0xF)
{ {
@ -131,7 +131,7 @@ public:
continue; continue;
} }
if (_surfaceStyle != 0xFF) if (_surfaceStyle != OBJECT_ENTRY_INDEX_NULL)
{ {
uint8_t curSurfaceStyle = surfaceElement->GetSurfaceStyle(); uint8_t curSurfaceStyle = surfaceElement->GetSurfaceStyle();
@ -146,7 +146,7 @@ public:
} }
} }
if (_edgeStyle != 0xFF) if (_edgeStyle != OBJECT_ENTRY_INDEX_NULL)
{ {
uint8_t curEdgeStyle = surfaceElement->GetEdgeStyle(); uint8_t curEdgeStyle = surfaceElement->GetEdgeStyle();
@ -203,7 +203,7 @@ public:
continue; continue;
} }
if (_surfaceStyle != 0xFF) if (_surfaceStyle != OBJECT_ENTRY_INDEX_NULL)
{ {
uint8_t curSurfaceStyle = surfaceElement->GetSurfaceStyle(); uint8_t curSurfaceStyle = surfaceElement->GetSurfaceStyle();
@ -224,7 +224,7 @@ public:
} }
} }
if (_edgeStyle != 0xFF) if (_edgeStyle != OBJECT_ENTRY_INDEX_NULL)
{ {
uint8_t curEdgeStyle = surfaceElement->GetEdgeStyle(); uint8_t curEdgeStyle = surfaceElement->GetEdgeStyle();