summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-06-04 11:56:32 +0000
committertron <tron@openttd.org>2005-06-04 11:56:32 +0000
commit0c4ecbe9ece42d071a4f4e4b6d506be32030cb4c (patch)
tree172ef15bca6626b797fbf586a043a978ee884141 /train_cmd.c
parent19e2b40a788cc175f35e4ca0cec0f439bd46ab76 (diff)
downloadopenttd-0c4ecbe9ece42d071a4f4e4b6d506be32030cb4c.tar.xz
(svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/train_cmd.c b/train_cmd.c
index a718fd3dd..faf73b5ad 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -538,7 +538,7 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
* to the player. Doesn't matter if only the cost is queried */
if (!(flags & DC_QUERY_COST)) {
if (!IsTileDepotType(tile, TRANSPORT_RAIL)) return CMD_ERROR;
- if (_map_owner[tile] != _current_player) return CMD_ERROR;
+ if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
}
_cmd_build_rail_veh_var1 = 0;
@@ -1387,7 +1387,7 @@ typedef struct TrainFindDepotData {
static bool TrainFindDepotEnumProc(uint tile, TrainFindDepotData *tfdd, int track, uint length, byte *state)
{
- if (IsTileType(tile, MP_RAILWAY) && _map_owner[tile] == tfdd->owner) {
+ if (IsTileType(tile, MP_RAILWAY) && IsTileOwner(tile, tfdd->owner)) {
if ((_map5[tile] & ~0x3) == 0xC0) {
if (length < tfdd->best_length) {
tfdd->best_length = length;
@@ -2314,7 +2314,7 @@ static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile)
case MP_STREET:
// tracks over roads, do owner check of tracks (_map_owner[tile])
return
- _map_owner[tile] == v->owner &&
+ IsTileOwner(tile, v->owner) &&
(v->subtype != TS_Front_Engine || (_map3_hi[tile] & 0xF) == v->u.rail.railtype);
default:
@@ -2322,7 +2322,7 @@ static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile)
}
return
- _map_owner[tile] == v->owner &&
+ IsTileOwner(tile, v->owner) &&
(v->subtype != TS_Front_Engine || (_map3_lo[tile] & 0xF) == v->u.rail.railtype);
}