1
0
Fork 0

Codechange: make SignID an enum

pull/13512/head
Rubidium 2025-01-21 19:06:56 +01:00 committed by rubidium42
parent 1e24b41f22
commit cda9c2759e
3 changed files with 8 additions and 5 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 0;
return ::SIGN_BEGIN;
}

View File

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

View File

@ -11,10 +11,13 @@
#define SIGNS_TYPE_H
/** The type of the IDs of signs. */
typedef uint16_t SignID;
struct Sign;
enum SignID : uint16_t {
SIGN_BEGIN = 0,
SIGN_END = 64000,
INVALID_SIGN = 0xFFFF ///< Sentinel for an invalid sign.
};
static const SignID INVALID_SIGN = 0xFFFF; ///< Sentinel for an invalid sign.
struct Sign;
static const uint MAX_LENGTH_SIGN_NAME_CHARS = 32; ///< The maximum length of a sign name in characters including '\0'