1
0
Fork 0

Codechange: strongly type SignID

pull/13512/head
Rubidium 2025-02-01 11:53:09 +01:00 committed by rubidium42
parent 42d6a12874
commit b9777269ce
3 changed files with 4 additions and 7 deletions

View File

@ -84,5 +84,5 @@
if (!ScriptObject::Command<CMD_PLACE_SIGN>::Do(&ScriptInstance::DoCommandReturnSignID, location, text)) return INVALID_SIGN;
/* In case of test-mode, we return SignID 0 */
return ::SIGN_BEGIN;
return SignID::Begin();
}

View File

@ -15,7 +15,7 @@
#include "core/pool_type.hpp"
#include "company_type.h"
typedef Pool<Sign, SignID, 16, SIGN_END> SignPool;
typedef Pool<Sign, SignID, 16, SignID::End().base()> SignPool;
extern SignPool _sign_pool;
struct Sign : SignPool::PoolItem<&_sign_pool> {

View File

@ -11,11 +11,8 @@
#define SIGNS_TYPE_H
/** The type of the IDs of signs. */
enum SignID : uint16_t {
SIGN_BEGIN = 0,
SIGN_END = 64000,
INVALID_SIGN = 0xFFFF ///< Sentinel for an invalid sign.
};
using SignID = PoolID<uint16_t, struct SignIDTag, 64000, 0xFFFF>;
static constexpr SignID INVALID_SIGN = SignID::Invalid(); ///< Sentinel for an invalid sign.
struct Sign;