summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-08-10 14:33:37 +0000
committerdarkvater <darkvater@openttd.org>2004-08-10 14:33:37 +0000
commitcc8080f2dc96d27035830915a9679101d0a77085 (patch)
treedf00c9d139288f1e953dabcd6d09d66d010aab50
parente4940ebc79149fee171d11ed33e10a810a25c379 (diff)
downloadopenttd-cc8080f2dc96d27035830915a9679101d0a77085.tar.xz
(svn r4) -Fix [996025] _local_player fixes. Fixes wrong memory access (TrueLight)
-rw-r--r--misc_gui.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/misc_gui.c b/misc_gui.c
index c8c9e4d2f..c1b30b0a9 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -135,16 +135,16 @@ static void Place_LandInfo(uint tile)
lid.tile = tile;
lid.town = ClosestTownFromTile(tile, _patches.dist_local_authority);
- if (_local_player == 255) {
- lid.costclear = 0;
- } else {
+ if (_local_player >= MAX_PLAYERS)
+ p = DEREF_PLAYER(0);
+ else
p = DEREF_PLAYER(_local_player);
- old_money = p->money64;
- p->money64 = p->player_money = 0x7fffffff;
- lid.costclear = DoCommandByTile(tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR);
- p->money64 = old_money;
- UpdatePlayerMoney32(p);
- }
+
+ old_money = p->money64;
+ p->money64 = p->player_money = 0x7fffffff;
+ lid.costclear = DoCommandByTile(tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR);
+ p->money64 = old_money;
+ UpdatePlayerMoney32(p);
GetAcceptedCargo(tile, &lid.ac);
GetTileDesc(tile, &lid.td);