summaryrefslogtreecommitdiff
path: root/player_gui.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-01-06 17:40:57 +0000
committertruelight <truelight@openttd.org>2005-01-06 17:40:57 +0000
commit2c9cd8f68c1bf491e4c887de2899f0e0601c297c (patch)
treef7f9f3da92039b27065ab51729b36e613b5e9f4e /player_gui.c
parent8e58dd8dec13a7db75452ca5c8ed6c9541bbce8a (diff)
downloadopenttd-2c9cd8f68c1bf491e4c887de2899f0e0601c297c.tar.xz
(svn r1401) -Fix: glitches in train-depot GUI (tnx to Hackykid)
-Fix: glitch in Company Overview GUI (Hackykid)
Diffstat (limited to 'player_gui.c')
-rw-r--r--player_gui.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/player_gui.c b/player_gui.c
index 4c7fab8cb..c03d6a1bc 100644
--- a/player_gui.c
+++ b/player_gui.c
@@ -497,26 +497,25 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
switch(e->event) {
case WE_PAINT: {
Player *p = DEREF_PLAYER(w->window_number);
- uint32 dis;
+ uint32 dis = 0;
if (!IsWindowOfPrototype(w, _other_player_company_widgets)) {
AssignWidgetToWindow(w, (p->location_of_house != 0) ? _my_player_company_bh_widgets : _my_player_company_widgets);
if (!_networking) w->hidden_state |= (1 << 9); // hide company-password widget
+ } else {
+ if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) dis |= 1 << 9;
+ // Also disable the buy button if 25% is not-owned by someone
+ // and the player is not an AI
+ if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) dis |= 1 << 9;
+ if (GetAmountOwnedBy(p, _local_player) == 0) dis |= 1 << 10;
+ if (_local_player == OWNER_SPECTATOR) dis |= (1 << 9) | (1 << 10);
}
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, GetPlayerNameString((byte)w->window_number, 3));
- dis = 0;
- if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) dis |= 1 << 9;
- // Also disable the buy button if 25% is not-owned by someone
- // and the player is not an AI
- if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) dis |= 1 << 9;
- if (GetAmountOwnedBy(p, _local_player) == 0) dis |= 1 << 10;
- if (_local_player == OWNER_SPECTATOR) dis |= (1 << 9) | (1 << 10);
-
w->disabled_state = dis;
DrawWindowWidgets(w);