diff src/station_cmd.cpp @ 8258:6017c5ebeb7e draft

(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.
author peter1138 <peter1138@openttd.org>
date Sat, 12 Jan 2008 19:58:06 +0000
parents 7d580c9c41fb
children 2495310e220f
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2625,19 +2625,13 @@
 
 	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;
-
-		st->string_id = str;
+		free(st->name);
+		st->name = strdup(_cmd_text);
+
 		UpdateStationVirtCoord(st);
-		DeleteName(old_str);
 		ResortStationLists();
 		MarkWholeScreenDirty();
-	} else {
-		DeleteName(str);
 	}
 
 	return CommandCost();
@@ -3046,6 +3040,7 @@
 	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),