(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.
This commit is contained in:
peter1138
2008-01-12 19:58:06 +00:00
parent a222fe2e86
commit ab8382c0db
38 changed files with 250 additions and 298 deletions

View File

@@ -926,18 +926,13 @@ void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *bak)
/* Make sure we always have freed the stuff */
free(bak->order);
bak->order = NULL;
free(bak->name);
bak->name = NULL;
/* Save general info */
bak->orderindex = v->cur_order_index;
bak->service_interval = v->service_interval;
/* Safe custom string, if any */
if (!IsCustomName(v->string_id)) {
bak->name[0] = '\0';
} else {
SetDParam(0, v->index);
GetString(bak->name, STR_VEHICLE_NAME, lastof(bak->name));
}
if (v->name != NULL) bak->name = strdup(v->name);
/* If we have shared orders, store it on a special way */
if (IsOrderListShared(v)) {
@@ -979,7 +974,7 @@ void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *bak)
void RestoreVehicleOrders(const Vehicle *v, const BackuppedOrders *bak)
{
/* If we have a custom name, process that */
if (!StrEmpty(bak->name)) {
if (bak->name != NULL) {
_cmd_text = bak->name;
DoCommandP(0, v->index, 0, NULL, CMD_NAME_VEHICLE);
}