Changeset - r27964:a266cc235114
[Not reviewed]
master
0 4 0
Peter Nelson - 15 months ago 2023-09-21 07:29:10
peter1138@openttd.org
Codechange: Use GetAcceptanceMask() instead of duplicating it.
4 files changed with 4 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/newgrf_station.cpp
Show inline comments
 
@@ -391,12 +391,7 @@ uint32_t Station::GetNewGRFVariable(cons
 
{
 
	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;
 
		}
 

	
src/station_cmd.cpp
Show inline comments
 
@@ -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;
 

	
src/station_func.h
Show inline comments
 
@@ -30,6 +30,7 @@ CargoArray GetProductionAroundTiles(Tile
 
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);
src/station_gui.cpp
Show inline comments
 
@@ -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);
 
	}
0 comments (0 inline, 0 general)