Codechange: Template script command calls.

This commit is contained in:
Michael Lutz
2021-11-01 21:30:34 +01:00
parent eab18f06a4
commit 6691ee3b96
30 changed files with 310 additions and 185 deletions

View File

@@ -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)