Merge branch 'master' into jgrpp

# Conflicts:
#	.github/workflows/commit-checker.yml
#	src/industry_cmd.cpp
#	src/industry_gui.cpp
#	src/landscape.cpp
#	src/linkgraph/linkgraph_gui.cpp
#	src/order_base.h
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/saveload/afterload.cpp
#	src/saveload/league_sl.cpp
#	src/saveload/saveload.h
#	src/script/api/script_object.hpp
#	src/script/squirrel_helper.hpp
#	src/settings_table.cpp
#	src/station_cmd.cpp
#	src/table/settings.h.preamble
#	src/tree_cmd.cpp
#	src/tree_map.h
#	src/vehicle.cpp
#	src/waypoint_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2023-03-04 16:44:23 +00:00
94 changed files with 1075 additions and 1558 deletions

View File

@@ -3663,83 +3663,89 @@ static Foundation GetFoundation_Station(TileIndex tile, Slope tileh)
return FlatteningFoundation(tileh);
}
static void FillTileDescRoadStop(TileIndex tile, TileDesc *td)
{
RoadType road_rt = GetRoadTypeRoad(tile);
RoadType tram_rt = GetRoadTypeTram(tile);
Owner road_owner = INVALID_OWNER;
Owner tram_owner = INVALID_OWNER;
if (road_rt != INVALID_ROADTYPE) {
const RoadTypeInfo *rti = GetRoadTypeInfo(road_rt);
td->roadtype = rti->strings.name;
td->road_speed = rti->max_speed / 2;
road_owner = GetRoadOwner(tile, RTT_ROAD);
}
if (tram_rt != INVALID_ROADTYPE) {
const RoadTypeInfo *rti = GetRoadTypeInfo(tram_rt);
td->tramtype = rti->strings.name;
td->tram_speed = rti->max_speed / 2;
tram_owner = GetRoadOwner(tile, RTT_TRAM);
}
if (IsDriveThroughStopTile(tile)) {
/* Is there a mix of owners? */
if ((tram_owner != INVALID_OWNER && tram_owner != td->owner[0]) ||
(road_owner != INVALID_OWNER && road_owner != td->owner[0])) {
uint i = 1;
if (road_owner != INVALID_OWNER) {
td->owner_type[i] = STR_LAND_AREA_INFORMATION_ROAD_OWNER;
td->owner[i] = road_owner;
i++;
}
if (tram_owner != INVALID_OWNER) {
td->owner_type[i] = STR_LAND_AREA_INFORMATION_TRAM_OWNER;
td->owner[i] = tram_owner;
}
}
}
}
void FillTileDescRailStation(TileIndex tile, TileDesc *td)
{
const StationSpec *spec = GetStationSpec(tile);
if (spec != nullptr) {
td->station_class = StationClass::Get(spec->cls_id)->name;
td->station_name = spec->name;
if (spec->grf_prop.grffile != nullptr) {
const GRFConfig *gc = GetGRFConfig(spec->grf_prop.grffile->grfid);
td->grf = gc->GetName();
}
}
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
td->rail_speed = rti->max_speed;
td->railtype = rti->strings.name;
}
void FillTileDescAirport(TileIndex tile, TileDesc *td)
{
const AirportSpec *as = Station::GetByTile(tile)->airport.GetSpec();
td->airport_class = AirportClass::Get(as->cls_id)->name;
td->airport_name = as->name;
const AirportTileSpec *ats = AirportTileSpec::GetByTile(tile);
td->airport_tile_name = ats->name;
if (as->grf_prop.grffile != nullptr) {
const GRFConfig *gc = GetGRFConfig(as->grf_prop.grffile->grfid);
td->grf = gc->GetName();
} else if (ats->grf_prop.grffile != nullptr) {
const GRFConfig *gc = GetGRFConfig(ats->grf_prop.grffile->grfid);
td->grf = gc->GetName();
}
}
static void GetTileDesc_Station(TileIndex tile, TileDesc *td)
{
td->owner[0] = GetTileOwner(tile);
if (IsAnyRoadStopTile(tile)) {
RoadType road_rt = GetRoadTypeRoad(tile);
RoadType tram_rt = GetRoadTypeTram(tile);
Owner road_owner = INVALID_OWNER;
Owner tram_owner = INVALID_OWNER;
if (road_rt != INVALID_ROADTYPE) {
const RoadTypeInfo *rti = GetRoadTypeInfo(road_rt);
td->roadtype = rti->strings.name;
td->road_speed = rti->max_speed / 2;
road_owner = GetRoadOwner(tile, RTT_ROAD);
}
if (tram_rt != INVALID_ROADTYPE) {
const RoadTypeInfo *rti = GetRoadTypeInfo(tram_rt);
td->tramtype = rti->strings.name;
td->tram_speed = rti->max_speed / 2;
tram_owner = GetRoadOwner(tile, RTT_TRAM);
}
if (IsDriveThroughStopTile(tile)) {
/* Is there a mix of owners? */
if ((tram_owner != INVALID_OWNER && tram_owner != td->owner[0]) ||
(road_owner != INVALID_OWNER && road_owner != td->owner[0])) {
uint i = 1;
if (road_owner != INVALID_OWNER) {
td->owner_type[i] = STR_LAND_AREA_INFORMATION_ROAD_OWNER;
td->owner[i] = road_owner;
i++;
}
if (tram_owner != INVALID_OWNER) {
td->owner_type[i] = STR_LAND_AREA_INFORMATION_TRAM_OWNER;
td->owner[i] = tram_owner;
}
}
}
}
td->build_date = BaseStation::GetByTile(tile)->build_date;
if (HasStationTileRail(tile)) {
const StationSpec *spec = GetStationSpec(tile);
if (spec != nullptr) {
td->station_class = StationClass::Get(spec->cls_id)->name;
td->station_name = spec->name;
if (spec->grf_prop.grffile != nullptr) {
const GRFConfig *gc = GetGRFConfig(spec->grf_prop.grffile->grfid);
td->grf = gc->GetName();
}
}
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
td->rail_speed = rti->max_speed;
td->railtype = rti->strings.name;
}
if (IsAirport(tile)) {
const AirportSpec *as = Station::GetByTile(tile)->airport.GetSpec();
td->airport_class = AirportClass::Get(as->cls_id)->name;
td->airport_name = as->name;
const AirportTileSpec *ats = AirportTileSpec::GetByTile(tile);
td->airport_tile_name = ats->name;
if (as->grf_prop.grffile != nullptr) {
const GRFConfig *gc = GetGRFConfig(as->grf_prop.grffile->grfid);
td->grf = gc->GetName();
} else if (ats->grf_prop.grffile != nullptr) {
const GRFConfig *gc = GetGRFConfig(ats->grf_prop.grffile->grfid);
td->grf = gc->GetName();
}
}
if (IsAnyRoadStopTile(tile)) FillTileDescRoadStop(tile, td);
if (HasStationRail(tile)) FillTileDescRailStation(tile, td);
if (IsAirport(tile)) FillTileDescAirport(tile, td);
StringID str;
switch (GetStationType(tile)) {