src/player_gui.cpp
changeset 9413 7042a8ec3fa8
parent 9412 163c465bf250
child 9428 1ba05b499957
equal deleted inserted replaced
9412:163c465bf250 9413:7042a8ec3fa8
  1189 		this->SetWidgetHiddenState(PCW_WIDGET_BUY_SHARE,        local);
  1189 		this->SetWidgetHiddenState(PCW_WIDGET_BUY_SHARE,        local);
  1190 		this->SetWidgetHiddenState(PCW_WIDGET_SELL_SHARE,       local);
  1190 		this->SetWidgetHiddenState(PCW_WIDGET_SELL_SHARE,       local);
  1191 		this->SetWidgetHiddenState(PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking);
  1191 		this->SetWidgetHiddenState(PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking);
  1192 
  1192 
  1193 		if (!local) {
  1193 		if (!local) {
  1194 			if (_settings.economy.allow_shares) { // Shares are allowed
  1194 			if (_settings_game.economy.allow_shares) { // Shares are allowed
  1195 				/* If all shares are owned by someone (none by nobody), disable buy button */
  1195 				/* If all shares are owned by someone (none by nobody), disable buy button */
  1196 				this->SetWidgetDisabledState(PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0 ||
  1196 				this->SetWidgetDisabledState(PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0 ||
  1197 						/* Only 25% left to buy. If the player is human, disable buying it up.. TODO issues! */
  1197 						/* Only 25% left to buy. If the player is human, disable buying it up.. TODO issues! */
  1198 						(GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 1 && !p->is_ai) ||
  1198 						(GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 1 && !p->is_ai) ||
  1199 						/* Spectators cannot do anything of course */
  1199 						/* Spectators cannot do anything of course */
  1475 			this->window_number = lengthof(_highscore_table) - 1;
  1475 			this->window_number = lengthof(_highscore_table) - 1;
  1476 			this->rank = SaveHighScoreValueNetwork();
  1476 			this->rank = SaveHighScoreValueNetwork();
  1477 		} else {
  1477 		} else {
  1478 			/* in single player _local player is always valid */
  1478 			/* in single player _local player is always valid */
  1479 			const Player *p = GetPlayer(_local_player);
  1479 			const Player *p = GetPlayer(_local_player);
  1480 			this->window_number = _settings.difficulty.diff_level;
  1480 			this->window_number = _settings_game.difficulty.diff_level;
  1481 			this->rank = SaveHighScoreValue(p);
  1481 			this->rank = SaveHighScoreValue(p);
  1482 		}
  1482 		}
  1483 
  1483 
  1484 		MarkWholeScreenDirty();
  1484 		MarkWholeScreenDirty();
  1485 	}
  1485 	}
  1543 		const HighScore *hs = _highscore_table[this->window_number];
  1543 		const HighScore *hs = _highscore_table[this->window_number];
  1544 		uint x, y;
  1544 		uint x, y;
  1545 
  1545 
  1546 		this->SetupHighScoreEndWindow(&x, &y);
  1546 		this->SetupHighScoreEndWindow(&x, &y);
  1547 
  1547 
  1548 		SetDParam(0, _settings.gui.ending_year);
  1548 		SetDParam(0, _settings_client.gui.ending_year);
  1549 		SetDParam(1, this->window_number + STR_6801_EASY);
  1549 		SetDParam(1, this->window_number + STR_6801_EASY);
  1550 		DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500);
  1550 		DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500);
  1551 
  1551 
  1552 		/* Draw Highscore peepz */
  1552 		/* Draw Highscore peepz */
  1553 		for (uint8 i = 0; i < lengthof(_highscore_table[0]); i++) {
  1553 		for (uint8 i = 0; i < lengthof(_highscore_table[0]); i++) {