diff --git a/src/goal_base.h b/src/goal_base.h index bf5954ee18..816b238e4d 100644 --- a/src/goal_base.h +++ b/src/goal_base.h @@ -14,7 +14,7 @@ #include "goal_type.h" #include "core/pool_type.hpp" -typedef Pool GoalPool; +using GoalPool = Pool; extern GoalPool _goal_pool; /** Struct about goals, current and completed */ diff --git a/src/goal_type.h b/src/goal_type.h index 66a3f3bf8a..dbc7a8ae08 100644 --- a/src/goal_type.h +++ b/src/goal_type.h @@ -11,6 +11,7 @@ #define GOAL_TYPE_H #include "core/enum_type.hpp" +#include "core/pool_type.hpp" static const uint32_t GOAL_QUESTION_BUTTON_COUNT = 18; ///< Amount of buttons available. @@ -34,8 +35,10 @@ enum GoalType : uint8_t { typedef uint32_t GoalTypeID; ///< Contains either tile, industry ID, town ID, company ID, or story page ID -typedef uint16_t GoalID; ///< ID of a goal +/** ID of a goal */ +using GoalID = PoolID; + struct Goal; -static const GoalID INVALID_GOAL = 0xFFFF; ///< Constant representing a non-existing goal. +static constexpr GoalID INVALID_GOAL = GoalID::Invalid(); ///< Constant representing a non-existing goal. #endif /* GOAL_TYPE_H */ diff --git a/src/script/api/script_goal.cpp b/src/script/api/script_goal.cpp index 81cd92f624..8de5466bb8 100644 --- a/src/script/api/script_goal.cpp +++ b/src/script/api/script_goal.cpp @@ -55,7 +55,7 @@ if (!ScriptObject::Command::Do(&ScriptInstance::DoCommandReturnGoalID, ScriptCompany::FromScriptCompanyID(company), (::GoalType)type, destination, text)) return GOAL_INVALID; /* In case of test-mode, we return GoalID 0 */ - return static_cast(0); + return GoalID::Begin(); } /* static */ bool ScriptGoal::Remove(GoalID goal_id) diff --git a/src/story.cpp b/src/story.cpp index de25c6f227..90b52ef8af 100644 --- a/src/story.cpp +++ b/src/story.cpp @@ -105,7 +105,7 @@ static void UpdateElement(StoryPageElement &pe, TileIndex tile, uint32_t referen pe.referenced_id = tile.base(); break; case SPET_GOAL: - pe.referenced_id = (GoalID)reference; + pe.referenced_id = reference; break; case SPET_BUTTON_PUSH: case SPET_BUTTON_TILE: