Changeset - r17800:b328f4737f81
[Not reviewed]
master
0 1 0
yexo - 13 years ago 2011-06-17 20:32:25
yexo@openttd.org
(svn r22595) -Fix [FS#4560] (r22593): build railstation gui was broken with newgrf stations
1 file changed with 3 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/station_gui.cpp
Show inline comments
 
@@ -81,36 +81,34 @@ static int DrawCargoListText(uint32 carg
 
 * @param supplies if supplied cargos should be drawn, else accepted cargos
 
 * @return Returns the y value below the string that was drawn
 
 */
 
int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies)
 
{
 
	TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y);
 
	uint32 cargo_mask = 0;
 
	if (_thd.drawstyle == HT_RECT && tile < MapSize()) {
 
		CargoArray cargos;
 
		if (supplies) {
 
			cargos = GetProductionAroundTiles(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE, rad);
 
		} else {
 
			cargos = GetAcceptanceAroundTiles(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE, rad);
 
		}
 

	
 
		/* Convert cargo counts to a set of cargo bits, and draw the result. */
 
		uint32 cargo_mask = 0;
 
		for (CargoID i = 0; i < NUM_CARGO; i++) {
 
			switch (sct) {
 
				case SCT_PASSENGERS_ONLY: if (!IsCargoInClass(i, CC_PASSENGERS)) continue; break;
 
				case SCT_NON_PASSENGERS_ONLY: if (IsCargoInClass(i, CC_PASSENGERS)) continue; break;
 
				case SCT_ALL: break;
 
				default: NOT_REACHED();
 
			}
 
			if (cargos[i] >= (supplies ? 1U : 8U)) SetBit(cargo_mask, i);
 
		}
 
		Rect r = {left, top, right, INT32_MAX};
 
		return DrawCargoListText(cargo_mask, r, supplies ? STR_STATION_BUILD_SUPPLIES_CARGO : STR_STATION_BUILD_ACCEPTS_CARGO);
 
	}
 

	
 
	return top;
 
	Rect r = {left, top, right, INT32_MAX};
 
	return DrawCargoListText(cargo_mask, r, supplies ? STR_STATION_BUILD_SUPPLIES_CARGO : STR_STATION_BUILD_ACCEPTS_CARGO);
 
}
 

	
 
/**
 
 * Check whether we need to redraw the station coverage text.
 
 * If it is needed actually make the window for redrawing.
 
 * @param w the window to check.
0 comments (0 inline, 0 general)