summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-05-17 20:58:58 +0000
committerDarkvater <Darkvater@openttd.org>2005-05-17 20:58:58 +0000
commitabc5fd1272051418f8d7a01ce2c9e61d8a51dff5 (patch)
treecd9b1f30e5a04a6235b23925111ea07647882889
parent6dba03a819e6a71ec84935515d8b2ed17a45aca8 (diff)
downloadopenttd-abc5fd1272051418f8d7a01ce2c9e61d8a51dff5.tar.xz
(svn r2345) - Fix: Don't allow stuff to be renamed to nothing if we don't support it. Only valid ones are signs (delete) and waypoints (rename to default).
-rw-r--r--engine.c2
-rw-r--r--misc_cmd.c4
-rw-r--r--station_cmd.c2
-rw-r--r--town_cmd.c2
-rw-r--r--vehicle.c2
5 files changed, 8 insertions, 4 deletions
diff --git a/engine.c b/engine.c
index 11746e747..85d161127 100644
--- a/engine.c
+++ b/engine.c
@@ -887,7 +887,7 @@ int32 CmdRenameEngine(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
StringID str;
- if (!IsEngineIndex(p1)) return CMD_ERROR;
+ if (!IsEngineIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
str = AllocateNameUnique(_cmd_text, 0);
if (str == 0) return CMD_ERROR;
diff --git a/misc_cmd.c b/misc_cmd.c
index eca0eba6c..c1e7e1e41 100644
--- a/misc_cmd.c
+++ b/misc_cmd.c
@@ -129,6 +129,8 @@ int32 CmdChangeCompanyName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str;
Player *p;
+ if (_cmd_text[0] == '\0') return CMD_ERROR;
+
str = AllocateNameUnique(_cmd_text, 4);
if (str == 0) return CMD_ERROR;
@@ -153,6 +155,8 @@ int32 CmdChangePresidentName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str;
Player *p;
+ if (_cmd_text[0] == '\0') return CMD_ERROR;
+
str = AllocateNameUnique(_cmd_text, 4);
if (str == 0) return CMD_ERROR;
diff --git a/station_cmd.c b/station_cmd.c
index 79ea2ce84..1e99d3eb1 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -2653,7 +2653,7 @@ int32 CmdRenameStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str,old_str;
Station *st;
- if (!IsStationIndex(p1)) return CMD_ERROR;
+ if (!IsStationIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
st = GetStation(p1);
if (!IsValidStation(st) || !CheckOwnership(st->owner)) return CMD_ERROR;
diff --git a/town_cmd.c b/town_cmd.c
index 8eb782d9e..498c2154b 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -1447,7 +1447,7 @@ int32 CmdRenameTown(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str;
Town *t;
- if (!IsTownIndex(p1)) return CMD_ERROR;
+ if (!IsTownIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
t = GetTown(p1);
diff --git a/vehicle.c b/vehicle.c
index 82a2bf719..c0649f069 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1654,7 +1654,7 @@ int32 CmdNameVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v;
StringID str;
- if (!IsVehicleIndex(p1)) return CMD_ERROR;
+ if (!IsVehicleIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
v = GetVehicle(p1);