Merge tag '14.0-beta1' into jgrpp

# Conflicts:
#	src/3rdparty/squirrel/squirrel/sqcompiler.cpp
#	src/aircraft.h
#	src/animated_tile.h
#	src/base_consist.h
#	src/cargotype.h
#	src/company_gui.cpp
#	src/console_cmds.cpp
#	src/core/overflowsafe_type.hpp
#	src/engine_gui.cpp
#	src/industry_gui.cpp
#	src/lang/english.txt
#	src/music/extmidi.cpp
#	src/network/core/network_game_info.cpp
#	src/network/network_server.cpp
#	src/newgrf.cpp
#	src/newgrf_industries.cpp
#	src/order_base.h
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/order_type.h
#	src/os/macosx/misc_osx.cpp
#	src/os/windows/crashlog_win.cpp
#	src/rail_gui.cpp
#	src/rail_gui.h
#	src/roadveh.h
#	src/roadveh_cmd.cpp
#	src/saveload/afterload.cpp
#	src/saveload/company_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/saveload_error.hpp
#	src/script/api/script_town.cpp
#	src/settingsgen/settingsgen.cpp
#	src/ship.h
#	src/ship_cmd.cpp
#	src/smallmap_gui.cpp
#	src/spritecache.cpp
#	src/stdafx.h
#	src/strgen/strgen.cpp
#	src/strgen/strgen.h
#	src/table/settings/script_settings.ini
#	src/timetable_cmd.cpp
#	src/timetable_gui.cpp
#	src/town.h
#	src/town_cmd.cpp
#	src/town_cmd.h
#	src/town_gui.cpp
#	src/train.h
#	src/train_cmd.cpp
#	src/tree_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/vehicle_cmd.cpp
#	src/vehicle_gui.cpp
#	src/vehiclelist.cpp
#	src/waypoint_base.h
#	src/widget.cpp
This commit is contained in:
Jonathan G Rennison
2024-02-18 20:58:18 +00:00
140 changed files with 1265 additions and 582 deletions

View File

@@ -22,16 +22,30 @@
typedef uint32_t CargoLabel;
/** Town growth effect when delivering cargo. */
enum TownEffect {
TE_BEGIN = 0,
TE_NONE = TE_BEGIN, ///< Cargo has no effect.
TE_PASSENGERS, ///< Cargo behaves passenger-like.
TE_MAIL, ///< Cargo behaves mail-like.
TE_GOODS, ///< Cargo behaves goods/candy-like.
TE_WATER, ///< Cargo behaves water-like.
TE_FOOD, ///< Cargo behaves food/fizzy-drinks-like.
TE_END, ///< End of town effects.
NUM_TE = TE_END, ///< Amount of town effects.
enum TownAcceptanceEffect : byte {
TAE_BEGIN = 0,
TAE_NONE = TAE_BEGIN, ///< Cargo has no effect.
TAE_PASSENGERS, ///< Cargo behaves passenger-like.
TAE_MAIL, ///< Cargo behaves mail-like.
TAE_GOODS, ///< Cargo behaves goods/candy-like.
TAE_WATER, ///< Cargo behaves water-like.
TAE_FOOD, ///< Cargo behaves food/fizzy-drinks-like.
TAE_END, ///< End of town effects.
NUM_TAE = TAE_END, ///< Amount of town effects.
};
/** Town effect when producing cargo. */
enum TownProductionEffect : byte {
TPE_NONE, ///< Town will not produce this cargo type.
TPE_PASSENGERS, ///< Cargo behaves passenger-like for production.
TPE_MAIL, ///< Cargo behaves mail-like for production.
NUM_TPE,
/**
* Invalid town production effect. Used as a sentinel to indicate if a NewGRF has explicitly set an effect.
* This does not 'exist' after cargo types are finalised.
*/
INVALID_TPE,
};
/** Cargo classes. */
@@ -52,6 +66,8 @@ enum CargoClass {
static const byte INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invalid cargo
static const uint TOWN_PRODUCTION_DIVISOR = 256;
/** Specification of a cargo type. */
struct CargoSpec {
CargoLabel label; ///< Unique label of the cargo type.
@@ -65,7 +81,9 @@ struct CargoSpec {
uint8_t transit_periods[2];
bool is_freight; ///< Cargo type is considered to be freight (affects train freight multiplier).
TownEffect town_effect; ///< The effect that delivering this cargo type has on towns. Also affects destination of subsidies.
TownAcceptanceEffect town_acceptance_effect; ///< The effect that delivering this cargo type has on towns. Also affects destination of subsidies.
TownProductionEffect town_production_effect{INVALID_TPE}; ///< The effect on town cargo production.
uint16_t town_production_multiplier{TOWN_PRODUCTION_DIVISOR}; ///< Town production multipler, if commanded by TownProductionEffect.
uint8_t callback_mask; ///< Bitmask of cargo callbacks that have to be called
StringID name; ///< Name of this type of cargo.
@@ -181,6 +199,9 @@ struct CargoSpec {
*/
static IterateWrapper Iterate(size_t from = 0) { return IterateWrapper(from); }
/** List of cargo specs for each Town Product Effect. */
static std::array<std::vector<const CargoSpec *>, NUM_TPE> town_production_cargoes;
private:
static CargoSpec array[NUM_CARGO]; ///< Array holding all CargoSpecs