Initial support for NewGRF road stops (bus and lorry stops)

This commit is contained in:
Jonathan G Rennison
2022-02-09 02:11:55 +00:00
parent a3c003546b
commit 1084bb8566
28 changed files with 1592 additions and 119 deletions

View File

@@ -57,6 +57,7 @@ void RebuildStationKdtree()
BaseStation::~BaseStation()
{
free(this->speclist);
free(this->roadstop_speclist);
if (CleaningPool()) return;
@@ -184,6 +185,31 @@ void BaseStation::PostDestructor(size_t index)
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
}
void BaseStation::SetRoadStopRandomBits(TileIndex tile, byte random_bits)
{
for (size_t i = 0; i < this->custom_road_stop_tiles.size(); i++) {
if (this->custom_road_stop_tiles[i] == tile) {
this->custom_road_stop_random_bits[i] = random_bits;
return;
}
}
this->custom_road_stop_tiles.push_back(tile);
this->custom_road_stop_random_bits.push_back(random_bits);
}
void BaseStation::RemoveRoadStopRandomBits(TileIndex tile)
{
for (size_t i = 0; i < this->custom_road_stop_tiles.size(); i++) {
if (this->custom_road_stop_tiles[i] == tile) {
this->custom_road_stop_tiles[i] = this->custom_road_stop_tiles.back();
this->custom_road_stop_random_bits[i] = this->custom_road_stop_random_bits.back();
this->custom_road_stop_tiles.pop_back();
this->custom_road_stop_random_bits.pop_back();
return;
}
}
}
/**
* Get the primary road stop (the first road stop) that the given vehicle can load/unload.
* @param v the vehicle to get the first road stop for