@@ -63,72 +63,70 @@ static int DrawCargoListText(uint32 carg
if (first) b = InlineString(b, STR_JUST_NOTHING);
*b = '\0';
/* Make sure we detect any buffer overflow */
assert(b < endof(string));
SetDParamStr(0, string);
return DrawStringMultiLine(r.left, r.right, r.top, r.bottom, prefix);
}
/**
* Calculates and draws the accepted or supplied cargo around the selected tile(s)
* @param left x position where the string is to be drawn
* @param right the right most position to draw on
* @param top y position where the string is to be drawn
* @param sct which type of cargo is to be displayed (passengers/non-passengers)
* @param rad radius around selected tile(s) to be searched
* @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. */
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;
* 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.
void CheckRedrawStationCoverage(const Window *w)
if (_thd.dirty & 1) {
_thd.dirty &= ~1;
w->SetDirty();
* Draw small boxes of cargo amount and ratings data at the given
* coordinates. If amount exceeds 576 units, it is shown 'full', same
* goes for the rating: at above 90% orso (224) it is also 'full'
*
* @param left left most coordinate to draw the box at
* @param right right most coordinate to draw the box at
* @param y coordinate to draw the box at
* @param type Cargo type
Status change: