summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-05-11 00:00:27 +0000
committerDarkvater <darkvater@openttd.org>2005-05-11 00:00:27 +0000
commit5e6923e9369a5a531d9b64da45fcfcc91f7687de (patch)
tree52f7adfab821276fb325d32c2907e8ab6461f2a5 /station_cmd.c
parentfe223eccf40cd7cf1d81053c5565e9cdbffe414c (diff)
downloadopenttd-5e6923e9369a5a531d9b64da45fcfcc91f7687de.tar.xz
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
- CodeChange: To correctly accept engine-prototypes, the best-player checking has been moved to its own function, I hope it functions the same as before. - CodeChange: Added symbolic types of PlayerID, OrderID and EngineID. For engines also added GetEngine() and IsEngineIndex(), similar to the other such functions. - CodeChange: To correctly build industries, some tables have been moved to build_industry.h. The only way to find out currently if an industry is valid in a climate is by looping all industries and checking if it matches. Also to comply with the patch setting build_rawmaterial_industries, it is assumed that these industries do not accept any cargo of any type. This can and probably should changed in the future to some flag in their struct. Also use _opt_ptr instead of _opt. - CodeChange: implemented the HQ checking code inspired by MarkR2 in "[ 1190944 ] Many commands not checked for security". Unfortunately it is impossible to prevent only deleting a HQ by a modified client atm. - CodeChange: For insert order and modify order their parameters are implicitely truncated to 8 bits, instead of the 16 bits said in the comments.
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/station_cmd.c b/station_cmd.c
index c4ab26376..f279dd5c4 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1698,7 +1698,7 @@ int32 CmdBuildAirport(int x, int y, uint32 flags, uint32 p1, uint32 p2)
h = _airport_size_y[p1];
cost = CheckFlatLandBelow(tile, w, h, flags, 0, NULL);
- if (cost == CMD_ERROR) return CMD_ERROR;
+ if (CmdFailed(cost)) return CMD_ERROR;
st = GetStationAround(tile, w, h, -1);
if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
@@ -2643,6 +2643,11 @@ static void UpdateStationWaiting(Station *st, int type, uint amount)
InvalidateWindow(WC_STATION_VIEW, st->index);
}
+/** Rename a station
+ * @param x,y unused
+ * @param p1 station ID that is to be renamed
+ * @param p2 unused
+ */
int32 CmdRenameStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
StringID str,old_str;
@@ -2654,8 +2659,7 @@ int32 CmdRenameStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!IsValidStation(st) || !CheckOwnership(st->owner)) return CMD_ERROR;
str = AllocateNameUnique((const char*)_decode_parameters, 6);
- if (str == 0)
- return CMD_ERROR;
+ if (str == 0) return CMD_ERROR;
if (flags & DC_EXEC) {
old_str = st->string_id;