diff options
Diffstat (limited to 'src/script/api/script_basestation.cpp')
-rw-r--r-- | src/script/api/script_basestation.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/script/api/script_basestation.cpp b/src/script/api/script_basestation.cpp index 860e54c78..a24934410 100644 --- a/src/script/api/script_basestation.cpp +++ b/src/script/api/script_basestation.cpp @@ -13,6 +13,8 @@ #include "../../station_base.h" #include "../../string_func.h" #include "../../strings_func.h" +#include "../../station_cmd.h" +#include "../../waypoint_cmd.h" #include "table/strings.h" #include "../../safeguards.h" @@ -42,7 +44,11 @@ EnforcePreconditionEncodedText(false, text); EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_STATION_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG); - return ScriptObject::DoCommand(0, station_id, 0, ::Station::IsValidID(station_id) ? CMD_RENAME_STATION : CMD_RENAME_WAYPOINT, text); + if (::Station::IsValidID(station_id)) { + return ScriptObject::Command<CMD_RENAME_STATION>::Do(0, station_id, 0, text); + } else { + return ScriptObject::Command<CMD_RENAME_WAYPOINT>::Do(0, station_id, 0, text); + } } /* static */ TileIndex ScriptBaseStation::GetLocation(StationID station_id) |