summaryrefslogtreecommitdiff
path: root/unmovable_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 /unmovable_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 'unmovable_cmd.c')
-rw-r--r--unmovable_cmd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/unmovable_cmd.c b/unmovable_cmd.c
index 00be0473f..b1a94e167 100644
--- a/unmovable_cmd.c
+++ b/unmovable_cmd.c
@@ -122,7 +122,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
// statue
DrawGroundSprite(0x58C);
- image = PLAYER_SPRITE_COLOR(_map_owner[ti->tile]);
+ image = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
image += 0x8A48;
if (_display_opt & DO_TRANS_BUILDINGS)
image = (image & 0x3FFF) | 0x3224000;
@@ -133,7 +133,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
DrawClearLandTile(ti, 0);
AddSortableSpriteToDraw(
- PLAYER_SPRITE_COLOR(_map_owner[ti->tile]) + 0x92B6,
+ PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)) + 0x92B6,
ti->x+8, ti->y+8,
1, 1,
10,
@@ -165,7 +165,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
if (ti->tileh) DrawFoundation(ti, ti->tileh);
- ormod = PLAYER_SPRITE_COLOR(_map_owner[ti->tile]);
+ ormod = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
t = &_unmovable_display_datas[ti->map5 & 0x7F];
DrawGroundSprite(t->ground_sprite | ormod);
@@ -255,7 +255,7 @@ static void GetTileDesc_Unmovable(uint tile, TileDesc *td)
int i = _map5[tile];
if (i & 0x80) i = -1;
td->str = _unmovable_tile_str[i + 1];
- td->owner = _map_owner[tile];
+ td->owner = GetTileOwner(tile);
}
static void AnimateTile_Unmovable(uint tile)
@@ -308,7 +308,7 @@ static uint32 GetTileTrackStatus_Unmovable(uint tile, TransportType mode)
static void ClickTile_Unmovable(uint tile)
{
if (_map5[tile] & 0x80) {
- ShowPlayerCompany(_map_owner[tile]);
+ ShowPlayerCompany(GetTileOwner(tile));
}
}
@@ -396,8 +396,7 @@ restart:
static void ChangeTileOwner_Unmovable(uint tile, byte old_player, byte new_player)
{
- if (_map_owner[tile] != old_player)
- return;
+ if (!IsTileOwner(tile, old_player)) return;
if (_map5[tile]==3 && new_player != 255) {
_map_owner[tile] = new_player;