summaryrefslogtreecommitdiff
path: root/src/order_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
commitab8382c0db353d9d1ba6b7a9690d56aa2415258c (patch)
treef23fb584e594e0c9ff5a9ad650d97c493714078d /src/order_cmd.cpp
parenta222fe2e86d2736217f3bba43b28e95297b8d71e (diff)
downloadopenttd-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/order_cmd.cpp')
-rw-r--r--src/order_cmd.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index c301da838..cee298a2f 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -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);
}