diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 6df787549e..4cd35985bf 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -689,7 +689,7 @@ void scenario_fix_ghosts(rct_s6_data *s6) do { if (originalElement->flags & TILE_ELEMENT_FLAG_GHOST) { sint32 bannerIndex = tile_element_get_banner_index(originalElement); - if (bannerIndex != -1) { + if (bannerIndex != BANNER_INDEX_NULL) { rct_banner *banner = &s6->banners[bannerIndex]; if (banner->type != BANNER_NULL) { diff --git a/src/openrct2/world/Banner.h b/src/openrct2/world/Banner.h index 9fe1370cef..296ae9629d 100644 --- a/src/openrct2/world/Banner.h +++ b/src/openrct2/world/Banner.h @@ -22,6 +22,7 @@ #define BANNER_NULL 255 #define MAX_BANNERS 250 +#define BANNER_INDEX_NULL -1 #pragma pack(push, 1) struct rct_banner { diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 85e4273f47..7ba555425d 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -3553,19 +3553,19 @@ sint32 tile_element_get_banner_index(rct_tile_element *tileElement) case TILE_ELEMENT_TYPE_LARGE_SCENERY: sceneryEntry = get_large_scenery_entry(scenery_large_get_type(tileElement)); if (sceneryEntry->large_scenery.scrolling_mode == 0xFF) - return -1; + return BANNER_INDEX_NULL; return scenery_large_get_banner_id(tileElement); case TILE_ELEMENT_TYPE_WALL: sceneryEntry = get_wall_entry(tileElement->properties.wall.type); if (sceneryEntry == nullptr || sceneryEntry->wall.scrolling_mode == 0xFF) - return -1; + return BANNER_INDEX_NULL; return tileElement->properties.wall.banner_index; case TILE_ELEMENT_TYPE_BANNER: return tileElement->properties.banner.index; default: - return -1; + return BANNER_INDEX_NULL; } } @@ -3591,7 +3591,7 @@ void tile_element_set_banner_index(rct_tile_element * tileElement, sint32 banner void tile_element_remove_banner_entry(rct_tile_element *tileElement) { sint32 bannerIndex = tile_element_get_banner_index(tileElement); - if (bannerIndex == -1) + if (bannerIndex == BANNER_INDEX_NULL) return; rct_banner* banner = &gBanners[bannerIndex]; diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 587e7b9eea..81d27a403c 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -316,8 +316,7 @@ sint32 tile_inspector_paste_element_at(sint32 x, sint32 y, rct_tile_element elem { // Check if the element to be pasted refers to a banner index sint32 bannerIndex = tile_element_get_banner_index(&element); - - if (bannerIndex != BANNER_NULL) + if (bannerIndex != BANNER_INDEX_NULL) { // The element to be pasted refers to a banner index - make a copy of it sint32 newBannerIndex = create_new_banner(flags);