Merge tag '14.0-beta2' into jgrpp

# Conflicts:
#	CMakeLists.txt
#	src/cargotype.cpp
#	src/console_cmds.cpp
#	src/graph_gui.cpp
#	src/industry_cmd.cpp
#	src/industrytype.h
#	src/misc_gui.cpp
#	src/network/network_client.cpp
#	src/newgrf.cpp
#	src/newgrf_town.cpp
#	src/object_cmd.cpp
#	src/openttd.cpp
#	src/pathfinder/water_regions.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/table/build_industry.h
#	src/table/engines.h
#	src/vehicle.cpp
#	src/vehicle_cmd.cpp
#	src/vehicle_gui.cpp
This commit is contained in:
Jonathan G Rennison
2024-02-19 03:17:17 +00:00
53 changed files with 618 additions and 416 deletions

View File

@@ -819,23 +819,31 @@ static void AddAcceptedCargo_Object(TileIndex tile, CargoArray &acceptance, Carg
/* Top town building generates 10, so to make HQ interesting, the top
* type makes 20. */
acceptance[CT_PASSENGERS] += std::max(1U, level);
SetBit(*always_accepted, CT_PASSENGERS);
CargoID pass = GetCargoIDByLabel(CT_PASSENGERS);
if (IsValidCargoID(pass)) {
acceptance[pass] += std::max(1U, level);
SetBit(*always_accepted, pass);
}
/* Top town building generates 4, HQ can make up to 8. The
* proportion passengers:mail is different because such a huge
* commercial building generates unusually high amount of mail
* correspondence per physical visitor. */
acceptance[CT_MAIL] += std::max(1U, level / 2);
SetBit(*always_accepted, CT_MAIL);
CargoID mail = GetCargoIDByLabel(CT_MAIL);
if (IsValidCargoID(mail)) {
acceptance[mail] += std::max(1U, level / 2);
SetBit(*always_accepted, mail);
}
}
static void AddProducedCargo_Object(TileIndex tile, CargoArray &produced)
{
if (!IsObjectType(tile, OBJECT_HQ)) return;
produced[CT_PASSENGERS]++;
produced[CT_MAIL]++;
CargoID pass = GetCargoIDByLabel(CT_PASSENGERS);
if (IsValidCargoID(pass)) produced[pass]++;
CargoID mail = GetCargoIDByLabel(CT_MAIL);
if (IsValidCargoID(mail)) produced[mail]++;
}
@@ -979,19 +987,31 @@ static void TileLoop_Object(TileIndex tile)
uint r = Random();
/* Top town buildings generate 250, so the top HQ type makes 256. */
if (GB(r, 0, 8) < (256 / 4 / (6 - level))) {
CargoID pass = GetCargoIDByLabel(CT_PASSENGERS);
if (IsValidCargoID(pass) && GB(r, 0, 8) < (256 / 4 / (6 - level))) {
uint amt = GB(r, 0, 8) / 8 / 4 + 1;
if (EconomyIsInRecession()) amt = (amt + 1) >> 1;
MoveGoodsToStation(CT_PASSENGERS, amt, SourceType::Headquarters, GetTileOwner(tile), stations.GetStations());
/* Scale by cargo scale setting. */
amt = _town_cargo_scaler.ScaleAllowTrunc(amt);
if (amt != 0) {
MoveGoodsToStation(pass, amt, SourceType::Headquarters, GetTileOwner(tile), stations.GetStations());
}
}
/* Top town building generates 90, HQ can make up to 196. The
* proportion passengers:mail is about the same as in the acceptance
* equations. */
if (GB(r, 8, 8) < (196 / 4 / (6 - level))) {
CargoID mail = GetCargoIDByLabel(CT_MAIL);
if (IsValidCargoID(mail) && GB(r, 8, 8) < (196 / 4 / (6 - level))) {
uint amt = GB(r, 8, 8) / 8 / 4 + 1;
if (EconomyIsInRecession()) amt = (amt + 1) >> 1;
MoveGoodsToStation(CT_MAIL, amt, SourceType::Headquarters, GetTileOwner(tile), stations.GetStations());
/* Scale by cargo scale setting. */
amt = _town_cargo_scaler.ScaleAllowTrunc(amt);
if (amt != 0) {
MoveGoodsToStation(mail, amt, SourceType::Headquarters, GetTileOwner(tile), stations.GetStations());
}
}
}