(svn r23526) -Codechange: unify cargos vs cargoes

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
rubidium 13 years ago
parent df0afdf0dc
commit 3d88c74389

@ -103,23 +103,23 @@ static inline uint16 GetVehicleDefaultCapacity(EngineID engine, CargoID *cargo_t
}
/**
* Returns all cargos a vehicle can carry.
* Returns all cargoes a vehicle can carry.
* @param engine the EngineID of iterest
* @param include_initial_cargo_type if true the default cargo type of the vehicle is included; if false only the refit_mask
* @return bit set of CargoIDs
*/
static inline uint32 GetAvailableVehicleCargoTypes(EngineID engine, bool include_initial_cargo_type)
{
uint32 cargos = 0;
uint32 cargoes = 0;
CargoID initial_cargo_type;
if (GetVehicleDefaultCapacity(engine, &initial_cargo_type) > 0) {
const EngineInfo *ei = EngInfo(engine);
cargos = ei->refit_mask;
if (include_initial_cargo_type && initial_cargo_type < NUM_CARGO) SetBit(cargos, initial_cargo_type);
cargoes = ei->refit_mask;
if (include_initial_cargo_type && initial_cargo_type < NUM_CARGO) SetBit(cargoes, initial_cargo_type);
}
return cargos;
return cargoes;
}
/**
@ -185,9 +185,9 @@ bool IsArticulatedVehicleRefittable(EngineID engine)
void GetArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type, uint32 *union_mask, uint32 *intersection_mask)
{
const Engine *e = Engine::Get(engine);
uint32 veh_cargos = GetAvailableVehicleCargoTypes(engine, include_initial_cargo_type);
*union_mask = veh_cargos;
*intersection_mask = (veh_cargos != 0) ? veh_cargos : UINT32_MAX;
uint32 veh_cargoes = GetAvailableVehicleCargoTypes(engine, include_initial_cargo_type);
*union_mask = veh_cargoes;
*intersection_mask = (veh_cargoes != 0) ? veh_cargoes : UINT32_MAX;
if (!e->IsGroundVehicle()) return;
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return;
@ -196,9 +196,9 @@ void GetArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type,
EngineID artic_engine = GetNextArticulatedPart(i, engine);
if (artic_engine == INVALID_ENGINE) break;
veh_cargos = GetAvailableVehicleCargoTypes(artic_engine, include_initial_cargo_type);
*union_mask |= veh_cargos;
if (veh_cargos != 0) *intersection_mask &= veh_cargos;
veh_cargoes = GetAvailableVehicleCargoTypes(artic_engine, include_initial_cargo_type);
*union_mask |= veh_cargoes;
if (veh_cargoes != 0) *intersection_mask &= veh_cargoes;
}
}
@ -234,9 +234,9 @@ uint32 GetIntersectionOfArticulatedRefitMasks(EngineID engine, bool include_init
* Note: Vehicles not carrying anything are ignored
* @param v the first vehicle in the chain
* @param cargo_type returns the common CargoID if needed. (CT_INVALID if no part is carrying something or they are carrying different things)
* @return true if some parts are carrying different cargos, false if all parts are carrying the same (nothing is also the same)
* @return true if some parts are carrying different cargoes, false if all parts are carrying the same (nothing is also the same)
*/
bool IsArticulatedVehicleCarryingDifferentCargos(const Vehicle *v, CargoID *cargo_type)
bool IsArticulatedVehicleCarryingDifferentCargoes(const Vehicle *v, CargoID *cargo_type)
{
CargoID first_cargo = CT_INVALID;
@ -287,7 +287,7 @@ void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : NULL;
} while (v != NULL);
/* Check whether the vehicle carries more cargos than expected */
/* Check whether the vehicle carries more cargoes than expected */
bool carries_more = false;
for (CargoID cid = 0; cid < NUM_CARGO; cid++) {
if (real_default_capacity[cid] != 0 && purchase_default_capacity[cid] == 0) {

@ -21,7 +21,7 @@ void AddArticulatedParts(Vehicle *first);
void GetArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type, uint32 *union_mask, uint32 *intersection_mask);
uint32 GetUnionOfArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type);
uint32 GetIntersectionOfArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type);
bool IsArticulatedVehicleCarryingDifferentCargos(const Vehicle *v, CargoID *cargo_type);
bool IsArticulatedVehicleCarryingDifferentCargoes(const Vehicle *v, CargoID *cargo_type);
bool IsArticulatedVehicleRefittable(EngineID engine);
void CheckConsistencyOfArticulatedVehicle(const Vehicle *v);

@ -36,9 +36,9 @@ extern void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index);
*/
static bool EnginesHaveCargoInCommon(EngineID engine_a, EngineID engine_b)
{
uint32 available_cargos_a = GetUnionOfArticulatedRefitMasks(engine_a, true);
uint32 available_cargos_b = GetUnionOfArticulatedRefitMasks(engine_b, true);
return (available_cargos_a == 0 || available_cargos_b == 0 || (available_cargos_a & available_cargos_b) != 0);
uint32 available_cargoes_a = GetUnionOfArticulatedRefitMasks(engine_a, true);
uint32 available_cargoes_b = GetUnionOfArticulatedRefitMasks(engine_b, true);
return (available_cargoes_a == 0 || available_cargoes_b == 0 || (available_cargoes_a & available_cargoes_b) != 0);
}
/**
@ -169,7 +169,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool
if (union_mask == 0) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
CargoID cargo_type;
if (IsArticulatedVehicleCarryingDifferentCargos(v, &cargo_type)) return CT_INVALID; // We cannot refit to mixed cargos in an automated way
if (IsArticulatedVehicleCarryingDifferentCargoes(v, &cargo_type)) return CT_INVALID; // We cannot refit to mixed cargoes in an automated way
if (cargo_type == CT_INVALID) {
if (v->type != VEH_TRAIN) return CT_NO_REFIT; // If the vehicle does not carry anything at all, every replacement is fine.
@ -251,7 +251,7 @@ static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehic
/* Does it need to be refitted */
CargoID refit_cargo = GetNewCargoTypeForReplace(old_veh, e, part_of_chain);
if (refit_cargo == CT_INVALID) return CommandCost(); // incompatible cargos
if (refit_cargo == CT_INVALID) return CommandCost(); // incompatible cargoes
/* Build the new vehicle */
cost = DoCommand(old_veh->tile, e, 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));

@ -1020,7 +1020,7 @@ struct BuildVehicleWindow : Window {
/* Terminate the filter list. */
this->cargo_filter_texts[filter_items] = INVALID_STRING_ID;
/* If not found, the cargo criteria will be set to all cargos. */
/* If not found, the cargo criteria will be set to all cargoes. */
this->cargo_filter_criteria = 0;
/* Find the last cargo filter criteria. */

@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file cargo_type.h Types related to cargos... */
/** @file cargo_type.h Types related to cargoes... */
#ifndef CARGO_TYPE_H
#define CARGO_TYPE_H

@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file cargotype.cpp Implementation of cargos. */
/** @file cargotype.cpp Implementation of cargoes. */
#include "stdafx.h"
#include "cargotype.h"
@ -122,7 +122,7 @@ SpriteID CargoSpec::GetCargoIcon() const
}
const CargoSpec *_sorted_cargo_specs[NUM_CARGO]; ///< Cargo specifications sorted alphabetically by name.
uint8 _sorted_cargo_specs_size; ///< Number of cargo specifications stored at the _sorted_cargo_specs array (including special cargos).
uint8 _sorted_cargo_specs_size; ///< Number of cargo specifications stored at the _sorted_cargo_specs array (including special cargoes).
uint8 _sorted_standard_cargo_specs_size; ///< Number of standard cargo specifications stored at the _sorted_cargo_specs array.

@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file cargotype.h Types/functions related to cargos. */
/** @file cargotype.h Types/functions related to cargoes. */
#ifndef CARGOTYPE_H
#define CARGOTYPE_H

@ -797,7 +797,7 @@ struct DepotWindow : Window {
/* Display info for single (articulated) vehicle, or for whole chain starting with selected vehicle */
bool whole_chain = (this->type == VEH_TRAIN && _ctrl_pressed);
/* loop through vehicle chain and collect cargos */
/* loop through vehicle chain and collect cargoes */
uint num = 0;
for (const Vehicle *w = v; w != NULL; w = w->Next()) {
if (w->cargo_cap > 0 && w->cargo_type < NUM_CARGO) {

@ -168,7 +168,7 @@ uint32 Engine::GetGRFID() const
/**
* Determines whether an engine can carry something.
* A vehicle cannot carry anything if its capacity is zero, or none of the possible cargos is available in the climate.
* A vehicle cannot carry anything if its capacity is zero, or none of the possible cargoes is available in the climate.
* @return true if the vehicle can carry something.
*/
bool Engine::CanCarryCargo() const

@ -890,8 +890,8 @@ enum CargoPaymentRatesWidgets {
CPW_GRAPH,
CPW_RESIZE,
CPW_FOOTER,
CPW_ENABLE_CARGOS,
CPW_DISABLE_CARGOS,
CPW_ENABLE_CARGOES,
CPW_DISABLE_CARGOES,
CPW_CARGO_FIRST,
};
@ -991,16 +991,16 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
case CPW_ENABLE_CARGOS:
/* Remove all cargos from the excluded lists. */
case CPW_ENABLE_CARGOES:
/* Remove all cargoes from the excluded lists. */
_legend_excluded_cargo = 0;
this->excluded_data = 0;
this->UpdateLoweredWidgets();
this->SetDirty();
break;
case CPW_DISABLE_CARGOS: {
/* Add all cargos to the excluded lists. */
case CPW_DISABLE_CARGOES: {
/* Add all cargoes to the excluded lists. */
int i = 0;
const CargoSpec *cs;
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
@ -1092,8 +1092,8 @@ static const NWidgetPart _nested_cargo_payment_rates_widgets[] = {
NWidget(WWT_EMPTY, COLOUR_GREY, CPW_GRAPH), SetMinimalSize(495, 0), SetFill(1, 1), SetResize(1, 1),
NWidget(NWID_VERTICAL),
NWidget(NWID_SPACER), SetMinimalSize(0, 24), SetFill(0, 0), SetResize(0, 1),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, CPW_ENABLE_CARGOS), SetDataTip(STR_GRAPH_CARGO_ENABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_ENABLE_ALL), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, CPW_DISABLE_CARGOS), SetDataTip(STR_GRAPH_CARGO_DISABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, CPW_ENABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_ENABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_ENABLE_ALL), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, CPW_DISABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_DISABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL), SetFill(1, 0),
NWidget(NWID_SPACER), SetMinimalSize(0, 4),
NWidgetFunction(MakeCargoButtons),
NWidget(NWID_SPACER), SetMinimalSize(0, 24), SetFill(0, 1), SetResize(0, 1),

@ -419,7 +419,7 @@ static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, ui
const Industry *ind = Industry::GetByTile(tile);
for (byte i = 0; i < lengthof(itspec->accepts_cargo); i++) {
CargoID a = accepts_cargo[i];
if (a == CT_INVALID || cargo_acceptance[i] == 0) continue; // work only with valid cargos
if (a == CT_INVALID || cargo_acceptance[i] == 0) continue; // work only with valid cargoes
/* Add accepted cargo */
acceptance[a] += cargo_acceptance[i];

@ -86,21 +86,21 @@ static void GetCargoSuffix(uint cargo, CargoSuffixType cst, const Industry *ind,
}
/**
* Gets all strings to display after the cargos of industries (using callback 37)
* @param cb_offset The offset for the cargo used in cb37, 0 for accepted cargos, 3 for produced cargos
* Gets all strings to display after the cargoes of industries (using callback 37)
* @param cb_offset The offset for the cargo used in cb37, 0 for accepted cargoes, 3 for produced cargoes
* @param cst the cargo suffix type (for which window is it requested). @see CargoSuffixType
* @param ind the industry (NULL if in fund window)
* @param ind_type the industry type
* @param indspec the industry spec
* @param cargos array with cargotypes. for CT_INVALID no suffix will be determined
* @param cargoes array with cargotypes. for CT_INVALID no suffix will be determined
* @param suffixes is filled with the suffixes
*/
template <typename TC, typename TS>
static inline void GetAllCargoSuffixes(uint cb_offset, CargoSuffixType cst, const Industry *ind, IndustryType ind_type, const IndustrySpec *indspec, const TC &cargos, TS &suffixes)
static inline void GetAllCargoSuffixes(uint cb_offset, CargoSuffixType cst, const Industry *ind, IndustryType ind_type, const IndustrySpec *indspec, const TC &cargoes, TS &suffixes)
{
assert_compile(lengthof(cargos) <= lengthof(suffixes));
for (uint j = 0; j < lengthof(cargos); j++) {
if (cargos[j] != CT_INVALID) {
assert_compile(lengthof(cargoes) <= lengthof(suffixes));
for (uint j = 0; j < lengthof(cargoes); j++) {
if (cargoes[j] != CT_INVALID) {
GetCargoSuffix(cb_offset + j, cst, ind, ind_type, indspec, suffixes[j], lastof(suffixes[j]));
} else {
suffixes[j][0] = '\0';

@ -112,11 +112,11 @@ struct IndustrySpec {
byte production_rate[2];
byte minimal_cargo; ///< minimum amount of cargo transported to the stations
///< If the waiting cargo is less than this number, no cargo is moved to it
CargoID accepts_cargo[3]; ///< 3 accepted cargos
uint16 input_cargo_multiplier[3][2]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargos)
CargoID accepts_cargo[3]; ///< 3 accepted cargoes
uint16 input_cargo_multiplier[3][2]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes)
IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs
byte climate_availability; ///< Bitmask, giving landscape enums as bit position
IndustryBehaviour behaviour; ///< How this industry will behave, and how others entities can use it
IndustryBehaviour behaviour; ///< How this industry will behave, and how others entities can use it
byte map_colour; ///< colour used for the small map
StringID name; ///< Displayed name of the industry
StringID new_industry_text; ///< Message appearing when the industry is built

@ -311,7 +311,7 @@ static GRFTempEngineData *_gted; ///< Temporary engine data used during NewGRF
static uint32 _grm_engines[256];
/** Contains the GRF ID of the owner of a cargo if it has been reserved */
static uint32 _grm_cargos[NUM_CARGO * 2];
static uint32 _grm_cargoes[NUM_CARGO * 2];
struct GRFLocation {
uint32 grfid;
@ -1270,7 +1270,7 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint engine, int numinfo, int prop
_gted[e->index].rv_max_speed = buf->ReadByte();
break;
case 0x16: // Cargos available for refitting
case 0x16: // Cargoes available for refitting
ei->refit_mask = buf->ReadDWord();
_gted[e->index].refitmask_valid = true;
_gted[e->index].refitmask_grf = _cur.grffile;
@ -1433,7 +1433,7 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint engine, int numinfo, int prop
svi->sfx = buf->ReadByte();
break;
case 0x11: // Cargos available for refitting
case 0x11: // Cargoes available for refitting
ei->refit_mask = buf->ReadDWord();
_gted[e->index].refitmask_valid = true;
_gted[e->index].refitmask_grf = _cur.grffile;
@ -1589,7 +1589,7 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint engine, int numinfo, int
avi->sfx = buf->ReadByte();
break;
case 0x13: // Cargos available for refitting
case 0x13: // Cargoes available for refitting
ei->refit_mask = buf->ReadDWord();
_gted[e->index].refitmask_valid = true;
_gted[e->index].refitmask_grf = _cur.grffile;
@ -2666,7 +2666,7 @@ static ChangeInfoResult GlobalVarReserveInfo(uint gvid, int numinfo, int prop, B
/**
* Define properties for cargos
* Define properties for cargoes
* @param cid Local ID of the cargo.
* @param numinfo Number of subsequent IDs to change the property for.
* @param prop The property to change.
@ -4172,7 +4172,7 @@ static void FeatureChangeInfo(ByteReader *buf)
/* GSF_GLOBALVAR */ GlobalVarChangeInfo,
/* GSF_INDUSTRYTILES */ IndustrytilesChangeInfo,
/* GSF_INDUSTRIES */ IndustriesChangeInfo,
/* GSF_CARGOS */ NULL, // Cargo is handled during reservation
/* GSF_CARGOES */ NULL, // Cargo is handled during reservation
/* GSF_SOUNDFX */ SoundEffectChangeInfo,
/* GSF_AIRPORTS */ AirportChangeInfo,
/* GSF_SIGNALS */ NULL,
@ -4190,7 +4190,7 @@ static void FeatureChangeInfo(ByteReader *buf)
feature, numprops, engine, numinfo);
if (feature >= lengthof(handler) || handler[feature] == NULL) {
if (feature != GSF_CARGOS) grfmsg(1, "FeatureChangeInfo: Unsupported feature %d, skipping", feature);
if (feature != GSF_CARGOES) grfmsg(1, "FeatureChangeInfo: Unsupported feature %d, skipping", feature);
return;
}
@ -4247,7 +4247,7 @@ static void ReserveChangeInfo(ByteReader *buf)
{
uint8 feature = buf->ReadByte();
if (feature != GSF_CARGOS && feature != GSF_GLOBALVAR && feature != GSF_RAILTYPES) return;
if (feature != GSF_CARGOES && feature != GSF_GLOBALVAR && feature != GSF_RAILTYPES) return;
uint8 numprops = buf->ReadByte();
uint8 numinfo = buf->ReadByte();
@ -4259,7 +4259,7 @@ static void ReserveChangeInfo(ByteReader *buf)
switch (feature) {
default: NOT_REACHED();
case GSF_CARGOS:
case GSF_CARGOES:
cir = CargoChangeInfo(index, numinfo, prop, buf);
break;
@ -4511,7 +4511,7 @@ static void NewSpriteGroup(ByteReader *buf)
case GSF_AIRCRAFT:
case GSF_STATIONS:
case GSF_CANALS:
case GSF_CARGOS:
case GSF_CARGOES:
case GSF_AIRPORTS:
case GSF_RAILTYPES:
{
@ -4929,9 +4929,9 @@ static void IndustrytileMapSpriteGroup(ByteReader *buf, uint8 idcount)
static void CargoMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
CargoID *cargos = AllocaM(CargoID, idcount);
CargoID *cargoes = AllocaM(CargoID, idcount);
for (uint i = 0; i < idcount; i++) {
cargos[i] = buf->ReadByte();
cargoes[i] = buf->ReadByte();
}
/* Skip the cargo type section, we only care about the default group */
@ -4942,7 +4942,7 @@ static void CargoMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (!IsValidGroupID(groupid, "CargoMapSpriteGroup")) return;
for (uint i = 0; i < idcount; i++) {
CargoID cid = cargos[i];
CargoID cid = cargoes[i];
if (cid >= NUM_CARGO) {
grfmsg(1, "CargoMapSpriteGroup: Cargo ID %d out of range, skipping", cid);
@ -5169,7 +5169,7 @@ static void FeatureMapSpriteGroup(ByteReader *buf)
IndustrytileMapSpriteGroup(buf, idcount);
return;
case GSF_CARGOS:
case GSF_CARGOES:
CargoMapSpriteGroup(buf, idcount);
return;
@ -6448,7 +6448,7 @@ static void ParamSet(ByteReader *buf)
case 0x0B: // Cargo
/* There are two ranges: one for cargo IDs and one for cargo bitmasks */
src1 = PerformGRM(_grm_cargos, NUM_CARGO * 2, count, op, target, "cargos");
src1 = PerformGRM(_grm_cargoes, NUM_CARGO * 2, count, op, target, "cargoes");
if (_cur.skip_sprites == -1) return;
break;
@ -7875,7 +7875,7 @@ void ResetNewGRFData()
/* Reset GRM reservations */
memset(&_grm_engines, 0, sizeof(_grm_engines));
memset(&_grm_cargos, 0, sizeof(_grm_cargos));
memset(&_grm_cargoes, 0, sizeof(_grm_cargoes));
/* Reset generic feature callback lists */
ResetGenericCallbacks();
@ -8150,7 +8150,7 @@ static void CalculateRefitMasks()
only_defaultcargo = (ei->refit_mask == 0);
}
/* Ensure that the vehicle is either not refittable, or that the default cargo is one of the refittable cargos.
/* Ensure that the vehicle is either not refittable, or that the default cargo is one of the refittable cargoes.
* Note: Vehicles refittable to no cargo are handle differently to vehicle refittable to a single cargo. The latter might have subtypes. */
if (!only_defaultcargo && (e->type != VEH_SHIP || e->u.ship.old_refittable) && ei->cargo_type != CT_INVALID && !HasBit(ei->refit_mask, ei->cargo_type)) {
ei->cargo_type = CT_INVALID;
@ -8244,7 +8244,7 @@ static void FinaliseEngineArray()
}
}
/** Check for invalid cargos */
/** Check for invalid cargoes */
static void FinaliseCargoArray()
{
for (CargoID c = 0; c < NUM_CARGO; c++) {
@ -8880,7 +8880,7 @@ static void AfterLoadGRFs()
}
_grf_line_to_action6_sprite_override.clear();
/* Polish cargos */
/* Polish cargoes */
FinaliseCargoArray();
/* Pre-calculate all refit masks after loading GRF files. */

@ -72,7 +72,7 @@ enum GrfSpecFeature {
GSF_GLOBALVAR,
GSF_INDUSTRYTILES,
GSF_INDUSTRIES,
GSF_CARGOS,
GSF_CARGOES,
GSF_SOUNDFX,
GSF_AIRPORTS,
GSF_SIGNALS,

@ -330,7 +330,7 @@ enum CanalCallbackMask {
};
/**
* Callback masks for cargos.
* Callback masks for cargoes.
*/
enum CargoCallbackMask {
CBM_CARGO_PROFIT_CALC = 0, ///< custom profit calculation
@ -353,8 +353,8 @@ enum IndustryCallbackMask {
CBM_IND_SPECIAL_EFFECT = 9, ///< control special effects
CBM_IND_REFUSE_CARGO = 10, ///< option out of accepting cargo
CBM_IND_DECIDE_COLOUR = 11, ///< give a custom colour to newly build industries
CBM_IND_INPUT_CARGO_TYPES = 12, ///< customize the cargos the industry requires
CBM_IND_OUTPUT_CARGO_TYPES = 13, ///< customize the cargos the industry produces
CBM_IND_INPUT_CARGO_TYPES = 12, ///< customize the cargoes the industry requires
CBM_IND_OUTPUT_CARGO_TYPES = 13, ///< customize the cargoes the industry produces
};
/**

@ -42,7 +42,7 @@ enum GRFStatus {
/** Encountered GRF bugs */
enum GRFBugs {
GBUG_VEH_LENGTH, ///< Length of rail vehicle changes when not inside a depot
GBUG_VEH_REFIT, ///< Articulated vehicles carry different cargos resp. are differently refittable than specified in purchase list
GBUG_VEH_REFIT, ///< Articulated vehicles carry different cargoes resp. are differently refittable than specified in purchase list
GBUG_VEH_POWERED_WAGON, ///< Powered wagon changed poweredness state when not inside a depot
GBUG_UNKNOWN_CB_RESULT, ///< A callback returned an unknown/invalid result
};

@ -37,7 +37,7 @@ void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const SpriteGroup *
Engine *e = Engine::Get(engine);
WagonOverride *wo;
assert(cargo < NUM_CARGO + 2); // Include CT_DEFAULT and CT_PURCHASE pseudo cargos.
assert(cargo < NUM_CARGO + 2); // Include CT_DEFAULT and CT_PURCHASE pseudo cargoes.
e->overrides_count++;
e->overrides = ReallocT(e->overrides, e->overrides_count);
@ -485,14 +485,14 @@ static uint32 VehicleGetVariable(Vehicle *v, const ResolverObject *object, byte
if (!HasBit(v->grf_cache.cache_valid, NCVV_CONSIST_CARGO_INFORMATION)) {
const Vehicle *u;
byte cargo_classes = 0;
uint8 common_cargos[NUM_CARGO];
uint8 common_cargoes[NUM_CARGO];
uint8 common_subtypes[256];
byte user_def_data = 0;
CargoID common_cargo_type = CT_INVALID;
uint8 common_subtype = 0xFF; // Return 0xFF if nothing is carried
/* Reset our arrays */
memset(common_cargos, 0, sizeof(common_cargos));
memset(common_cargoes, 0, sizeof(common_cargoes));
memset(common_subtypes, 0, sizeof(common_subtypes));
for (u = v; u != NULL; u = u->Next()) {
@ -502,14 +502,14 @@ static uint32 VehicleGetVariable(Vehicle *v, const ResolverObject *object, byte
if (u->cargo_cap == 0) continue;
cargo_classes |= CargoSpec::Get(u->cargo_type)->classes;
common_cargos[u->cargo_type]++;
common_cargoes[u->cargo_type]++;
}
/* Pick the most common cargo type */
uint common_cargo_best_amount = 0;
for (CargoID cargo = 0; cargo < NUM_CARGO; cargo++) {
if (common_cargos[cargo] > common_cargo_best_amount) {
common_cargo_best_amount = common_cargos[cargo];
if (common_cargoes[cargo] > common_cargo_best_amount) {
common_cargo_best_amount = common_cargoes[cargo];
common_cargo_type = cargo;
}
}

@ -2707,7 +2707,7 @@ bool AfterLoadGame()
Town *town;
FOR_ALL_TOWNS(town) {
UpdateTownCargos(town);
UpdateTownCargoes(town);
}
}

@ -289,7 +289,7 @@ static void Load_STNS()
StationID source = (IsSavegameVersionBefore(7) && _cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
/* Make sure we can allocate the CargoPacket. This is safe
* as there can only be ~64k stations and 32 cargos in these
* as there can only be ~64k stations and 32 cargoes in these
* savegame versions. As the CargoPacketPool has more than
* 16 million entries; it fits by an order of magnitude. */
assert(CargoPacket::CanAllocateItem());

@ -97,7 +97,7 @@ void UpdateHousesAndTowns()
/* Update the population and num_house dependant values */
FOR_ALL_TOWNS(town) {
UpdateTownRadius(town);
UpdateTownCargos(town);
UpdateTownCargoes(town);
}
UpdateTownCargoBitmap();
}

@ -214,7 +214,7 @@
* including houses instead the number of producing tiles. This means that
* also industries that do not have a tile within the radius, but where
* the search bounding box and the industry's bounding box intersect, are
* counted. Previously these industries (and their cargos), although they
* counted. Previously these industries (and their cargoes), although they
* produced cargo for a station at the given location, were not returned.
* \li AIRail::BuildRail will now fail completely if there is an obstacle
* between the begin and end, instead of building up to the obstacle and

@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file script_cargo.hpp Everything to query cargos. */
/** @file script_cargo.hpp Everything to query cargoes. */
#ifndef SCRIPT_CARGO_HPP
#define SCRIPT_CARGO_HPP
@ -27,7 +27,7 @@ public:
*/
enum CargoClass {
/* Note: these values represent part of the in-game CargoClass enum */
CC_PASSENGERS = ::CC_PASSENGERS, ///< Passengers. Cargos of this class appear at bus stops. Cargos not of this class appear at truck stops.
CC_PASSENGERS = ::CC_PASSENGERS, ///< Passengers. Cargoes of this class appear at bus stops. Cargoes not of this class appear at truck stops.
CC_MAIL = ::CC_MAIL, ///< Mail
CC_EXPRESS = ::CC_EXPRESS, ///< Express cargo (Goods, Food, Candy, but also possible for passengers)
CC_ARMOURED = ::CC_ARMOURED, ///< Armoured cargo (Valuables, Gold, Diamonds)

@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file script_cargolist.hpp List all the cargos. */
/** @file script_cargolist.hpp List all the cargoes. */
#ifndef SCRIPT_CARGOLIST_HPP
#define SCRIPT_CARGOLIST_HPP
@ -15,7 +15,7 @@
#include "script_list.hpp"
/**
* Creates a list of cargos that can be produced in the current game.
* Creates a list of cargoes that can be produced in the current game.
* @api ai
* @ingroup ScriptList
*/
@ -25,8 +25,8 @@ public:
};
/**
* Creates a list of cargos that the given industry accepts.
* @note This list also includes cargos that are temporarily not accepted
* Creates a list of cargoes that the given industry accepts.
* @note This list also includes cargoes that are temporarily not accepted
* by this industry, @see ScriptIndustry::IsCargoAccepted.
* @api ai
* @ingroup ScriptList
@ -34,33 +34,33 @@ public:
class ScriptCargoList_IndustryAccepting : public ScriptList {
public:
/**
* @param industry_id The industry to get the list of cargos it accepts from.
* @param industry_id The industry to get the list of cargoes it accepts from.
*/
ScriptCargoList_IndustryAccepting(IndustryID industry_id);
};
/**
* Creates a list of cargos that the given industry can produce.
* Creates a list of cargoes that the given industry can produce.
* @api ai
* @ingroup ScriptList
*/
class ScriptCargoList_IndustryProducing : public ScriptList {
public:
/**
* @param industry_id The industry to get the list of cargos it produces from.
* @param industry_id The industry to get the list of cargoes it produces from.
*/
ScriptCargoList_IndustryProducing(IndustryID industry_id);
};
/**
* Creates a list of cargos that the given station accepts.
* Creates a list of cargoes that the given station accepts.
* @api ai
* @ingroup ScriptList
*/
class ScriptCargoList_StationAccepting : public ScriptList {
public:
/**
* @param station_id The station to get the list of cargos it accepts from.
* @param station_id The station to get the list of cargoes it accepts from.
*/
ScriptCargoList_StationAccepting(StationID station_id);
};

@ -46,7 +46,7 @@ public:
static char *GetName(EngineID engine_id);
/**
* Get the cargo-type of an engine. In case it can transport multiple cargos, it
* Get the cargo-type of an engine. In case it can transport multiple cargoes, it
* returns the first/main.
* @param engine_id The engine to get the cargo-type of.
* @pre IsValidEngine(engine_id).
@ -82,7 +82,7 @@ public:
static bool CanPullCargo(EngineID engine_id, CargoID cargo_id);
/**
* Get the capacity of an engine. In case it can transport multiple cargos, it
* Get the capacity of an engine. In case it can transport multiple cargoes, it
* returns the first/main.
* @param engine_id The engine to get the capacity of.
* @pre IsValidEngine(engine_id).

@ -231,14 +231,14 @@ public:
char *GetName();
/**
* Get the cargo-type of the offered engine. In case it can transport multiple cargos, it
* Get the cargo-type of the offered engine. In case it can transport multiple cargoes, it
* returns the first/main.
* @return The cargo-type of the engine.
*/
CargoID GetCargoType();
/**
* Get the capacity of the offered engine. In case it can transport multiple cargos, it
* Get the capacity of the offered engine. In case it can transport multiple cargoes, it
* returns the first/main.
* @return The capacity of the engine.
*/

@ -45,7 +45,7 @@ public:
/**
* Get a list of CargoID possible produced by this industry-type.
* @warning This function only returns the default cargos of the industry type.
* @warning This function only returns the default cargoes of the industry type.
* Industries can specify new cargotypes on construction.
* @param industry_type The type to get the CargoIDs for.
* @pre IsValidIndustryType(industry_type).
@ -55,7 +55,7 @@ public:
/**
* Get a list of CargoID accepted by this industry-type.
* @warning This function only returns the default cargos of the industry type.
* @warning This function only returns the default cargoes of the industry type.
* Industries can specify new cargotypes on construction.
* @param industry_type The type to get the CargoIDs for.
* @pre IsValidIndustryType(industry_type).

@ -498,7 +498,7 @@ CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
}
/**
* Get the acceptance of cargos around the tile in 1/8.
* Get the acceptance of cargoes around the tile in 1/8.
* @param tile Center of the search area
* @param w X extent of area
* @param h Y extent of area

@ -33,11 +33,11 @@
#include "table/strings.h"
/**
* Draw a (multi)line of cargos seperated by commas, and prefixed with a string.
* @param cargo_mask Mask of cargos to include in the list.
* @param r Rectangle to draw the cargos in.
* @param prefix String to use as prefix for the list of cargos.
* @return Bottom position of the last line used for drawing the cargos.
* Draw a (multi)line of cargoes seperated by commas, and prefixed with a string.
* @param cargo_mask Mask of cargoes to include in the list.
* @param r Rectangle to draw the cargoes in.
* @param prefix String to use as prefix for the list of cargoes.
* @return Bottom position of the last line used for drawing the cargoes.
*/
static int DrawCargoListText(uint32 cargo_mask, const Rect &r, StringID prefix)
{
@ -78,7 +78,7 @@ static int DrawCargoListText(uint32 cargo_mask, const Rect &r, StringID prefix)
* @param top y position where the string is to be drawn
* @param sct which type of cargo is to be displayed (passengers/non-passengers)
* @param rad radius around selected tile(s) to be searched
* @param supplies if supplied cargos should be drawn, else accepted cargos
* @param supplies if supplied cargoes should be drawn, else accepted cargoes
* @return Returns the y value below the string that was drawn
*/
int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies)
@ -86,11 +86,11 @@ int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageTyp
TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y);
uint32 cargo_mask = 0;
if (_thd.drawstyle == HT_RECT && tile < MapSize()) {
CargoArray cargos;
CargoArray cargoes;
if (supplies) {
cargos = GetProductionAroundTiles(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE, rad);
cargoes = GetProductionAroundTiles(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE, rad);
} else {
cargos = GetAcceptanceAroundTiles(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE, rad);
cargoes = GetAcceptanceAroundTiles(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE, rad);
}
/* Convert cargo counts to a set of cargo bits, and draw the result. */
@ -101,7 +101,7 @@ int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageTyp
case SCT_ALL: break;
default: NOT_REACHED();
}
if (cargos[i] >= (supplies ? 1U : 8U)) SetBit(cargo_mask, i);
if (cargoes[i] >= (supplies ? 1U : 8U)) SetBit(cargo_mask, i);
}
}
Rect r = {left, top, right, INT32_MAX};
@ -1000,7 +1000,7 @@ struct StationViewWindow : public Window {
StationID station_id = this->window_number;
const Station *st = Station::Get(station_id);
/* count types of cargos waiting in station */
/* count types of cargoes waiting in station */
for (CargoID i = 0; i < NUM_CARGO; i++) {
if (st->goods[i].cargo.Empty()) {
this->cargo_rows[i] = 0;

@ -21,8 +21,8 @@ enum StationViewWidgets {
SVW_CAPTION = 0, ///< Caption of the window
SVW_WAITING = 1, ///< List of waiting cargo
SVW_SCROLLBAR = 2, ///< Scrollbar
SVW_ACCEPTLIST = 3, ///< List of accepted cargos
SVW_RATINGLIST = 3, ///< Ratings of cargos
SVW_ACCEPTLIST = 3, ///< List of accepted cargoes
SVW_RATINGLIST = 3, ///< Ratings of cargoes
SVW_LOCATION = 4, ///< 'Location' button
SVW_RATINGS = 5, ///< 'Ratings' button
SVW_ACCEPTS = 5, ///< 'Accepts' button
@ -35,9 +35,9 @@ enum StationViewWidgets {
/** Types of cargo to display for station coverage. */
enum StationCoverageType {
SCT_PASSENGERS_ONLY, ///< Draw only passenger class cargos.
SCT_NON_PASSENGERS_ONLY, ///< Draw all non-passenger class cargos.
SCT_ALL, ///< Draw all cargos.
SCT_PASSENGERS_ONLY, ///< Draw only passenger class cargoes.
SCT_NON_PASSENGERS_ONLY, ///< Draw all non-passenger class cargoes.
SCT_ALL, ///< Draw all cargoes.
};
int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies);

@ -259,7 +259,7 @@ bool FindSubsidyTownCargoRoute()
cargo_number--;
}
/* Avoid using invalid NewGRF cargos. */
/* Avoid using invalid NewGRF cargoes. */
if (!CargoSpec::Get(cid)->IsValid()) return false;
/* Quit if the percentage transported is large enough. */
@ -316,7 +316,7 @@ bool FindSubsidyIndustryCargoRoute()
bool FindSubsidyCargoDestination(CargoID cid, SourceType src_type, SourceID src)
{
/* Choose a random destination. Only consider towns if they can accept the cargo. */
SourceType dst_type = (HasBit(_town_cargos_accepted, cid) && Chance16(1, 2)) ? ST_TOWN : ST_INDUSTRY;
SourceType dst_type = (HasBit(_town_cargoes_accepted, cid) && Chance16(1, 2)) ? ST_TOWN : ST_INDUSTRY;
SourceID dst;
switch (dst_type) {

@ -479,7 +479,7 @@ static const NIFeature * const _nifeatures[] = {
NULL, // GSF_GLOBALVAR (has no "physical" objects)
&_nif_industrytile, // GSF_INDUSTRYTILES
&_nif_industry, // GSF_INDUSTRIES
NULL, // GSF_CARGOS (has no "physical" objects)
NULL, // GSF_CARGOES (has no "physical" objects)
NULL, // GSF_SOUNDFX (has no "physical" objects)
NULL, // GSF_AIRPORTS (feature not implemented)
NULL, // GSF_SIGNALS (feature not implemented)

@ -80,9 +80,9 @@ struct Town : TownPool::PoolItem<&_town_pool> {
inline byte GetPercentTransported(CargoID cid) const { return this->supplied[cid].old_act * 256 / (this->supplied[cid].old_max + 1); }
/* Cargo production and acceptance stats. */
uint32 cargo_produced; ///< Bitmap of all cargos produced by houses in this town.
AcceptanceMatrix cargo_accepted; ///< Bitmap of cargos accepted by houses for each 4*4 map square of the town.
uint32 cargo_accepted_total; ///< NOSAVE: Bitmap of all cargos accepted by houses in this town.
uint32 cargo_produced; ///< Bitmap of all cargoes produced by houses in this town.
AcceptanceMatrix cargo_accepted; ///< Bitmap of cargoes accepted by houses for each 4*4 map square of the town.
uint32 cargo_accepted_total; ///< NOSAVE: Bitmap of all cargoes accepted by houses in this town.
uint16 time_until_rebuild; ///< time until we rebuild a house
@ -183,7 +183,7 @@ void ResetHouses();
void ClearTownHouse(Town *t, TileIndex tile);
void UpdateTownMaxPass(Town *t);
void UpdateTownRadius(Town *t);
void UpdateTownCargos(Town *t);
void UpdateTownCargoes(Town *t);
void UpdateTownCargoTotal(Town *t);
void UpdateTownCargoBitmap();
CommandCost CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags);
@ -285,6 +285,6 @@ void MakeDefaultName(T *obj)
obj->town_cn = (uint16)next; // set index...
}
extern uint32 _town_cargos_accepted;
extern uint32 _town_cargoes_accepted;
#endif /* TOWN_H */

@ -52,7 +52,7 @@
#include "table/town_land.h"
TownID _new_town_id;
uint32 _town_cargos_accepted; ///< Bitmap of all cargos accepted by houses.
uint32 _town_cargoes_accepted; ///< Bitmap of all cargoes accepted by houses.
/* Initialize the town-pool */
TownPool _town_pool("Town");
@ -690,12 +690,12 @@ void UpdateTownCargoTotal(Town *t)
}
/**
* Update accepted town cargos around a specific tile.
* Update accepted town cargoes around a specific tile.
* @param t The town to update.
* @param start Update the values around this tile.
* @param update_total Set to true if the total cargo acceptance should be updated.
*/
static void UpdateTownCargos(Town *t, TileIndex start, bool update_total = true)
static void UpdateTownCargoes(Town *t, TileIndex start, bool update_total = true)
{
CargoArray accepted, produced;
uint32 dummy;
@ -711,7 +711,7 @@ static void UpdateTownCargos(Town *t, TileIndex start, bool update_total = true)
AddProducedCargo_Town(tile, produced);
}
/* Create bitmap of produced and accepted cargos. */
/* Create bitmap of produced and accepted cargoes. */
uint32 acc = 0;
for (uint cid = 0; cid < NUM_CARGO; cid++) {
if (accepted[cid] >= 8) SetBit(acc, cid);
@ -725,7 +725,7 @@ static void UpdateTownCargos(Town *t, TileIndex start, bool update_total = true)
/** Update cargo acceptance for the complete town.
* @param t The town to update.
*/
void UpdateTownCargos(Town *t)
void UpdateTownCargoes(Town *t)
{
t->cargo_produced = 0;
@ -735,7 +735,7 @@ void UpdateTownCargos(Town *t)
/* Update acceptance for each grid square. */
TILE_AREA_LOOP(tile, area) {
if (TileX(tile) % AcceptanceMatrix::GRID == 0 && TileY(tile) % AcceptanceMatrix::GRID == 0) {
UpdateTownCargos(t, tile, false);
UpdateTownCargoes(t, tile, false);
}
}
@ -743,14 +743,14 @@ void UpdateTownCargos(Town *t)
UpdateTownCargoTotal(t);
}
/** Updates the bitmap of all cargos accepted by houses. */
/** Updates the bitmap of all cargoes accepted by houses. */
void UpdateTownCargoBitmap()
{
Town *town;
_town_cargos_accepted = 0;
_town_cargoes_accepted = 0;
FOR_ALL_TOWNS(town) {
_town_cargos_accepted |= town->cargo_accepted_total;
_town_cargoes_accepted |= town->cargo_accepted_total;
}
}
@ -2301,7 +2301,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
}
MakeTownHouse(tile, t, construction_counter, construction_stage, house, random_bits);
UpdateTownCargos(t, tile);
UpdateTownCargoes(t, tile);
return true;
}
@ -2385,7 +2385,7 @@ void ClearTownHouse(Town *t, TileIndex tile)
if (eflags & BUILDING_HAS_4_TILES) DoClearTownHouseHelper(tile + TileDiffXY(1, 1), t, ++house);
/* Update cargo acceptance. */
UpdateTownCargos(t, tile);
UpdateTownCargoes(t, tile);
}
/**
@ -3152,7 +3152,7 @@ void TownsMonthlyLoop()
UpdateTownRating(t);
UpdateTownGrowRate(t);
UpdateTownUnwanted(t);
UpdateTownCargos(t);
UpdateTownCargoes(t);
}
UpdateTownCargoBitmap();

@ -526,7 +526,7 @@ public:
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
if (!gui_scope) return;
/* Called when setting station noise or required cargos have changed, in order to resize the window */
/* Called when setting station noise or required cargoes have changed, in order to resize the window */
this->SetDirty(); // refresh display for current size. This will allow to avoid glitches when downgrading
this->ResizeWindowAsNeeded();
}

@ -144,7 +144,7 @@ bool Vehicle::NeedsServicing() const
if (union_mask != 0) {
CargoID cargo_type;
/* We cannot refit to mixed cargoes in an automated way */
if (IsArticulatedVehicleCarryingDifferentCargos(v, &cargo_type)) continue;
if (IsArticulatedVehicleCarryingDifferentCargoes(v, &cargo_type)) continue;
/* Did the old vehicle carry anything? */
if (cargo_type != CT_INVALID) {

@ -375,7 +375,7 @@ struct RefitWindow : public Window {
RefitOption *cargo; ///< Refit option selected by \v sel.
SubtypeList list[NUM_CARGO]; ///< List of refit subtypes available for each sorted cargo.
VehicleOrderID order; ///< If not #INVALID_VEH_ORDER_ID, selection is part of a refit order (rather than execute directly).
uint information_width; ///< Width required for correctly displaying all cargos in the information panel.
uint information_width; ///< Width required for correctly displaying all cargoes in the information panel.
Scrollbar *vscroll; ///< The main scrollbar.
Scrollbar *hscroll; ///< Only used for long vehicles.
int vehicle_width; ///< Width of the vehicle being drawn.
@ -410,7 +410,7 @@ struct RefitWindow : public Window {
/* Skip this engine if we build the list for auto-refitting and engine doesn't allow it. */
if (this->auto_refit && !HasBit(e->info.misc_flags, EF_AUTO_REFIT)) continue;
/* Loop through all cargos in the refit mask */
/* Loop through all cargoes in the refit mask */
int current_index = 0;
const CargoSpec *cs;
FOR_ALL_SORTED_CARGOSPECS(cs) {

Loading…
Cancel
Save