Skip to content

Instantly share code, notes, and snippets.

@spnda
Created April 12, 2021 20:53
Show Gist options
  • Save spnda/2e59386afb6362d9eef1bb6129e2f1c5 to your computer and use it in GitHub Desktop.
Save spnda/2e59386afb6362d9eef1bb6129e2f1c5 to your computer and use it in GitHub Desktop.
void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTrigger trigger, CargoID cargo_type)
{
if (GetTileType(tile) != MP_STATION) return;
if (st == nullptr) st = Station::GetByTile(tile);
SetBit(st->waiting_triggers, trigger);
// omitted
RoadStopResolverObject object(rss, BaseStation::GetByTile(tile), tile, road_rti, 0);
uint32 reseed = object.GetReseedSum();
if (reseed != 0) {
reseed >>= 16;
/* Set individual tile random bits */
st->random_bits &= ~reseed;
st->random_bits |= Random() & reseed;
SetStationTileRandomBits(tile, st->random_bits);
MarkTileDirtyByTile(tile);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment