mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 12:33:17 +01:00
Use constexpr and pragma once in banner.h
And fix two occurances where `BANNER_NULL` was used wrongly.
This commit is contained in:
@@ -232,7 +232,7 @@ static money32 BannerPlace(
|
||||
}
|
||||
|
||||
*bannerIndex = create_new_banner(flags);
|
||||
if (*bannerIndex == BANNER_NULL)
|
||||
if (*bannerIndex == BANNER_INDEX_NULL)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
@@ -505,7 +505,7 @@ void fix_duplicated_banners()
|
||||
|
||||
// Banner index is already in use by another banner, so duplicate it
|
||||
BannerIndex newBannerIndex = create_new_banner(GAME_COMMAND_FLAG_APPLY);
|
||||
if (newBannerIndex == BANNER_NULL)
|
||||
if (newBannerIndex == BANNER_INDEX_NULL)
|
||||
{
|
||||
log_error("Failed to create new banner.");
|
||||
continue;
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifndef _BANNER_H_
|
||||
#define _BANNER_H_
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "TileElement.h"
|
||||
|
||||
#define BANNER_NULL 255
|
||||
#define MAX_BANNERS 250
|
||||
#define BANNER_INDEX_NULL ((BannerIndex)-1)
|
||||
constexpr uint8 BANNER_NULL = 255;
|
||||
constexpr size_t MAX_BANNERS = 250;
|
||||
constexpr BannerIndex BANNER_INDEX_NULL = (BannerIndex)-1;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct rct_banner
|
||||
@@ -59,5 +58,3 @@ uint8 banner_get_closest_ride_index(sint32 x, sint32 y, sint32 z);
|
||||
void banner_reset_broken_index();
|
||||
void fix_duplicated_banners();
|
||||
void game_command_callback_place_banner(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -309,7 +309,7 @@ sint32 tile_inspector_paste_element_at(sint32 x, sint32 y, rct_tile_element elem
|
||||
{
|
||||
// The element to be pasted refers to a banner index - make a copy of it
|
||||
BannerIndex newBannerIndex = create_new_banner(flags);
|
||||
if (newBannerIndex == BANNER_NULL)
|
||||
if (newBannerIndex == BANNER_INDEX_NULL)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user