mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
3 Commits
6d675c8acf
...
bec36c1f98
Author | SHA1 | Date |
---|---|---|
|
bec36c1f98 | |
|
398c7e5f9d | |
|
69ee38bd43 |
|
@ -42,7 +42,6 @@ jobs:
|
|||
liblzma-dev \
|
||||
liblzo2-dev \
|
||||
libsdl2-dev \
|
||||
nlohmann-json3-dev \
|
||||
zlib1g-dev \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
|
|
@ -385,15 +385,8 @@ void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTri
|
|||
|
||||
uint32_t whole_reseed = 0;
|
||||
|
||||
CargoTypes empty_mask = 0;
|
||||
if (trigger == RSRT_CARGO_TAKEN) {
|
||||
/* Create a bitmask of completely empty cargo types to be matched */
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
if (st->goods[i].cargo.TotalCount() == 0) {
|
||||
SetBit(empty_mask, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Bitmask of completely empty cargo types to be matched. */
|
||||
CargoTypes empty_mask = (trigger == RSRT_CARGO_TAKEN) ? GetEmptyMask(st) : 0;
|
||||
|
||||
uint32_t used_triggers = 0;
|
||||
auto process_tile = [&](TileIndex cur_tile) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -967,15 +962,8 @@ void TriggerStationRandomisation(Station *st, TileIndex trigger_tile, StationRan
|
|||
uint32_t whole_reseed = 0;
|
||||
ETileArea area = ETileArea(st, trigger_tile, tas[trigger]);
|
||||
|
||||
CargoTypes empty_mask = 0;
|
||||
if (trigger == SRT_CARGO_TAKEN) {
|
||||
/* Create a bitmask of completely empty cargo types to be matched */
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
if (st->goods[i].cargo.TotalCount() == 0) {
|
||||
SetBit(empty_mask, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Bitmask of completely empty cargo types to be matched. */
|
||||
CargoTypes empty_mask = (trigger == SRT_CARGO_TAKEN) ? GetEmptyMask(st) : 0;
|
||||
|
||||
/* Store triggers now for var 5F */
|
||||
SetBit(st->waiting_triggers, trigger);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -502,6 +502,21 @@ static CargoTypes GetAcceptanceMask(const Station *st)
|
|||
return mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a mask of the cargo types that are empty at the station.
|
||||
* @param st Station to query
|
||||
* @return the empty mask
|
||||
*/
|
||||
CargoTypes GetEmptyMask(const Station *st)
|
||||
{
|
||||
CargoTypes mask = 0;
|
||||
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
if (st->goods[i].cargo.TotalCount() == 0) SetBit(mask, i);
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items contains the two cargo names that are to be accepted or rejected.
|
||||
* msg is the string id of the message to display.
|
||||
|
|
|
@ -30,6 +30,8 @@ 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);
|
||||
CargoTypes GetEmptyMask(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