diff options
author | peter1138 <peter1138@openttd.org> | 2008-01-12 19:58:06 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-01-12 19:58:06 +0000 |
commit | ab8382c0db353d9d1ba6b7a9690d56aa2415258c (patch) | |
tree | f23fb584e594e0c9ff5a9ad650d97c493714078d /src/station_cmd.cpp | |
parent | a222fe2e86d2736217f3bba43b28e95297b8d71e (diff) | |
download | openttd-ab8382c0db353d9d1ba6b7a9690d56aa2415258c.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.cpp | 11 |
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), |