From b9777269ce3e574111f166f1ce9ab52be5ea44ac Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sat, 1 Feb 2025 11:53:09 +0100 Subject: [PATCH] Codechange: strongly type SignID --- src/script/api/script_sign.cpp | 2 +- src/signs_base.h | 2 +- src/signs_type.h | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/script/api/script_sign.cpp b/src/script/api/script_sign.cpp index 8d9d364069..63b9f5b642 100644 --- a/src/script/api/script_sign.cpp +++ b/src/script/api/script_sign.cpp @@ -84,5 +84,5 @@ if (!ScriptObject::Command::Do(&ScriptInstance::DoCommandReturnSignID, location, text)) return INVALID_SIGN; /* In case of test-mode, we return SignID 0 */ - return ::SIGN_BEGIN; + return SignID::Begin(); } diff --git a/src/signs_base.h b/src/signs_base.h index 5775d7a90a..b208b21704 100644 --- a/src/signs_base.h +++ b/src/signs_base.h @@ -15,7 +15,7 @@ #include "core/pool_type.hpp" #include "company_type.h" -typedef Pool SignPool; +typedef Pool SignPool; extern SignPool _sign_pool; struct Sign : SignPool::PoolItem<&_sign_pool> { diff --git a/src/signs_type.h b/src/signs_type.h index f7243b8c1f..b7e12f13f6 100644 --- a/src/signs_type.h +++ b/src/signs_type.h @@ -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; +static constexpr SignID INVALID_SIGN = SignID::Invalid(); ///< Sentinel for an invalid sign. struct Sign;