src/misc_gui.cpp
changeset 9413 7042a8ec3fa8
parent 9407 079a6bf07bae
child 9441 6f3d3595b42c
equal deleted inserted replaced
9412:163c465bf250 9413:7042a8ec3fa8
   100 		if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) DrawStringMultiCenter(140, y, BindCString(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]), this->width - 4);
   100 		if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) DrawStringMultiCenter(140, y, BindCString(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]), this->width - 4);
   101 	}
   101 	}
   102 
   102 
   103 	LandInfoWindow(TileIndex tile) : Window(&_land_info_desc) {
   103 	LandInfoWindow(TileIndex tile) : Window(&_land_info_desc) {
   104 		Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : PLAYER_FIRST);
   104 		Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : PLAYER_FIRST);
   105 		Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
   105 		Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
   106 
   106 
   107 		Money old_money = p->player_money;
   107 		Money old_money = p->player_money;
   108 		p->player_money = INT64_MAX;
   108 		p->player_money = INT64_MAX;
   109 		CommandCost costclear = DoCommand(tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR);
   109 		CommandCost costclear = DoCommand(tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR);
   110 		p->player_money = old_money;
   110 		p->player_money = old_money;
   394 public:
   394 public:
   395 	ErrmsgWindow(Point pt, int width, int height, StringID msg1, StringID msg2, const Widget *widget, bool show_player_face) :
   395 	ErrmsgWindow(Point pt, int width, int height, StringID msg1, StringID msg2, const Widget *widget, bool show_player_face) :
   396 			Window(pt.x, pt.y, width, height, WC_ERRMSG, widget),
   396 			Window(pt.x, pt.y, width, height, WC_ERRMSG, widget),
   397 			show_player_face(show_player_face)
   397 			show_player_face(show_player_face)
   398 	{
   398 	{
   399 		this->duration = _settings.gui.errmsg_duration;
   399 		this->duration = _settings_client.gui.errmsg_duration;
   400 		CopyOutDParam(this->decode_params, 0, lengthof(this->decode_params));
   400 		CopyOutDParam(this->decode_params, 0, lengthof(this->decode_params));
   401 		this->message_1 = msg1;
   401 		this->message_1 = msg1;
   402 		this->message_2 = msg2;
   402 		this->message_2 = msg2;
   403 		this->desc_flags = WDF_STD_BTN | WDF_DEF_WIDGET;
   403 		this->desc_flags = WDF_STD_BTN | WDF_DEF_WIDGET;
   404 		this->FindWindowPlacementAndResize(width, height);
   404 		this->FindWindowPlacementAndResize(width, height);
   463 
   463 
   464 void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y)
   464 void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y)
   465 {
   465 {
   466 	DeleteWindowById(WC_ERRMSG, 0);
   466 	DeleteWindowById(WC_ERRMSG, 0);
   467 
   467 
   468 	if (!_settings.gui.errmsg_duration) return;
   468 	if (!_settings_client.gui.errmsg_duration) return;
   469 
   469 
   470 	if (msg_2 == STR_NULL) msg_2 = STR_EMPTY;
   470 	if (msg_2 == STR_NULL) msg_2 = STR_EMPTY;
   471 
   471 
   472 	Point pt;
   472 	Point pt;
   473 	const ViewPort *vp;
   473 	const ViewPort *vp;
   618 void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[])
   618 void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[])
   619 {
   619 {
   620 	DeleteWindowById(WC_TOOLTIPS, 0);
   620 	DeleteWindowById(WC_TOOLTIPS, 0);
   621 
   621 
   622 	/* We only show measurement tooltips with patch setting on */
   622 	/* We only show measurement tooltips with patch setting on */
   623 	if (str == STR_NULL || (paramcount != 0 && !_settings.gui.measure_tooltip)) return;
   623 	if (str == STR_NULL || (paramcount != 0 && !_settings_client.gui.measure_tooltip)) return;
   624 
   624 
   625 	for (uint i = 0; i != paramcount; i++) SetDParam(i, params[i]);
   625 	for (uint i = 0; i != paramcount; i++) SetDParam(i, params[i]);
   626 	char buffer[512];
   626 	char buffer[512];
   627 	GetString(buffer, str, lastof(buffer));
   627 	GetString(buffer, str, lastof(buffer));
   628 
   628