From 0f7392bd616e0bd256b5ec241ad52d7230bcc454 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sat, 12 Jan 2008 19:58:06 +0000 Subject: (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. --- src/station_cmd.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/station_cmd.cpp') 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), -- cgit v1.2.3-54-g00ecf