(svn r1401) -Fix: glitches in train-depot GUI (tnx to Hackykid)

-Fix: glitch in Company Overview GUI (Hackykid)
This commit is contained in:
truelight
2005-01-06 17:40:57 +00:00
parent 8e58dd8dec
commit 2c9cd8f68c
2 changed files with 22 additions and 19 deletions

View File

@@ -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);