mirror of https://github.com/OpenTTD/OpenTTD
Codechange: strongly type SignID
parent
42d6a12874
commit
b9777269ce
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue