summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-12 19:58:06 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-12 19:58:06 +0000
commit0f7392bd616e0bd256b5ec241ad52d7230bcc454 (patch)
treef23fb584e594e0c9ff5a9ad650d97c493714078d /src/station_cmd.cpp
parent74f9be8f2c1dca108b88449e6935c61442cbf829 (diff)
downloadopenttd-0f7392bd616e0bd256b5ec241ad52d7230bcc454.tar.xz
(svn r11822) -Codechange: Replaced fixed size custom name array. Names are now attached to their object directly and there is
no limit to the amount of names. -Fix: NewGRF engines could not be renamed.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 2b927645d..0a5afbf12 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2625,19 +2625,13 @@ CommandCost CmdRenameStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!IsUniqueStationName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);
- StringID str = AllocateName(_cmd_text, 6);
- if (str == 0) return CMD_ERROR;
-
if (flags & DC_EXEC) {
- StringID old_str = st->string_id;
+ free(st->name);
+ st->name = strdup(_cmd_text);
- st->string_id = str;
UpdateStationVirtCoord(st);
- DeleteName(old_str);
ResortStationLists();
MarkWholeScreenDirty();
- } else {
- DeleteName(str);
}
return CommandCost();
@@ -3046,6 +3040,7 @@ static const SaveLoad _station_desc[] = {
SLE_CONDNULL(1, 0, 3),
SLE_VAR(Station, string_id, SLE_STRINGID),
+ SLE_CONDSTR(Station, name, SLE_STR, 0, 84, SL_MAX_VERSION),
SLE_VAR(Station, had_vehicle_of_type, SLE_UINT16),
SLE_VAR(Station, time_since_load, SLE_UINT8),