mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-29 02:12:11 +00:00
(svn r2278) When renaming a station, check if the station exists and belongs to the correct player
This commit is contained in:
parent
0618a6d0df
commit
b90e9d49ca
@ -2650,12 +2650,16 @@ int32 CmdRenameStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
StringID str,old_str;
|
||||
Station *st;
|
||||
|
||||
if (!IsStationIndex(p1)) return CMD_ERROR;
|
||||
st = GetStation(p1);
|
||||
|
||||
if (!IsValidStation(st) || !CheckOwnership(st->owner)) return CMD_ERROR;
|
||||
|
||||
str = AllocateNameUnique((const char*)_decode_parameters, 6);
|
||||
if (str == 0)
|
||||
return CMD_ERROR;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
st = GetStation(p1);
|
||||
old_str = st->string_id;
|
||||
st->string_id = str;
|
||||
UpdateStationVirtCoord(st);
|
||||
|
Loading…
Reference in New Issue
Block a user