mirror of https://github.com/OpenTTD/OpenTTD
Codechange: make SignID an enum
parent
1e24b41f22
commit
cda9c2759e
|
@ -84,5 +84,5 @@
|
||||||
if (!ScriptObject::Command<CMD_PLACE_SIGN>::Do(&ScriptInstance::DoCommandReturnSignID, location, text)) return INVALID_SIGN;
|
if (!ScriptObject::Command<CMD_PLACE_SIGN>::Do(&ScriptInstance::DoCommandReturnSignID, location, text)) return INVALID_SIGN;
|
||||||
|
|
||||||
/* In case of test-mode, we return SignID 0 */
|
/* In case of test-mode, we return SignID 0 */
|
||||||
return 0;
|
return ::SIGN_BEGIN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "core/pool_type.hpp"
|
#include "core/pool_type.hpp"
|
||||||
#include "company_type.h"
|
#include "company_type.h"
|
||||||
|
|
||||||
typedef Pool<Sign, SignID, 16, 64000> SignPool;
|
typedef Pool<Sign, SignID, 16, SIGN_END> SignPool;
|
||||||
extern SignPool _sign_pool;
|
extern SignPool _sign_pool;
|
||||||
|
|
||||||
struct Sign : SignPool::PoolItem<&_sign_pool> {
|
struct Sign : SignPool::PoolItem<&_sign_pool> {
|
||||||
|
|
|
@ -11,10 +11,13 @@
|
||||||
#define SIGNS_TYPE_H
|
#define SIGNS_TYPE_H
|
||||||
|
|
||||||
/** The type of the IDs of signs. */
|
/** The type of the IDs of signs. */
|
||||||
typedef uint16_t SignID;
|
enum SignID : uint16_t {
|
||||||
struct Sign;
|
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'
|
static const uint MAX_LENGTH_SIGN_NAME_CHARS = 32; ///< The maximum length of a sign name in characters including '\0'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue