504 uint32 dis = 0; |
504 uint32 dis = 0; |
505 |
505 |
506 if (!IsWindowOfPrototype(w, _other_player_company_widgets)) { |
506 if (!IsWindowOfPrototype(w, _other_player_company_widgets)) { |
507 AssignWidgetToWindow(w, (p->location_of_house != 0) ? _my_player_company_bh_widgets : _my_player_company_widgets); |
507 AssignWidgetToWindow(w, (p->location_of_house != 0) ? _my_player_company_bh_widgets : _my_player_company_widgets); |
508 |
508 |
509 if (!_networking) w->hidden_state |= (1 << 11); // hide company-password widget |
509 if (!_networking) SETBIT(w->hidden_state, 11); // hide company-password widget |
510 } else { |
510 } else { |
511 if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) dis |= 1 << 9; |
511 if (_patches.allow_shares) { /* shares are allowed */ |
512 // Also disable the buy button if 25% is not-owned by someone |
512 if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) SETBIT(dis, 9); |
513 // and the player is not an AI |
513 |
514 if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) dis |= 1 << 9; |
514 /* We cannot buy out real players in a network game */ |
515 if (GetAmountOwnedBy(p, _local_player) == 0) dis |= 1 << 10; |
515 if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) SETBIT(dis, 9); |
516 if (_local_player == OWNER_SPECTATOR) dis |= (1 << 9) | (1 << 10); |
516 |
|
517 if (GetAmountOwnedBy(p, _local_player) == 0) SETBIT(dis, 10); |
|
518 |
|
519 if (_local_player == OWNER_SPECTATOR) dis |= (1 << 9) | (1 << 10); |
|
520 } else /* shares are not allowed, disable buy/sell buttons */ |
|
521 dis |= (1 << 9) | (1 << 10); |
517 } |
522 } |
518 |
523 |
519 SetDParam(0, p->name_1); |
524 SetDParam(0, p->name_1); |
520 SetDParam(1, p->name_2); |
525 SetDParam(1, p->name_2); |
521 SetDParam(2, GetPlayerNameString((byte)w->window_number, 3)); |
526 SetDParam(2, GetPlayerNameString((byte)w->window_number, 3)); |