mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
Codechange: Use GetAcceptanceMask() instead of duplicating it.
This commit is contained in:
parent
6d675c8acf
commit
69ee38bd43
@ -391,12 +391,7 @@ uint32_t Station::GetNewGRFVariable(const ResolverObject &object, byte variable,
|
||||
{
|
||||
switch (variable) {
|
||||
case 0x48: { // Accepted cargo types
|
||||
CargoID cargo_type;
|
||||
uint32_t value = 0;
|
||||
|
||||
for (cargo_type = 0; cargo_type < NUM_CARGO; cargo_type++) {
|
||||
if (HasBit(this->goods[cargo_type].status, GoodsEntry::GES_ACCEPTANCE)) SetBit(value, cargo_type);
|
||||
}
|
||||
uint32_t value = GetAcceptanceMask(this);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,7 @@ void ClearAllStationCachedNames()
|
||||
* @param st Station to query
|
||||
* @return the expected mask
|
||||
*/
|
||||
static CargoTypes GetAcceptanceMask(const Station *st)
|
||||
CargoTypes GetAcceptanceMask(const Station *st)
|
||||
{
|
||||
CargoTypes mask = 0;
|
||||
|
||||
|
@ -30,6 +30,7 @@ CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad);
|
||||
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, CargoTypes *always_accepted = nullptr);
|
||||
|
||||
void UpdateStationAcceptance(Station *st, bool show_msg);
|
||||
CargoTypes GetAcceptanceMask(const Station *st);
|
||||
|
||||
const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx);
|
||||
void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image);
|
||||
|
@ -1835,11 +1835,7 @@ struct StationViewWindow : public Window {
|
||||
const Station *st = Station::Get(this->window_number);
|
||||
Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
|
||||
|
||||
CargoTypes cargo_mask = 0;
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
if (HasBit(st->goods[i].status, GoodsEntry::GES_ACCEPTANCE)) SetBit(cargo_mask, i);
|
||||
}
|
||||
SetDParam(0, cargo_mask);
|
||||
SetDParam(0, GetAcceptanceMask(st));
|
||||
int bottom = DrawStringMultiLine(tr.left, tr.right, tr.top, INT32_MAX, STR_STATION_VIEW_ACCEPTS_CARGO);
|
||||
return CeilDiv(bottom - r.top - WidgetDimensions::scaled.framerect.top, FONT_HEIGHT_NORMAL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user