src/town_gui.cpp
changeset 9354 845e07db4549
parent 9347 923cdb28b336
child 9387 ede823d445f5
equal deleted inserted replaced
9353:9d76aef9fe2b 9354:845e07db4549
    74 {
    74 {
    75 	int num = 0;
    75 	int num = 0;
    76 	TownActions buttons = TACT_NONE;
    76 	TownActions buttons = TACT_NONE;
    77 
    77 
    78 	/* Spectators and unwanted have no options */
    78 	/* Spectators and unwanted have no options */
    79 	if (pid != PLAYER_SPECTATOR && !(_patches.bribe && t->unwanted[pid])) {
    79 	if (pid != PLAYER_SPECTATOR && !(_settings.economy.bribe && t->unwanted[pid])) {
    80 
    80 
    81 		/* Things worth more than this are not shown */
    81 		/* Things worth more than this are not shown */
    82 		Money avail = GetPlayer(pid)->player_money + _price.station_value * 200;
    82 		Money avail = GetPlayer(pid)->player_money + _price.station_value * 200;
    83 		Money ref = _price.build_industry >> 8;
    83 		Money ref = _price.build_industry >> 8;
    84 
    84 
    86 		 * if they are valid add them */
    86 		 * if they are valid add them */
    87 		for (uint i = 0; i != lengthof(_town_action_costs); i++) {
    87 		for (uint i = 0; i != lengthof(_town_action_costs); i++) {
    88 			const TownActions cur = (TownActions)(1 << i);
    88 			const TownActions cur = (TownActions)(1 << i);
    89 
    89 
    90 			/* Is the player not able to bribe ? */
    90 			/* Is the player not able to bribe ? */
    91 			if (cur == TACT_BRIBE && (!_patches.bribe || t->ratings[pid] >= RATING_BRIBE_MAXIMUM))
    91 			if (cur == TACT_BRIBE && (!_settings.economy.bribe || t->ratings[pid] >= RATING_BRIBE_MAXIMUM))
    92 				continue;
    92 				continue;
    93 
    93 
    94 			/* Is the player not able to buy exclusive rights ? */
    94 			/* Is the player not able to buy exclusive rights ? */
    95 			if (cur == TACT_BUY_RIGHTS && !_patches.exclusive_rights)
    95 			if (cur == TACT_BUY_RIGHTS && !_settings.economy.exclusive_rights)
    96 				continue;
    96 				continue;
    97 
    97 
    98 			/* Is the player not able to build a statue ? */
    98 			/* Is the player not able to build a statue ? */
    99 			if (cur == TACT_BUILD_STATUE && HasBit(t->statues, pid))
    99 			if (cur == TACT_BUILD_STATUE && HasBit(t->statues, pid))
   100 				continue;
   100 				continue;
   311 			this->widget[TVW_CHANGENAME].bottom = this->widget[TVW_EXPAND].bottom;
   311 			this->widget[TVW_CHANGENAME].bottom = this->widget[TVW_EXPAND].bottom;
   312 			this->widget[TVW_CHANGENAME].right = this->widget[TVW_STICKY].right;
   312 			this->widget[TVW_CHANGENAME].right = this->widget[TVW_STICKY].right;
   313 		}
   313 		}
   314 
   314 
   315 		/* Space required for showing noise level information */
   315 		/* Space required for showing noise level information */
   316 		if (_patches.station_noise_level) {
   316 		if (_settings.economy.station_noise_level) {
   317 			ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
   317 			ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
   318 		}
   318 		}
   319 
   319 
   320 		this->FindWindowPlacementAndResize(desc);
   320 		this->FindWindowPlacementAndResize(desc);
   321 	}
   321 	}
   341 		DrawString(2, 127, STR_200E_MAIL_LAST_MONTH_MAX, TC_FROMSTRING);
   341 		DrawString(2, 127, STR_200E_MAIL_LAST_MONTH_MAX, TC_FROMSTRING);
   342 
   342 
   343 		this->DrawViewport();
   343 		this->DrawViewport();
   344 
   344 
   345 		/* only show the town noise, if the noise option is activated. */
   345 		/* only show the town noise, if the noise option is activated. */
   346 		if (_patches.station_noise_level) {
   346 		if (_settings.economy.station_noise_level) {
   347 			SetDParam(0, this->town->noise_reached);
   347 			SetDParam(0, this->town->noise_reached);
   348 			SetDParam(1, this->town->MaxTownNoise());
   348 			SetDParam(1, this->town->MaxTownNoise());
   349 			DrawString(2, 137, STR_NOISE_IN_TOWN, 0);
   349 			DrawString(2, 137, STR_NOISE_IN_TOWN, 0);
   350 		}
   350 		}
   351 	}
   351 	}
   383 	virtual void OnInvalidateData(int data = 0)
   383 	virtual void OnInvalidateData(int data = 0)
   384 	{
   384 	{
   385 		/* Called when setting station noise have changed, in order to resize the window */
   385 		/* Called when setting station noise have changed, in order to resize the window */
   386 		this->SetDirty(); // refresh display for current size. This will allow to avoid glitches when downgrading
   386 		this->SetDirty(); // refresh display for current size. This will allow to avoid glitches when downgrading
   387 
   387 
   388 		if (_patches.station_noise_level) { // adjust depending
   388 		if (_settings.economy.station_noise_level) { // adjust depending
   389 			if (this->height == 150) { // window is smaller, needs to be bigger
   389 			if (this->height == 150) { // window is smaller, needs to be bigger
   390 				ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
   390 				ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
   391 			}
   391 			}
   392 		} else {
   392 		} else {
   393 			if (this->height != 150) { // window is bigger, needs to be smaller
   393 			if (this->height != 150) { // window is bigger, needs to be smaller