mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-12 09:09:09 +00:00
(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).
This commit is contained in:
2
engine.c
2
engine.c
@@ -887,7 +887,7 @@ int32 CmdRenameEngine(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
{
|
{
|
||||||
StringID str;
|
StringID str;
|
||||||
|
|
||||||
if (!IsEngineIndex(p1)) return CMD_ERROR;
|
if (!IsEngineIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
|
||||||
|
|
||||||
str = AllocateNameUnique(_cmd_text, 0);
|
str = AllocateNameUnique(_cmd_text, 0);
|
||||||
if (str == 0) return CMD_ERROR;
|
if (str == 0) return CMD_ERROR;
|
||||||
|
@@ -129,6 +129,8 @@ int32 CmdChangeCompanyName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
StringID str;
|
StringID str;
|
||||||
Player *p;
|
Player *p;
|
||||||
|
|
||||||
|
if (_cmd_text[0] == '\0') return CMD_ERROR;
|
||||||
|
|
||||||
str = AllocateNameUnique(_cmd_text, 4);
|
str = AllocateNameUnique(_cmd_text, 4);
|
||||||
if (str == 0) return CMD_ERROR;
|
if (str == 0) return CMD_ERROR;
|
||||||
|
|
||||||
@@ -153,6 +155,8 @@ int32 CmdChangePresidentName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
StringID str;
|
StringID str;
|
||||||
Player *p;
|
Player *p;
|
||||||
|
|
||||||
|
if (_cmd_text[0] == '\0') return CMD_ERROR;
|
||||||
|
|
||||||
str = AllocateNameUnique(_cmd_text, 4);
|
str = AllocateNameUnique(_cmd_text, 4);
|
||||||
if (str == 0) return CMD_ERROR;
|
if (str == 0) return CMD_ERROR;
|
||||||
|
|
||||||
|
@@ -2653,7 +2653,7 @@ int32 CmdRenameStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
StringID str,old_str;
|
StringID str,old_str;
|
||||||
Station *st;
|
Station *st;
|
||||||
|
|
||||||
if (!IsStationIndex(p1)) return CMD_ERROR;
|
if (!IsStationIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
|
||||||
st = GetStation(p1);
|
st = GetStation(p1);
|
||||||
|
|
||||||
if (!IsValidStation(st) || !CheckOwnership(st->owner)) return CMD_ERROR;
|
if (!IsValidStation(st) || !CheckOwnership(st->owner)) return CMD_ERROR;
|
||||||
|
@@ -1447,7 +1447,7 @@ int32 CmdRenameTown(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
StringID str;
|
StringID str;
|
||||||
Town *t;
|
Town *t;
|
||||||
|
|
||||||
if (!IsTownIndex(p1)) return CMD_ERROR;
|
if (!IsTownIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
|
||||||
|
|
||||||
t = GetTown(p1);
|
t = GetTown(p1);
|
||||||
|
|
||||||
|
@@ -1654,7 +1654,7 @@ int32 CmdNameVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
StringID str;
|
StringID str;
|
||||||
|
|
||||||
if (!IsVehicleIndex(p1)) return CMD_ERROR;
|
if (!IsVehicleIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
|
||||||
|
|
||||||
v = GetVehicle(p1);
|
v = GetVehicle(p1);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user