Changeset - r8423:7b695adaa2cf
[Not reviewed]
master
0 6 0
peter1138 - 17 years ago 2008-01-27 11:01:10
peter1138@openttd.org
(svn r11993) -Fix: Resize station/roadstop/dock/airport construction windows if cargo acceptance list is too long.
6 files changed with 33 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -186,7 +186,12 @@ static void BuildAirportPickerWndProc(Wi
 
		DrawWindowWidgets(w);
 
		// strings such as 'Size' and 'Coverage Area'
 
		// 'Coverage Area'
 
		DrawStationCoverageAreaText(2, 206, SCT_ALL, rad);
 
		int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad) + 4;
 
		if (text_end > w->widget[6].bottom) {
 
			SetWindowDirty(w);
 
			ResizeWindowForWidget(w, 6, 0, text_end - w->widget[6].bottom);
 
			SetWindowDirty(w);
 
		}
 
		break;
 
	}
 

	
src/dock_gui.cpp
Show inline comments
 
@@ -254,7 +254,13 @@ static void BuildDockStationWndProc(Wind
 
			SetTileSelectSize(1, 1);
 
		}
 

	
 
		DrawStationCoverageAreaText(4, 50, SCT_ALL, rad);
 
		int text_end = DrawStationCoverageAreaText(4, 50, SCT_ALL, rad) + 4;
 
		if (text_end > w->widget[2].bottom) {
 
			SetWindowDirty(w);
 
			ResizeWindowForWidget(w, 2, 0, text_end - w->widget[2].bottom);
 
			SetWindowDirty(w);
 
		}
 

	
 
		break;
 
	}
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -773,7 +773,7 @@ void GuiShowTooltipsWithArgs(StringID st
 
}
 

	
 

	
 
static void DrawStationCoverageText(const AcceptedCargo accepts,
 
static int DrawStationCoverageText(const AcceptedCargo accepts,
 
	int str_x, int str_y, StationCoverageType sct)
 
{
 
	char *b = _userstring;
 
@@ -809,17 +809,19 @@ static void DrawStationCoverageText(cons
 
	/* Make sure we detect any buffer overflow */
 
	assert(b < endof(_userstring));
 

	
 
	DrawStringMultiLine(str_x, str_y, STR_SPEC_USERSTRING, 144);
 
	return DrawStringMultiLine(str_x, str_y, STR_SPEC_USERSTRING, 144);
 
}
 

	
 
void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad)
 
int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad)
 
{
 
	TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y);
 
	AcceptedCargo accepts;
 
	if (tile < MapSize()) {
 
		GetAcceptanceAroundTiles(accepts, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad);
 
		DrawStationCoverageText(accepts, sx, sy, sct);
 
		return sy + DrawStationCoverageText(accepts, sx, sy, sct);
 
	}
 

	
 
	return sy;
 
}
 

	
 
void CheckRedrawStationCoverage(const Window *w)
src/rail_gui.cpp
Show inline comments
 
@@ -864,7 +864,12 @@ static void StationBuildWndProc(Window *
 
		DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING);
 
		DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, TC_FROMSTRING);
 

	
 
		DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad);
 
		int text_end = DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad) + 4;
 
		if (text_end > w->widget[BRSW_BACKGROUND].bottom) {
 
			SetWindowDirty(w);
 
			ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom);
 
			SetWindowDirty(w);
 
		}
 

	
 
		if (newstations) {
 
			uint y = 35;
src/road_gui.cpp
Show inline comments
 
@@ -825,9 +825,14 @@ static void RoadStationPickerWndProc(Win
 
		StationPickerDrawSprite(171, 35, st, INVALID_RAILTYPE, _cur_roadtype, 4);
 
		StationPickerDrawSprite(171, 85, st, INVALID_RAILTYPE, _cur_roadtype, 5);
 

	
 
		DrawStationCoverageAreaText(2, 146,
 
		int text_end = DrawStationCoverageAreaText(2, 146,
 
			(w->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY,
 
			3);
 
			3) + 4;
 
		if (text_end > w->widget[BRSW_BACKGROUND].bottom) {
 
			SetWindowDirty(w);
 
			ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom);
 
			SetWindowDirty(w);
 
		}
 

	
 
	} break;
 

	
src/station_gui.h
Show inline comments
 
@@ -58,7 +58,7 @@ enum StationCoverageType {
 
	SCT_ALL
 
};
 

	
 
void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad);
 
int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad);
 
void CheckRedrawStationCoverage(const Window *w);
 

	
 
extern bool _station_show_coverage;
0 comments (0 inline, 0 general)