Changeset - r21716:d892747529d1
[Not reviewed]
master
0 1 0
frosch - 10 years ago 2014-09-20 11:32:54
frosch@openttd.org
(svn r26859) -Fix [FS#6119]: Height computation of game script text in town GUI did not consider margins.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/town_gui.cpp
Show inline comments
 
@@ -397,25 +397,25 @@ public:
 
			DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, y += FONT_HEIGHT_NORMAL, STR_TOWN_VIEW_TOWN_GROW_STOPPED);
 
		}
 

	
 
		/* only show the town noise, if the noise option is activated. */
 
		if (_settings_game.economy.station_noise_level) {
 
			SetDParam(0, this->town->noise_reached);
 
			SetDParam(1, this->town->MaxTownNoise());
 
			DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, y += FONT_HEIGHT_NORMAL, STR_TOWN_VIEW_NOISE_IN_TOWN);
 
		}
 

	
 
		if (this->town->text != NULL) {
 
			SetDParamStr(0, this->town->text);
 
			DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, y += FONT_HEIGHT_NORMAL, UINT16_MAX, STR_JUST_RAW_STRING, TC_BLACK);
 
			DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y += FONT_HEIGHT_NORMAL, UINT16_MAX, STR_JUST_RAW_STRING, TC_BLACK);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case WID_TV_CENTER_VIEW: // scroll to location
 
				if (_ctrl_pressed) {
 
					ShowExtraViewPortWindow(this->town->xy);
 
				} else {
 
					ScrollMainWindowToTile(this->town->xy);
 
				}
 
@@ -475,25 +475,25 @@ public:
 
			if (first) {
 
				aimed_height += FONT_HEIGHT_NORMAL;
 
				first = false;
 
			}
 
			aimed_height += FONT_HEIGHT_NORMAL;
 
		}
 
		aimed_height += FONT_HEIGHT_NORMAL;
 

	
 
		if (_settings_game.economy.station_noise_level) aimed_height += FONT_HEIGHT_NORMAL;
 

	
 
		if (this->town->text != NULL) {
 
			SetDParamStr(0, this->town->text);
 
			aimed_height += GetStringHeight(STR_JUST_RAW_STRING, width);
 
			aimed_height += GetStringHeight(STR_JUST_RAW_STRING, width - WD_FRAMERECT_LEFT - WD_FRAMERECT_RIGHT);
 
		}
 

	
 
		return aimed_height;
 
	}
 

	
 
	void ResizeWindowAsNeeded()
 
	{
 
		const NWidgetBase *nwid_info = this->GetWidget<NWidgetBase>(WID_TV_INFO);
 
		uint aimed_height = GetDesiredInfoHeight(nwid_info->current_x);
 
		if (aimed_height > nwid_info->current_y || (aimed_height < nwid_info->current_y && nwid_info->current_y > nwid_info->smallest_y)) {
 
			this->ReInit();
 
		}
0 comments (0 inline, 0 general)