Merge branch 'master' into jgrpp-nrt

Merge trunk multiple docks implementation

# Conflicts:
#	docs/landscape_grid.html
#	src/order_cmd.cpp
#	src/pathfinder/npf/npf.cpp
#	src/pathfinder/yapf/yapf_ship.cpp
#	src/rail_cmd.cpp
#	src/saveload/afterload.cpp
#	src/saveload/oldloader_sl.cpp
#	src/saveload/station_sl.cpp
#	src/script/api/script_order.cpp
#	src/ship_cmd.cpp
#	src/station.cpp
#	src/station_base.h
#	src/station_cmd.cpp
#	src/tunnelbridge_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2019-07-13 20:34:52 +01:00
50 changed files with 783 additions and 543 deletions

View File

@@ -24,7 +24,6 @@
#include "station_base.h"
#include "station_kdtree.h"
#include "roadstop_base.h"
#include "dock_base.h"
#include "industry.h"
#include "town.h"
#include "core/random_func.hpp"
@@ -75,7 +74,7 @@ Station::Station(TileIndex tile) :
SpecializedStation<Station, false>(tile),
bus_station(INVALID_TILE, 0, 0),
truck_station(INVALID_TILE, 0, 0),
dock_station(INVALID_TILE, 0, 0),
ship_station(INVALID_TILE, 0, 0),
indtype(IT_INVALID),
time_since_load(255),
time_since_unload(255)
@@ -337,10 +336,10 @@ uint Station::GetCatchmentRadius() const
if (this->bus_stops != nullptr) ret = max<uint>(ret, CA_BUS);
if (this->truck_stops != nullptr) ret = max<uint>(ret, CA_TRUCK);
if (this->train_station.tile != INVALID_TILE) ret = max<uint>(ret, CA_TRAIN);
if (this->docks != nullptr) ret = max<uint>(ret, CA_DOCK);
if (this->ship_station.tile != INVALID_TILE) ret = max<uint>(ret, CA_DOCK);
if (this->airport.tile != INVALID_TILE) ret = max<uint>(ret, this->airport.GetSpec()->catchment);
} else {
if (this->bus_stops != nullptr || this->truck_stops != nullptr || this->train_station.tile != INVALID_TILE || this->docks != nullptr || this->airport.tile != INVALID_TILE) {
if (this->bus_stops != nullptr || this->truck_stops != nullptr || this->train_station.tile != INVALID_TILE || this->ship_station.tile != INVALID_TILE || this->airport.tile != INVALID_TILE) {
ret = CA_UNMODIFIED;
}
}
@@ -369,19 +368,11 @@ Rect Station::GetCatchmentRectUsingRadius(uint catchment_radius) const
return ret;
}
bool Station::IsDockingTile(TileIndex tile) const
{
for (const Dock *d = this->docks; d != nullptr; d = d->next) {
if (tile == d->GetDockingTile()) return true;
}
return false;
}
bool Station::IsWithinRangeOfDockingTile(TileIndex tile, uint max_distance) const
{
if (DistanceManhattan(this->xy, tile) > _settings_game.station.station_spread + max_distance) return false;
for (const Dock *d = this->docks; d != nullptr; d = d->next) {
if (DistanceManhattan(d->GetDockingTile(), tile) <= max_distance) return true;
for (TileIndex dock_tile : this->docking_tiles) {
if (DistanceManhattan(dock_tile, tile) <= max_distance) return true;
}
return false;
}