Merge branch 'master' into jgrpp

# Conflicts:
#	src/autoreplace_cmd.cpp
#	src/build_vehicle_gui.cpp
#	src/cargotype.cpp
#	src/economy.cpp
#	src/engine_gui.cpp
#	src/industry_cmd.cpp
#	src/industry_gui.cpp
#	src/linkgraph/linkgraph_gui.h
#	src/linkgraph/refresh.cpp
#	src/linkgraph/refresh.h
#	src/newgrf.cpp
#	src/newgrf_airporttiles.h
#	src/newgrf_roadstop.cpp
#	src/newgrf_station.cpp
#	src/newgrf_station.h
#	src/order_base.h
#	src/order_cmd.cpp
#	src/order_func.h
#	src/order_gui.cpp
#	src/pathfinder/pathfinder_type.h
#	src/saveload/afterload.cpp
#	src/subsidy_base.h
#	src/vehicle_cmd.cpp
#	src/vehicle_gui.cpp
#	src/vehicle_gui_base.h
pull/642/head
Jonathan G Rennison 4 months ago
commit 3050620189

@ -146,9 +146,9 @@ void GetArticulatedPartsEngineIDs(EngineID engine_type, bool purchase_window, st
static inline uint16_t GetVehicleDefaultCapacity(EngineID engine, CargoID *cargo_type)
{
const Engine *e = Engine::Get(engine);
CargoID cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : (CargoID)CT_INVALID);
CargoID cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : INVALID_CARGO);
if (cargo_type != nullptr) *cargo_type = cargo;
if (cargo == CT_INVALID) return 0;
if (cargo == INVALID_CARGO) return 0;
return e->GetDisplayDefaultCapacity();
}
@ -322,21 +322,21 @@ CargoTypes GetUnionOfArticulatedRefitMasks(EngineID engine, bool include_initial
* Get cargo mask of all cargoes carried by an articulated vehicle.
* 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)
* @param cargo_type returns the common CargoID if needed. (INVALID_CARGO if no part is carrying something or they are carrying different things)
* @return cargo mask, may be 0 if the no vehicle parts have cargo capacity
*/
CargoTypes GetCargoTypesOfArticulatedVehicle(const Vehicle *v, CargoID *cargo_type)
{
CargoTypes cargoes = 0;
CargoID first_cargo = CT_INVALID;
CargoID first_cargo = INVALID_CARGO;
do {
if (v->cargo_type != CT_INVALID && v->GetEngine()->CanCarryCargo()) {
if (v->cargo_type != INVALID_CARGO && v->GetEngine()->CanCarryCargo()) {
SetBit(cargoes, v->cargo_type);
if (first_cargo == CT_INVALID) first_cargo = v->cargo_type;
if (first_cargo == INVALID_CARGO) first_cargo = v->cargo_type;
if (first_cargo != v->cargo_type) {
if (cargo_type != nullptr) {
*cargo_type = CT_INVALID;
*cargo_type = INVALID_CARGO;
cargo_type = nullptr;
}
}
@ -353,7 +353,7 @@ CargoTypes GetCargoTypesOfArticulatedVehicle(const Vehicle *v, CargoID *cargo_ty
* Returns the overall cargo of an articulated vehicle if all parts are refitted to the same cargo.
* Note: Vehicles not carrying anything are ignored
* @param v the first vehicle in the chain
* @return the common CargoID. (CT_INVALID if no part is carrying something or they are carrying different things)
* @return the common CargoID. (INVALID_CARGO if no part is carrying something or they are carrying different things)
*/
CargoID GetOverallCargoOfArticulatedVehicle(const Vehicle *v)
{

@ -222,31 +222,31 @@ static int GetIncompatibleRefitOrderIdForAutoreplace(const Vehicle *v, EngineID
* @param engine_type The EngineID of the vehicle that is being replaced to
* @param part_of_chain The vehicle is part of a train
* @return The cargo type to replace to
* CT_NO_REFIT is returned if no refit is needed
* CT_INVALID is returned when both old and new vehicle got cargo capacity and refitting the new one to the old one's cargo type isn't possible
* CARGO_NO_REFIT is returned if no refit is needed
* INVALID_CARGO is returned when both old and new vehicle got cargo capacity and refitting the new one to the old one's cargo type isn't possible
*/
static CargoID GetNewCargoTypeForReplace(const Vehicle *v, EngineID engine_type, bool part_of_chain)
{
CargoTypes available_cargo_types, union_mask;
GetArticulatedRefitMasks(engine_type, true, &union_mask, &available_cargo_types);
if (union_mask == 0) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
if (union_mask == 0) return CARGO_NO_REFIT; // Don't try to refit an engine with no cargo capacity
CargoID cargo_type;
CargoTypes cargo_mask = GetCargoTypesOfArticulatedVehicle(v, &cargo_type);
if (!HasAtMostOneBit(cargo_mask)) {
CargoTypes new_engine_default_cargoes = GetCargoTypesOfArticulatedParts(engine_type);
if ((cargo_mask & new_engine_default_cargoes) == cargo_mask) {
return CT_NO_REFIT; // engine_type is already a mixed cargo type which matches the incoming vehicle by default, no refit required
return CARGO_NO_REFIT; // engine_type is already a mixed cargo type which matches the incoming vehicle by default, no refit required
}
return CT_INVALID; // We cannot refit to mixed cargoes in an automated way
return INVALID_CARGO; // 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.
if (cargo_type == INVALID_CARGO) {
if (v->type != VEH_TRAIN) return CARGO_NO_REFIT; // If the vehicle does not carry anything at all, every replacement is fine.
if (!part_of_chain) return CT_NO_REFIT;
if (!part_of_chain) return CARGO_NO_REFIT;
/* the old engine didn't have cargo capacity, but the new one does
* now we will figure out what cargo the train is carrying and refit to fit this */
@ -257,11 +257,11 @@ static CargoID GetNewCargoTypeForReplace(const Vehicle *v, EngineID engine_type,
if (HasBit(available_cargo_types, v->cargo_type)) return v->cargo_type;
}
return CT_NO_REFIT; // We failed to find a cargo type on the old vehicle and we will not refit the new one
return CARGO_NO_REFIT; // We failed to find a cargo type on the old vehicle and we will not refit the new one
} else {
if (!HasBit(available_cargo_types, cargo_type)) return CT_INVALID; // We can't refit the vehicle to carry the cargo we want
if (!HasBit(available_cargo_types, cargo_type)) return INVALID_CARGO; // We can't refit the vehicle to carry the cargo we want
if (part_of_chain && !VerifyAutoreplaceRefitForOrders(v, engine_type)) return CT_INVALID; // Some refit orders lose their effect
if (part_of_chain && !VerifyAutoreplaceRefitForOrders(v, engine_type)) return INVALID_CARGO; // Some refit orders lose their effect
return cargo_type;
}
@ -332,7 +332,7 @@ static CommandCost BuildReplacementVehicleRefitFailure(EngineID e, const Vehicle
static CommandCost BuildReplacementMultiPartShipSimple(EngineID e, const Vehicle *old_veh, Vehicle **new_vehicle)
{
/* Build the new vehicle */
CommandCost cost = DoCommand(old_veh->tile, e | (CT_INVALID << 24), 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
CommandCost cost = DoCommand(old_veh->tile, e | (INVALID_CARGO << 24), 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
if (cost.Failed()) return cost;
Vehicle *new_veh = Vehicle::Get(_new_vehicle_id);
@ -341,7 +341,7 @@ static CommandCost BuildReplacementMultiPartShipSimple(EngineID e, const Vehicle
Vehicle *v = new_veh;
const Vehicle *old = old_veh;
for (; v != nullptr && old != nullptr; v = v->Next(), old = old->Next()) {
if (old->cargo_type == CT_INVALID) continue;
if (old->cargo_type == INVALID_CARGO) continue;
byte subtype = GetBestFittingSubType(old, v, old->cargo_type);
CommandCost refit_cost = DoCommand(0, v->index, old->cargo_type | (subtype << 8) | (1 << 16), DC_EXEC, GetCmdRefitVeh(v));
@ -375,7 +375,7 @@ static CommandCost BuildReplacementMultiPartShip(EngineID e, const Vehicle *old_
if (refit_idx == refit_mask_list.size()) {
easy_mode = false;
}
if (old->cargo_type == CT_INVALID) continue;
if (old->cargo_type == INVALID_CARGO) continue;
old_cargo_vehs[old->cargo_type] = old;
@ -416,7 +416,7 @@ static CommandCost BuildReplacementMultiPartShip(EngineID e, const Vehicle *old_
CargoTypes available = todo & refit_mask_list[i];
if (available == 0) available = all_cargoes & refit_mask_list[i];
if (available == 0) {
output_cargoes.push_back(CT_INVALID);
output_cargoes.push_back(INVALID_CARGO);
continue;
}
@ -441,7 +441,7 @@ static CommandCost BuildReplacementMultiPartShip(EngineID e, const Vehicle *old_
if (new_vehicle == nullptr) return CommandCost(); // dry-run: success
/* Build the new vehicle */
CommandCost cost = DoCommand(old_veh->tile, e | (CT_INVALID << 24), 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
CommandCost cost = DoCommand(old_veh->tile, e | (INVALID_CARGO << 24), 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
if (cost.Failed()) return cost;
Vehicle *new_veh = Vehicle::Get(_new_vehicle_id);
@ -450,7 +450,7 @@ static CommandCost BuildReplacementMultiPartShip(EngineID e, const Vehicle *old_
size_t i = 0;
for (Vehicle *v = new_veh; v != nullptr && i < output_cargoes.size(); v = v->Next(), i++) {
CargoID c = output_cargoes[i];
if (c == CT_INVALID) continue;
if (c == INVALID_CARGO) continue;
assert(old_cargo_vehs[c] != nullptr);
byte subtype = GetBestFittingSubType(old_cargo_vehs[c], v, c);
@ -488,7 +488,7 @@ static CommandCost BuildReplacementVehicle(const Vehicle *old_veh, Vehicle **new
if (old_veh->type == VEH_SHIP && old_veh->Next() != nullptr) {
CargoTypes cargoes = 0;
for (const Vehicle *u = old_veh; u != nullptr; u = u->Next()) {
if (u->cargo_type != CT_INVALID && u->GetEngine()->CanCarryCargo()) {
if (u->cargo_type != INVALID_CARGO && u->GetEngine()->CanCarryCargo()) {
SetBit(cargoes, u->cargo_type);
}
}
@ -500,19 +500,19 @@ static CommandCost BuildReplacementVehicle(const Vehicle *old_veh, Vehicle **new
/* Does it need to be refitted */
CargoID refit_cargo = GetNewCargoTypeForReplace(old_veh, e, part_of_chain);
if (refit_cargo == CT_INVALID) {
if (refit_cargo == INVALID_CARGO) {
return BuildReplacementVehicleRefitFailure(e, old_veh);
}
/* Build the new vehicle */
cost = DoCommand(old_veh->tile, e | (CT_INVALID << 24), 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
cost = DoCommand(old_veh->tile, e | (INVALID_CARGO << 24), 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
if (cost.Failed()) return cost;
Vehicle *new_veh = Vehicle::Get(_new_vehicle_id);
*new_vehicle = new_veh;
/* Refit the vehicle if needed */
if (refit_cargo != CT_NO_REFIT) {
if (refit_cargo != CARGO_NO_REFIT) {
byte subtype = GetBestFittingSubType(old_veh, new_veh, refit_cargo);
cost.AddCost(DoCommand(0, new_veh->index, refit_cargo | (subtype << 8), DC_EXEC, GetCmdRefitVeh(new_veh)));

@ -197,26 +197,21 @@ static const NWidgetPart _nested_build_vehicle_widgets_train_advanced[] = {
EndContainer(),
};
/** Special cargo filter criteria */
static const CargoID CF_ANY = CT_NO_REFIT; ///< Show all vehicles independent of carried cargo (i.e. no filtering)
static const CargoID CF_NONE = CT_INVALID; ///< Show only vehicles which do not carry cargo (e.g. train engines)
static const CargoID CF_ENGINES = CT_AUTO_REFIT; ///< Show only engines (for rail vehicles only)
bool _engine_sort_direction; ///< \c false = descending, \c true = ascending.
byte _engine_sort_last_criteria[] = {0, 0, 0, 0}; ///< Last set sort criteria, for each vehicle type.
bool _engine_sort_last_order[] = {false, false, false, false}; ///< Last set direction of the sort order, for each vehicle type.
bool _engine_sort_show_hidden_engines[] = {false, false, false, false}; ///< Last set 'show hidden engines' setting for each vehicle type.
bool _engine_sort_show_hidden_locos = false; ///< Last set 'show hidden locos' setting.
bool _engine_sort_show_hidden_wagons = false; ///< Last set 'show hidden wagons' setting.
static CargoID _engine_sort_last_cargo_criteria[] = {CF_ANY, CF_ANY, CF_ANY, CF_ANY}; ///< Last set filter criteria, for each vehicle type.
static CargoID _engine_sort_last_cargo_criteria[] = {CargoFilterCriteria::CF_ANY, CargoFilterCriteria::CF_ANY, CargoFilterCriteria::CF_ANY, CargoFilterCriteria::CF_ANY}; ///< Last set filter criteria, for each vehicle type.
static byte _last_sort_criteria_loco = 0;
static bool _last_sort_order_loco = false;
static CargoID _last_filter_criteria_loco = CF_ANY;
static CargoID _last_filter_criteria_loco = CargoFilterCriteria::CF_ANY;
static byte _last_sort_criteria_wagon = 0;
static bool _last_sort_order_wagon = false;
static CargoID _last_filter_criteria_wagon = CF_ANY;
static CargoID _last_filter_criteria_wagon = CargoFilterCriteria::CF_ANY;
/**
* Determines order of engines by engineID
@ -749,13 +744,13 @@ const StringID _engine_sort_listing[][14] = {{
/** Filters vehicles by cargo and engine (in case of rail vehicle). */
static bool CargoAndEngineFilter(const GUIEngineListItem *item, const CargoID cid)
{
if (cid == CF_ANY) {
if (cid == CargoFilterCriteria::CF_ANY) {
return true;
} else if (cid == CF_ENGINES) {
} else if (cid == CargoFilterCriteria::CF_ENGINES) {
return Engine::Get(item->engine_id)->GetPower() != 0;
} else {
CargoTypes refit_mask = GetUnionOfArticulatedRefitMasks(item->engine_id, true) & _standard_cargo_mask;
return (cid == CF_NONE ? refit_mask == 0 : HasBit(refit_mask, cid));
return (cid == CargoFilterCriteria::CF_NONE ? refit_mask == 0 : HasBit(refit_mask, cid));
}
}
@ -1116,7 +1111,7 @@ void TestedEngineDetails::FillDefaultCapacities(const Engine *e)
this->all_capacities[this->cargo] = this->capacity;
this->all_capacities[CT_MAIL] = this->mail_capacity;
}
if (this->all_capacities.GetCount() == 0) this->cargo = CT_INVALID;
if (this->all_capacities.GetCount() == 0) this->cargo = INVALID_CARGO;
}
/**
@ -1163,7 +1158,7 @@ int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number,
int new_y = DrawCargoCapacityInfo(left, right, y, te, refittable);
if (new_y == y) {
SetDParam(0, CT_INVALID);
SetDParam(0, INVALID_CARGO);
SetDParam(2, STR_EMPTY);
DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY);
y += GetCharacterHeight(FS_NORMAL);
@ -1409,7 +1404,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
{
NWidgetCore *widget = this->GetWidget<NWidgetCore>(WID_BV_BUILD);
bool refit = this->sel_engine != INVALID_ENGINE && this->cargo_filter_criteria != CF_ANY && this->cargo_filter_criteria != CF_NONE;
bool refit = this->sel_engine != INVALID_ENGINE && this->cargo_filter_criteria != CargoFilterCriteria::CF_ANY && this->cargo_filter_criteria != CargoFilterCriteria::CF_NONE;
if (refit) refit = Engine::Get(this->sel_engine)->GetDefaultCargoType() != this->cargo_filter_criteria;
if (this->virtual_train_mode) {
@ -1518,9 +1513,9 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
StringID GetCargoFilterLabel(CargoID cid) const
{
switch (cid) {
case CF_ANY: return STR_PURCHASE_INFO_ALL_TYPES;
case CF_ENGINES: return STR_PURCHASE_INFO_ENGINES_ONLY;
case CF_NONE: return STR_PURCHASE_INFO_NONE;
case CargoFilterCriteria::CF_ANY: return STR_PURCHASE_INFO_ALL_TYPES;
case CargoFilterCriteria::CF_ENGINES: return STR_PURCHASE_INFO_ENGINES_ONLY;
case CargoFilterCriteria::CF_NONE: return STR_PURCHASE_INFO_NONE;
default: return CargoSpec::Get(cid)->name;
}
}
@ -1530,16 +1525,16 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
{
/* Set the last cargo filter criteria. */
this->cargo_filter_criteria = _engine_sort_last_cargo_criteria[this->vehicle_type];
if (this->cargo_filter_criteria < NUM_CARGO && !HasBit(_standard_cargo_mask, this->cargo_filter_criteria)) this->cargo_filter_criteria = CF_ANY;
if (this->cargo_filter_criteria < NUM_CARGO && !HasBit(_standard_cargo_mask, this->cargo_filter_criteria)) this->cargo_filter_criteria = CargoFilterCriteria::CF_ANY;
this->eng_list.SetFilterFuncs(_filter_funcs);
this->eng_list.SetFilterState(this->cargo_filter_criteria != CF_ANY);
this->eng_list.SetFilterState(this->cargo_filter_criteria != CargoFilterCriteria::CF_ANY);
}
void SelectEngine(EngineID engine)
{
CargoID cargo = this->cargo_filter_criteria;
if (cargo == CF_ANY || cargo == CF_ENGINES || cargo == CF_NONE) cargo = CT_INVALID;
if (cargo == CargoFilterCriteria::CF_ANY || cargo == CargoFilterCriteria::CF_ENGINES || cargo == CargoFilterCriteria::CF_NONE) cargo = INVALID_CARGO;
this->sel_engine = engine;
this->SetBuyVehicleText();
@ -1549,13 +1544,13 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
const Engine *e = Engine::Get(this->sel_engine);
if (!e->CanPossiblyCarryCargo()) {
this->te.cost = 0;
this->te.cargo = CT_INVALID;
this->te.cargo = INVALID_CARGO;
this->te.all_capacities.Clear();
return;
}
if (this->virtual_train_mode) {
if (cargo != CT_INVALID && cargo != e->GetDefaultCargoType()) {
if (cargo != INVALID_CARGO && cargo != e->GetDefaultCargoType()) {
SavedRandomSeeds saved_seeds;
SaveRandomSeeds(&saved_seeds);
StringID err;
@ -1565,7 +1560,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
this->te.cost = ret.GetCost();
this->te.capacity = _returned_refit_capacity;
this->te.mail_capacity = _returned_mail_refit_capacity;
this->te.cargo = (cargo == CT_INVALID) ? e->GetDefaultCargoType() : cargo;
this->te.cargo = (cargo == INVALID_CARGO) ? e->GetDefaultCargoType() : cargo;
this->te.all_capacities = _returned_vehicle_capacities;
delete t;
RestoreRandomSeeds(saved_seeds);
@ -1581,7 +1576,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
this->te.cost = ret.GetCost() - e->GetCost();
this->te.capacity = _returned_refit_capacity;
this->te.mail_capacity = _returned_mail_refit_capacity;
this->te.cargo = (cargo == CT_INVALID) ? e->GetDefaultCargoType() : cargo;
this->te.cargo = (cargo == INVALID_CARGO) ? e->GetDefaultCargoType() : cargo;
this->te.all_capacities = _returned_vehicle_capacities;
return;
}
@ -1839,14 +1834,14 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
DropDownList list;
/* Add item for disabling filtering. */
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_ANY), CF_ANY, false));
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CargoFilterCriteria::CF_ANY), CargoFilterCriteria::CF_ANY, false));
/* Specific filters for trains. */
if (this->vehicle_type == VEH_TRAIN) {
/* Add item for locomotives only in case of trains. */
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_ENGINES), CF_ENGINES, false));
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CargoFilterCriteria::CF_ENGINES), CargoFilterCriteria::CF_ENGINES, false));
/* Add item for vehicles not carrying anything, e.g. train engines.
* This could also be useful for eyecandy vehicles of other types, but is likely too confusing for joe, */
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_NONE), CF_NONE, false));
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CargoFilterCriteria::CF_NONE), CargoFilterCriteria::CF_NONE, false));
}
/* Add cargos */
@ -1935,7 +1930,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
cmd = GetCmdBuildVeh(this->vehicle_type);
}
CargoID cargo = this->cargo_filter_criteria;
if (cargo == CF_ANY || cargo == CF_ENGINES || cargo == CF_NONE) cargo = CT_INVALID;
if (cargo == CargoFilterCriteria::CF_ANY || cargo == CargoFilterCriteria::CF_ENGINES || cargo == CargoFilterCriteria::CF_NONE) cargo = INVALID_CARGO;
DoCommandP(this->window_number, sel_eng | (cargo << 24), 0, cmd, callback);
/* Update last used variant in hierarchy and refresh if necessary. */
@ -2140,7 +2135,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
this->cargo_filter_criteria = index;
_engine_sort_last_cargo_criteria[this->vehicle_type] = this->cargo_filter_criteria;
/* deactivate filter if criteria is 'Show All', activate it otherwise */
this->eng_list.SetFilterState(this->cargo_filter_criteria != CF_ANY);
this->eng_list.SetFilterState(this->cargo_filter_criteria != CargoFilterCriteria::CF_ANY);
this->eng_list.ForceRebuild();
this->SelectEngine(this->sel_engine);
}
@ -2301,7 +2296,8 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
bool GetRefitButtonMode(const PanelState &state) const
{
bool refit = state.sel_engine != INVALID_ENGINE && state.cargo_filter[state.cargo_filter_criteria] != CF_ANY && state.cargo_filter[state.cargo_filter_criteria] != CF_NONE;
bool refit = state.sel_engine != INVALID_ENGINE && state.cargo_filter[state.cargo_filter_criteria] != CargoFilterCriteria::CF_ANY &&
state.cargo_filter[state.cargo_filter_criteria] != CargoFilterCriteria::CF_NONE;
if (refit) refit = Engine::Get(state.sel_engine)->GetDefaultCargoType() != state.cargo_filter[state.cargo_filter_criteria];
return refit;
}
@ -2456,12 +2452,12 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
uint filter_items = 0;
/* Add item for disabling filtering. */
state.cargo_filter[filter_items] = CF_ANY;
state.cargo_filter[filter_items] = CargoFilterCriteria::CF_ANY;
state.cargo_filter_texts[filter_items] = STR_PURCHASE_INFO_ALL_TYPES;
filter_items++;
/* Add item for vehicles not carrying anything, e.g. train engines. */
state.cargo_filter[filter_items] = CF_NONE;
state.cargo_filter[filter_items] = CargoFilterCriteria::CF_NONE;
state.cargo_filter_texts[filter_items] = STR_PURCHASE_INFO_NONE;
filter_items++;
@ -2487,7 +2483,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
}
state.eng_list.SetFilterFuncs(_filter_funcs);
state.eng_list.SetFilterState(state.cargo_filter[state.cargo_filter_criteria] != CF_ANY);
state.eng_list.SetFilterState(state.cargo_filter[state.cargo_filter_criteria] != CargoFilterCriteria::CF_ANY);
}
void SelectFirstEngine(PanelState &state)
@ -2501,7 +2497,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
void SelectEngine(PanelState &state, const EngineID engine)
{
CargoID cargo = state.cargo_filter[state.cargo_filter_criteria];
if (cargo == CF_ANY) cargo = CF_NONE;
if (cargo == CargoFilterCriteria::CF_ANY) cargo = CargoFilterCriteria::CF_NONE;
state.sel_engine = engine;
@ -2510,13 +2506,13 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
const Engine *e = Engine::Get(state.sel_engine);
if (!e->CanPossiblyCarryCargo()) {
state.te.cost = 0;
state.te.cargo = CT_INVALID;
state.te.cargo = INVALID_CARGO;
state.te.all_capacities.Clear();
return;
}
if (this->virtual_train_mode) {
if (cargo != CT_INVALID && cargo != e->GetDefaultCargoType()) {
if (cargo != INVALID_CARGO && cargo != e->GetDefaultCargoType()) {
SavedRandomSeeds saved_seeds;
SaveRandomSeeds(&saved_seeds);
StringID err;
@ -2526,7 +2522,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
state.te.cost = ret.GetCost();
state.te.capacity = _returned_refit_capacity;
state.te.mail_capacity = _returned_mail_refit_capacity;
state.te.cargo = (cargo == CT_INVALID) ? e->GetDefaultCargoType() : cargo;
state.te.cargo = (cargo == INVALID_CARGO) ? e->GetDefaultCargoType() : cargo;
state.te.all_capacities = _returned_vehicle_capacities;
delete t;
RestoreRandomSeeds(saved_seeds);
@ -2542,7 +2538,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
state.te.cost = ret.GetCost() - e->GetCost();
state.te.capacity = _returned_refit_capacity;
state.te.mail_capacity = _returned_mail_refit_capacity;
state.te.cargo = (cargo == CT_INVALID) ? e->GetDefaultCargoType() : cargo;
state.te.cargo = (cargo == INVALID_CARGO) ? e->GetDefaultCargoType() : cargo;
state.te.all_capacities = _returned_vehicle_capacities;
return;
}
@ -2586,7 +2582,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
{
const CargoID filter_type = state.cargo_filter[state.cargo_filter_criteria];
GUIEngineListItem item = {eid, eid, EngineDisplayFlags::None, 0};
return (filter_type == CF_ANY || CargoAndEngineFilter(&item, filter_type));
return (filter_type == CargoFilterCriteria::CF_ANY || CargoAndEngineFilter(&item, filter_type));
}
/** Filter by name and NewGRF extra text */
@ -2709,7 +2705,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
? CcBuildWagon : CcBuildPrimaryVehicle;
cmd = GetCmdBuildVeh(this->vehicle_type);
}
if (cargo == CF_ANY || cargo == CF_ENGINES) cargo = CF_NONE;
if (cargo == CargoFilterCriteria::CF_ANY || cargo == CargoFilterCriteria::CF_ENGINES) cargo = CargoFilterCriteria::CF_NONE;
DoCommandP(this->window_number, selected | (cargo << 24), 0, cmd, callback);
/* Update last used variant in hierarchy and refresh if necessary. */
@ -3163,7 +3159,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
this->loco.cargo_filter_criteria = static_cast<byte>(index);
_last_filter_criteria_loco = this->loco.cargo_filter[this->loco.cargo_filter_criteria];
/* deactivate filter if criteria is 'Show All', activate it otherwise */
this->loco.eng_list.SetFilterState(this->loco.cargo_filter[this->loco.cargo_filter_criteria] != CF_ANY);
this->loco.eng_list.SetFilterState(this->loco.cargo_filter[this->loco.cargo_filter_criteria] != CargoFilterCriteria::CF_ANY);
this->loco.eng_list.ForceRebuild();
}
break;
@ -3183,7 +3179,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
this->wagon.cargo_filter_criteria = static_cast<byte>(index);
_last_filter_criteria_wagon = this->wagon.cargo_filter[this->wagon.cargo_filter_criteria];
/* deactivate filter if criteria is 'Show All', activate it otherwise */
this->wagon.eng_list.SetFilterState(this->wagon.cargo_filter[this->wagon.cargo_filter_criteria] != CF_ANY);
this->wagon.eng_list.SetFilterState(this->wagon.cargo_filter[this->wagon.cargo_filter_criteria] != CargoFilterCriteria::CF_ANY);
this->wagon.eng_list.ForceRebuild();
}
break;

@ -64,18 +64,33 @@ enum CargoType {
CT_PLASTIC = 10,
CT_FIZZY_DRINKS = 11,
NUM_ORIGINAL_CARGO = 12,
NUM_CARGO = 64, ///< Maximal number of cargo types in a game.
CT_AUTO_REFIT = 0xFD, ///< Automatically choose cargo type when doing auto refitting.
CT_NO_REFIT = 0xFE, ///< Do not refit cargo of a vehicle (used in vehicle orders and auto-replace/auto-new).
CT_INVALID = 0xFF, ///< Invalid cargo type.
};
static const CargoID NUM_ORIGINAL_CARGO = 12; ///< Original number of cargo types.
static const CargoID NUM_CARGO = 64; ///< Maximum number of cargo types in a game.
/* CARGO_AUTO_REFIT and CARGO_NO_REFIT are stored in save-games for refit-orders, so should not be changed. */
static const CargoID CARGO_AUTO_REFIT = 0xFD; ///< Automatically choose cargo type when doing auto refitting.
static const CargoID CARGO_NO_REFIT = 0xFE; ///< Do not refit cargo of a vehicle (used in vehicle orders and auto-replace/auto-renew).
static const CargoID INVALID_CARGO = UINT8_MAX;
/**
* Special cargo filter criteria.
* These are used by user interface code only and must not be assigned to any entity. Not all values are valid for every UI filter.
*/
namespace CargoFilterCriteria {
static constexpr CargoID CF_ANY = NUM_CARGO; ///< Show all items independent of carried cargo (i.e. no filtering)
static constexpr CargoID CF_NONE = NUM_CARGO + 1; ///< Show only items which do not carry cargo (e.g. train engines)
static constexpr CargoID CF_ENGINES = NUM_CARGO + 2; ///< Show only engines (for rail vehicles only)
static constexpr CargoID CF_FREIGHT = NUM_CARGO + 3; ///< Show only vehicles which carry any freight (non-passenger) cargo
};
/** Test whether cargo type is not CT_INVALID */
inline bool IsValidCargoType(CargoType t) { return t != CT_INVALID; }
/** Test whether cargo type is not CT_INVALID */
inline bool IsValidCargoID(CargoID t) { return t != CT_INVALID; }
/** Test whether cargo type is not INVALID_CARGO */
inline bool IsValidCargoID(CargoID t) { return t != INVALID_CARGO; }
typedef uint64_t CargoTypes;

@ -89,13 +89,13 @@ Dimension GetLargestCargoIconSize()
* Get the cargo ID of a default cargo, if present.
* @param l Landscape
* @param ct Default cargo type.
* @return ID number if the cargo exists, else #CT_INVALID
* @return ID number if the cargo exists, else #INVALID_CARGO
*/
CargoID GetDefaultCargoID(LandscapeID l, CargoType ct)
{
assert(l < lengthof(_default_climate_cargo));
if (ct == CT_INVALID) return CT_INVALID;
if (ct == CT_INVALID) return INVALID_CARGO;
assert(ct < lengthof(_default_climate_cargo[0]));
CargoLabel cl = _default_climate_cargo[l][ct];
@ -110,7 +110,7 @@ CargoID GetDefaultCargoID(LandscapeID l, CargoType ct)
/**
* Get the cargo ID by cargo label.
* @param cl Cargo type to get.
* @return ID number if the cargo exists, else #CT_INVALID
* @return ID number if the cargo exists, else #INVALID_CARGO
*/
CargoID GetCargoIDByLabel(CargoLabel cl)
{
@ -119,25 +119,25 @@ CargoID GetCargoIDByLabel(CargoLabel cl)
}
/* No matching label was found, so it is invalid */
return CT_INVALID;
return INVALID_CARGO;
}
/**
* Find the CargoID of a 'bitnum' value.
* @param bitnum 'bitnum' to find.
* @return First CargoID with the given bitnum, or #CT_INVALID if not found or if the provided \a bitnum is invalid.
* @return First CargoID with the given bitnum, or #INVALID_CARGO if not found or if the provided \a bitnum is invalid.
*/
CargoID GetCargoIDByBitnum(uint8_t bitnum)
{
if (bitnum == INVALID_CARGO_BITNUM) return CT_INVALID;
if (bitnum == INVALID_CARGO_BITNUM) return INVALID_CARGO;
for (const CargoSpec *cs : CargoSpec::Iterate()) {
if (cs->bitnum == bitnum) return cs->Index();
}
/* No matching label was found, so it is invalid */
return CT_INVALID;
return INVALID_CARGO;
}
/**

@ -1396,10 +1396,10 @@ static void TriggerIndustryProduction(Industry *i)
} else {
for (uint ci_in = 0; ci_in < lengthof(i->incoming_cargo_waiting); ci_in++) {
uint cargo_waiting = i->incoming_cargo_waiting[ci_in];
if (cargo_waiting == 0 || i->accepts_cargo[ci_in] == CT_INVALID) continue;
if (cargo_waiting == 0 || i->accepts_cargo[ci_in] == INVALID_CARGO) continue;
for (uint ci_out = 0; ci_out < lengthof(i->produced_cargo_waiting); ci_out++) {
if (i->produced_cargo[ci_out] == CT_INVALID) continue;
if (i->produced_cargo[ci_out] == INVALID_CARGO) continue;
i->produced_cargo_waiting[ci_out] = ClampTo<uint16_t>(i->produced_cargo_waiting[ci_out] + (cargo_waiting * indspec->input_cargo_multiplier[ci_in][ci_out] / 256));
}
@ -1783,7 +1783,7 @@ static void HandleStationRefit(Vehicle *v, CargoArray &consist_capleft, Station
/* Remove old capacity from consist capacity and collect refit mask. */
IterateVehicleParts(v_start, PrepareRefitAction(consist_capleft, refit_mask));
bool is_auto_refit = new_cid == CT_AUTO_REFIT;
bool is_auto_refit = new_cid == CARGO_AUTO_REFIT;
bool check_order = (v->First()->current_order.GetLoadType() == OLFB_CARGO_TYPE_LOAD);
if (is_auto_refit) {
/* Get a refittable cargo type with waiting cargo for next_station or INVALID_STATION. */
@ -1979,7 +1979,7 @@ static void LoadUnloadVehicle(Vehicle *front)
CargoStationIDStackSet next_station = front->GetNextStoppingStation();
bool use_autorefit = front->current_order.IsRefit() && front->current_order.GetRefitCargo() == CT_AUTO_REFIT;
bool use_autorefit = front->current_order.IsRefit() && front->current_order.GetRefitCargo() == CARGO_AUTO_REFIT;
CargoArray consist_capleft{};
bool should_reserve_consist = false;
bool reserve_consist_cargo_type_loading = false;

@ -83,8 +83,8 @@ Engine::Engine(VehicleType type, EngineID base)
this->info.base_life = 0xFF;
/* Set road vehicle tractive effort to the default value */
if (type == VEH_ROAD) this->u.road.tractive_effort = 0x4C;
/* Aircraft must have CT_INVALID as default, as there is no property */
if (type == VEH_AIRCRAFT) this->info.cargo_type = CT_INVALID;
/* Aircraft must have INVALID_CARGO as default, as there is no property */
if (type == VEH_AIRCRAFT) this->info.cargo_type = INVALID_CARGO;
/* Set visual effect to the default value */
switch (type) {
case VEH_TRAIN: this->u.rail.visual_effect = VE_DEFAULT; break;
@ -183,7 +183,7 @@ bool Engine::CanCarryCargo() const
default: NOT_REACHED();
}
return this->GetDefaultCargoType() != CT_INVALID;
return this->GetDefaultCargoType() != INVALID_CARGO;
}
bool Engine::CanPossiblyCarryCargo() const
@ -1364,7 +1364,7 @@ bool IsEngineRefittable(EngineID engine)
CargoID default_cargo = e->GetDefaultCargoType();
CargoTypes default_cargo_mask = 0;
SetBit(default_cargo_mask, default_cargo);
return default_cargo != CT_INVALID && ei->refit_mask != default_cargo_mask;
return default_cargo != INVALID_CARGO && ei->refit_mask != default_cargo_mask;
}
/**

@ -102,7 +102,7 @@ struct Engine : EnginePool::PoolItem<&_engine_pool> {
* Usually a valid cargo is returned, even though the vehicle has zero capacity, and can therefore not carry anything. But the cargotype is still used
* for livery selection etc..
*
* Vehicles with CT_INVALID as default cargo are usually not available, but it can appear as default cargo of articulated parts.
* Vehicles with INVALID_CARGO as default cargo are usually not available, but it can appear as default cargo of articulated parts.
*
* @return The default cargo type.
* @see CanCarryCargo

@ -172,7 +172,7 @@ static StringID GetEngineInfoCapacityString(EngineID engine)
CargoArray cap = GetCapacityOfArticulatedParts(engine);
if (cap.GetSum<uint>() == 0) {
/* no cargo at all */
auto tmp_params = MakeParameters(CT_INVALID, 0);
auto tmp_params = MakeParameters(INVALID_CARGO, 0);
_temp_special_strings[1] = GetStringWithArgs(STR_JUST_CARGO, tmp_params);
} else {
std::string buffer;

@ -1009,7 +1009,8 @@ public:
std::string name = GenerateAutoNameForVehicleGroup(v);
DoCommandP(0, VehicleListIdentifier(_ctrl_pressed ? VL_SHARED_ORDERS : VL_SINGLE_VEH, v->type, v->owner, v->index).Pack(), CF_ANY, CMD_CREATE_GROUP_FROM_LIST | CMD_MSG(STR_ERROR_GROUP_CAN_T_CREATE), nullptr, name.c_str());
DoCommandP(0, VehicleListIdentifier(_ctrl_pressed ? VL_SHARED_ORDERS : VL_SINGLE_VEH, v->type, v->owner, v->index).Pack(),
CargoFilterCriteria::CF_ANY, CMD_CREATE_GROUP_FROM_LIST | CMD_MSG(STR_ERROR_GROUP_CAN_T_CREATE), nullptr, name.c_str());
break;
}

@ -118,7 +118,7 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> {
inline int GetCargoProducedIndex(CargoID cargo) const
{
if (cargo == CT_INVALID) return -1;
if (cargo == INVALID_CARGO) return -1;
auto pos = std::find(this->produced_cargo.begin(), this->produced_cargo.end(), cargo);
if (pos == this->produced_cargo.end()) return -1;
return pos - this->produced_cargo.begin();
@ -126,7 +126,7 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> {
inline int GetCargoAcceptedIndex(CargoID cargo) const
{
if (cargo == CT_INVALID) return -1;
if (cargo == INVALID_CARGO) return -1;
auto pos = std::find(this->accepts_cargo.begin(), this->accepts_cargo.end(), cargo);
if (pos == this->accepts_cargo.end()) return -1;
return pos - this->accepts_cargo.begin();

@ -424,7 +424,7 @@ static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, Ca
auto pos = std::find(std::begin(accepts_cargo), std::end(accepts_cargo), ind->accepts_cargo[i]);
if (pos == std::end(accepts_cargo)) {
/* Not found, insert */
pos = std::find(std::begin(accepts_cargo), std::end(accepts_cargo), CT_INVALID);
pos = std::find(std::begin(accepts_cargo), std::end(accepts_cargo), INVALID_CARGO);
if (pos == std::end(accepts_cargo)) continue; // nowhere to place, give up on this one
*pos = ind->accepts_cargo[i];
}
@ -436,7 +436,7 @@ static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, Ca
/* Try callback for accepts list, if success override all existing accepts */
uint16_t res = GetIndustryTileCallback(CBID_INDTILE_ACCEPT_CARGO, 0, 0, gfx, Industry::GetByTile(tile), tile);
if (res != CALLBACK_FAILED) {
accepts_cargo.fill(CT_INVALID);
accepts_cargo.fill(INVALID_CARGO);
for (uint i = 0; i < 3; i++) accepts_cargo[i] = GetCargoTranslation(GB(res, i * 5, 5), itspec->grf_prop.grffile);
}
}
@ -452,7 +452,7 @@ static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, Ca
for (byte i = 0; i < std::size(itspec->accepts_cargo); i++) {
CargoID a = accepts_cargo[i];
if (a == CT_INVALID || cargo_acceptance[i] <= 0) continue; // work only with valid cargoes
if (a == INVALID_CARGO || cargo_acceptance[i] <= 0) continue; // work only with valid cargoes
/* Add accepted cargo */
acceptance[a] += cargo_acceptance[i];
@ -526,7 +526,7 @@ static bool TransportIndustryGoods(TileIndex tile)
for (uint j = 0; j < lengthof(i->produced_cargo_waiting); j++) {
uint cw = std::min<uint>(i->produced_cargo_waiting[j], ScaleQuantity(255u, _settings_game.economy.industry_cargo_scale_factor));
if (cw > indspec->minimal_cargo && i->produced_cargo[j] != CT_INVALID) {
if (cw > indspec->minimal_cargo && i->produced_cargo[j] != INVALID_CARGO) {
i->produced_cargo_waiting[j] -= cw;
/* fluctuating economy? */
@ -1024,7 +1024,7 @@ bool IsTileForestIndustry(TileIndex tile)
/* Check for wood production */
for (uint i = 0; i < lengthof(ind->produced_cargo); i++) {
/* The industry produces wood. */
if (ind->produced_cargo[i] != CT_INVALID && CargoSpec::Get(ind->produced_cargo[i])->label == 'WOOD') return true;
if (ind->produced_cargo[i] != INVALID_CARGO && CargoSpec::Get(ind->produced_cargo[i])->label == 'WOOD') return true;
}
return false;
@ -1166,7 +1166,7 @@ static bool SearchLumberMillTrees(TileIndex tile, void *)
static void ChopLumberMillTrees(Industry *i)
{
/* Skip production if cargo slot is invalid. */
if (i->produced_cargo[0] == CT_INVALID) return;
if (i->produced_cargo[0] == INVALID_CARGO) return;
/* We only want to cut trees if all tiles are completed. */
for (TileIndex tile_cur : i->location) {
@ -1184,7 +1184,7 @@ static void ChopLumberMillTrees(Industry *i)
static void ProduceIndustryGoodsFromRate(Industry *i, bool scale)
{
for (size_t j = 0; j < lengthof(i->produced_cargo_waiting); j++) {
if (i->produced_cargo[j] == CT_INVALID) continue;
if (i->produced_cargo[j] == INVALID_CARGO) continue;
uint amount = i->production_rate[j];
if (amount != 0 && scale) {
amount = ScaleQuantity(amount, _settings_game.economy.industry_cargo_scale_factor);
@ -1908,7 +1908,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
if (HasBit(indspec->callback_mask, CBM_IND_INPUT_CARGO_TYPES)) {
/* Clear all input cargo types */
for (size_t j = 0; j < i->accepts_cargo.size(); j++) i->accepts_cargo[j] = CT_INVALID;
for (size_t j = 0; j < i->accepts_cargo.size(); j++) i->accepts_cargo[j] = INVALID_CARGO;
/* Query actual types */
uint maxcargoes = (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) ? lengthof(i->accepts_cargo) : 3;
for (uint j = 0; j < maxcargoes; j++) {
@ -1922,7 +1922,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
/* Industries without "unlimited" cargo types support depend on the specific order/slots of cargo types.
* They need to be able to blank out specific slots without aborting the callback sequence,
* and solve this by returning undefined cargo indexes. Skip these. */
if (cargo == CT_INVALID && !(indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED)) continue;
if (cargo == INVALID_CARGO && !(indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED)) continue;
/* Verify valid cargo */
if (std::find(indspec->accepts_cargo.begin(), indspec->accepts_cargo.end(), cargo) == indspec->accepts_cargo.end()) {
/* Cargo not in spec, error in NewGRF */
@ -1940,7 +1940,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
if (HasBit(indspec->callback_mask, CBM_IND_OUTPUT_CARGO_TYPES)) {
/* Clear all output cargo types */
for (size_t j = 0; j < i->produced_cargo.size(); j++) i->produced_cargo[j] = CT_INVALID;
for (size_t j = 0; j < i->produced_cargo.size(); j++) i->produced_cargo[j] = INVALID_CARGO;
/* Query actual types */
uint maxcargoes = (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) ? lengthof(i->produced_cargo) : 2;
for (uint j = 0; j < maxcargoes; j++) {
@ -1952,7 +1952,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
}
CargoID cargo = GetCargoTranslation(GB(res, 0, 8), indspec->grf_prop.grffile);
/* Allow older GRFs to skip slots. */
if (cargo == CT_INVALID && !(indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED)) continue;
if (cargo == INVALID_CARGO && !(indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED)) continue;
/* Verify valid cargo */
if (std::find(indspec->produced_cargo.begin(), indspec->produced_cargo.end(), cargo) == indspec->produced_cargo.end()) {
/* Cargo not in spec, error in NewGRF */
@ -2562,7 +2562,7 @@ void GenerateIndustries()
static void UpdateIndustryStatistics(Industry *i)
{
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] != CT_INVALID) {
if (i->produced_cargo[j] != INVALID_CARGO) {
byte pct = 0;
if (i->this_month_production[j] != 0) {
i->last_prod_year = _cur_year;
@ -2761,7 +2761,7 @@ static bool CheckIndustryCloseDownProtection(IndustryType type)
*/
static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accepts, bool *c_produces)
{
if (cargo == CT_INVALID) return;
if (cargo == INVALID_CARGO) return;
/* Check for acceptance of cargo */
if (ind->IsCargoAccepted(cargo) && !IndustryTemporarilyRefusesCargo(ind, cargo)) *c_accepts = true;
@ -2929,7 +2929,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
} else if (_settings_game.economy.type == ET_SMOOTH) {
closeit = !(i->ctlflags & (INDCTL_NO_CLOSURE | INDCTL_NO_PRODUCTION_DECREASE));
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == CT_INVALID) continue;
if (i->produced_cargo[j] == INVALID_CARGO) continue;
uint32_t r = Random();
int old_prod, new_prod, percent;
/* If over 60% is transported, mult is 1, else mult is -1. */

@ -166,7 +166,7 @@ enum CargoSuffixInOut {
* @param ind the industry (nullptr if in fund window)
* @param ind_type the industry type
* @param indspec the industry spec
* @param cargoes array with cargotypes. for CT_INVALID no suffix will be determined
* @param cargoes array with cargotypes. for INVALID_CARGO no suffix will be determined
* @param suffixes is filled with the suffixes
*/
template <typename TC, typename TS>
@ -177,7 +177,7 @@ static inline void GetAllCargoSuffixes(CargoSuffixInOut use_input, CargoSuffixTy
if (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) {
/* Reworked behaviour with new many-in-many-out scheme */
for (uint j = 0; j < lengthof(suffixes); j++) {
if (cargoes[j] != CT_INVALID) {
if (cargoes[j] != INVALID_CARGO) {
byte local_id = indspec->grf_prop.grffile->cargo_map[cargoes[j]]; // should we check the value for valid?
uint cargotype = local_id << 16 | use_input;
GetCargoSuffix(cargotype, cst, ind, ind_type, indspec, suffixes[j]);
@ -194,13 +194,13 @@ static inline void GetAllCargoSuffixes(CargoSuffixInOut use_input, CargoSuffixTy
}
switch (use_input) {
case CARGOSUFFIX_OUT:
if (cargoes[0] != CT_INVALID) GetCargoSuffix(3, cst, ind, ind_type, indspec, suffixes[0]);
if (cargoes[1] != CT_INVALID) GetCargoSuffix(4, cst, ind, ind_type, indspec, suffixes[1]);
if (cargoes[0] != INVALID_CARGO) GetCargoSuffix(3, cst, ind, ind_type, indspec, suffixes[0]);
if (cargoes[1] != INVALID_CARGO) GetCargoSuffix(4, cst, ind, ind_type, indspec, suffixes[1]);
break;
case CARGOSUFFIX_IN:
if (cargoes[0] != CT_INVALID) GetCargoSuffix(0, cst, ind, ind_type, indspec, suffixes[0]);
if (cargoes[1] != CT_INVALID) GetCargoSuffix(1, cst, ind, ind_type, indspec, suffixes[1]);
if (cargoes[2] != CT_INVALID) GetCargoSuffix(2, cst, ind, ind_type, indspec, suffixes[2]);
if (cargoes[0] != INVALID_CARGO) GetCargoSuffix(0, cst, ind, ind_type, indspec, suffixes[0]);
if (cargoes[1] != INVALID_CARGO) GetCargoSuffix(1, cst, ind, ind_type, indspec, suffixes[1]);
if (cargoes[2] != INVALID_CARGO) GetCargoSuffix(2, cst, ind, ind_type, indspec, suffixes[2]);
break;
default:
NOT_REACHED();
@ -366,7 +366,7 @@ class BuildIndustryWindow : public Window {
size_t j = 0;
for (; j < cargolistlen; j++) {
if (cargolist[j] == CT_INVALID) continue;
if (cargolist[j] == INVALID_CARGO) continue;
if (firstcargo == cargolistlen) {
firstcargo = j;
j++;
@ -385,7 +385,7 @@ class BuildIndustryWindow : public Window {
}
for (; j < cargolistlen; j++) {
if (cargolist[j] == CT_INVALID) continue;
if (cargolist[j] == INVALID_CARGO) continue;
SetDParam(0, CargoSpec::Get(cargolist[j])->name);
SetDParamStr(1, cargo_suffix[j].text);
GetString(StringBuilder(cargostring), STR_INDUSTRY_VIEW_CARGO_LIST_EXTENSION);
@ -868,7 +868,7 @@ public:
bool stockpiling = HasBit(ind->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_mask, CBM_IND_PRODUCTION_256_TICKS);
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
if (i->accepts_cargo[j] == CT_INVALID) continue;
if (i->accepts_cargo[j] == INVALID_CARGO) continue;
has_accept = true;
if (first) {
DrawString(ir, STR_INDUSTRY_VIEW_REQUIRES);
@ -908,7 +908,7 @@ public:
int button_y_offset = (line_height - SETTING_BUTTON_HEIGHT) / 2;
first = true;
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == CT_INVALID) continue;
if (i->produced_cargo[j] == INVALID_CARGO) continue;
if (first) {
if (has_accept) ir.top += WidgetDimensions::scaled.vsep_wide;
DrawString(ir, STR_INDUSTRY_VIEW_PRODUCTION_LAST_MONTH_TITLE);
@ -1004,7 +1004,7 @@ public:
if (pt.y >= this->production_offset_y) {
int row = (pt.y - this->production_offset_y) / this->cheat_line_height;
for (uint j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == CT_INVALID) continue;
if (i->produced_cargo[j] == INVALID_CARGO) continue;
row--;
if (row < 0) {
line = (InfoLine)(IL_RATE1 + j);
@ -1163,7 +1163,7 @@ static void UpdateIndustryProduction(Industry *i)
if (indspec->UsesOriginalEconomy()) i->RecomputeProductionMultipliers();
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] != CT_INVALID) {
if (i->produced_cargo[j] != INVALID_CARGO) {
i->last_month_production[j] = ScaleQuantity(8 * i->production_rate[j], _settings_game.economy.industry_cargo_scale_factor);
}
}
@ -1240,12 +1240,6 @@ static const NWidgetPart _nested_industry_directory_widgets[] = {
typedef GUIList<const Industry *, const CargoID &, const std::pair<CargoID, CargoID> &> GUIIndustryList;
/** Special cargo filter criteria */
enum CargoFilterSpecialType {
CF_ANY = CT_NO_REFIT, ///< Show all industries (i.e. no filtering)
CF_NONE = CT_INVALID, ///< Show only industries which do not produce/accept cargo
};
/** Cargo filter functions */
/**
* Check whether an industry accepts and produces a certain cargo pair.
@ -1261,11 +1255,11 @@ static bool CargoFilter(const Industry * const *industry, const std::pair<CargoI
bool accepted_cargo_matches;
switch (accepted_cargo) {
case CF_ANY:
case CargoFilterCriteria::CF_ANY:
accepted_cargo_matches = true;
break;
case CF_NONE:
case CargoFilterCriteria::CF_NONE:
accepted_cargo_matches = !(*industry)->IsCargoAccepted();
break;
@ -1277,11 +1271,11 @@ static bool CargoFilter(const Industry * const *industry, const std::pair<CargoI
bool produced_cargo_matches;
switch (produced_cargo) {
case CF_ANY:
case CargoFilterCriteria::CF_ANY:
produced_cargo_matches = true;
break;
case CF_NONE:
case CargoFilterCriteria::CF_NONE:
produced_cargo_matches = !(*industry)->IsCargoProduced();
break;
@ -1339,7 +1333,7 @@ protected:
if (this->produced_cargo_filter_criteria != cid) {
this->produced_cargo_filter_criteria = cid;
/* deactivate filter if criteria is 'Show All', activate it otherwise */
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CF_ANY || this->accepted_cargo_filter_criteria != CF_ANY;
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CargoFilterCriteria::CF_ANY || this->accepted_cargo_filter_criteria != CargoFilterCriteria::CF_ANY;
this->industries.SetFilterState(is_filtering_necessary);
this->industries.SetFilterType(0);
@ -1356,7 +1350,7 @@ protected:
if (this->accepted_cargo_filter_criteria != cid) {
this->accepted_cargo_filter_criteria = cid;
/* deactivate filter if criteria is 'Show All', activate it otherwise */
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CF_ANY || this->accepted_cargo_filter_criteria != CF_ANY;
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CargoFilterCriteria::CF_ANY || this->accepted_cargo_filter_criteria != CargoFilterCriteria::CF_ANY;
this->industries.SetFilterState(is_filtering_necessary);
this->industries.SetFilterType(0);
@ -1367,8 +1361,8 @@ protected:
StringID GetCargoFilterLabel(CargoID cid) const
{
switch (cid) {
case CF_ANY: return STR_INDUSTRY_DIRECTORY_FILTER_ALL_TYPES;
case CF_NONE: return STR_INDUSTRY_DIRECTORY_FILTER_NONE;
case CargoFilterCriteria::CF_ANY: return STR_INDUSTRY_DIRECTORY_FILTER_ALL_TYPES;
case CargoFilterCriteria::CF_NONE: return STR_INDUSTRY_DIRECTORY_FILTER_NONE;
default: return CargoSpec::Get(cid)->name;
}
}
@ -1378,12 +1372,12 @@ protected:
*/
void SetCargoFilterArray()
{
this->produced_cargo_filter_criteria = CF_ANY;
this->accepted_cargo_filter_criteria = CF_ANY;
this->produced_cargo_filter_criteria = CargoFilterCriteria::CF_ANY;
this->accepted_cargo_filter_criteria = CargoFilterCriteria::CF_ANY;
this->industries.SetFilterFuncs(_filter_funcs);
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CF_ANY || this->accepted_cargo_filter_criteria != CF_ANY;
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CargoFilterCriteria::CF_ANY || this->accepted_cargo_filter_criteria != CargoFilterCriteria::CF_ANY;
this->industries.SetFilterState(is_filtering_necessary);
}
@ -1445,7 +1439,7 @@ protected:
{
assert(id < lengthof(i->produced_cargo));
if (i->produced_cargo[id] == CT_INVALID) return -1;
if (i->produced_cargo[id] == INVALID_CARGO) return -1;
return ToPercent8(i->last_month_pct_transported[id]);
}
@ -1459,11 +1453,11 @@ protected:
static int GetCargoTransportedSortValue(const Industry *i)
{
CargoID filter = IndustryDirectoryWindow::produced_cargo_filter;
if (filter == CF_NONE) return 0;
if (filter == CargoFilterCriteria::CF_NONE) return 0;
int percentage = 0, produced_cargo_count = 0;
for (uint id = 0; id < lengthof(i->produced_cargo); id++) {
if (filter == CF_ANY) {
if (filter == CargoFilterCriteria::CF_ANY) {
int transported = GetCargoTransportedPercentsIfValid(i, id);
if (transported != -1) {
produced_cargo_count++;
@ -1503,13 +1497,13 @@ protected:
/** Sort industries by production and name */
static bool IndustryProductionSorter(const Industry * const &a, const Industry * const &b, const CargoID &filter)
{
if (filter == CF_NONE) return IndustryTypeSorter(a, b, filter);
if (filter == CargoFilterCriteria::CF_NONE) return IndustryTypeSorter(a, b, filter);
uint prod_a = 0, prod_b = 0;
for (uint i = 0; i < lengthof(a->produced_cargo); i++) {
if (filter == CF_ANY) {
if (a->produced_cargo[i] != CT_INVALID) prod_a += a->last_month_production[i];
if (b->produced_cargo[i] != CT_INVALID) prod_b += b->last_month_production[i];
if (filter == CargoFilterCriteria::CF_ANY) {
if (a->produced_cargo[i] != INVALID_CARGO) prod_a += a->last_month_production[i];
if (b->produced_cargo[i] != INVALID_CARGO) prod_b += b->last_month_production[i];
} else {
if (a->produced_cargo[i] == filter) prod_a += a->last_month_production[i];
if (b->produced_cargo[i] == filter) prod_b += b->last_month_production[i];
@ -1553,7 +1547,7 @@ protected:
std::vector<CargoInfo> cargos;
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == CT_INVALID) continue;
if (i->produced_cargo[j] == INVALID_CARGO) continue;
cargos.push_back({ i->produced_cargo[j], i->last_month_production[j], cargo_suffix[j].text.c_str(), ToPercent8(i->last_month_pct_transported[j]) });
}
@ -1580,7 +1574,7 @@ protected:
/* If the produced cargo filter is active then move the filtered cargo to the beginning of the list,
* because this is the one the player interested in, and that way it is not hidden in the 'n' more cargos */
const CargoID cid = this->produced_cargo_filter_criteria;
if (cid != CF_ANY && cid != CF_NONE) {
if (cid != CargoFilterCriteria::CF_ANY && cid != CargoFilterCriteria::CF_NONE) {
auto filtered_ci = std::find_if(cargos.begin(), cargos.end(), [cid](const CargoInfo &ci) -> bool {
return ci.cargo_id == cid;
});
@ -1689,7 +1683,7 @@ public:
const CargoID acf_cid = this->accepted_cargo_filter_criteria;
for (uint i = this->vscroll->GetPosition(); i < this->industries.size(); i++) {
TextColour tc = TC_FROMSTRING;
if (acf_cid != CF_ANY && acf_cid != CF_NONE) {
if (acf_cid != CargoFilterCriteria::CF_ANY && acf_cid != CargoFilterCriteria::CF_NONE) {
Industry *ind = const_cast<Industry *>(this->industries[i]);
if (IndustryTemporarilyRefusesCargo(ind, acf_cid)) {
tc = TC_GREY | TC_FORCED;
@ -1744,9 +1738,9 @@ public:
DropDownList list;
/* Add item for disabling filtering. */
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_ANY), CF_ANY, false));
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CargoFilterCriteria::CF_ANY), CargoFilterCriteria::CF_ANY, false));
/* Add item for industries not producing anything, e.g. power plants */
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_NONE), CF_NONE, false));
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CargoFilterCriteria::CF_NONE), CargoFilterCriteria::CF_NONE, false));
/* Add cargos */
Dimension d = GetLargestCargoIconSize();
@ -1906,7 +1900,7 @@ const StringID IndustryDirectoryWindow::sorter_names[] = {
INVALID_STRING_ID
};
CargoID IndustryDirectoryWindow::produced_cargo_filter = CF_ANY;
CargoID IndustryDirectoryWindow::produced_cargo_filter = CargoFilterCriteria::CF_ANY;
/** Window definition of the industry directory gui */
@ -2000,15 +1994,15 @@ struct CargoesField {
CargoID other_accepted[MAX_CARGOES]; ///< Cargoes accepted but not used in this figure.
} industry; ///< Industry data (for #CFT_INDUSTRY).
struct {
CargoID vertical_cargoes[MAX_CARGOES]; ///< Cargoes running from top to bottom (cargo ID or #CT_INVALID).
CargoID vertical_cargoes[MAX_CARGOES]; ///< Cargoes running from top to bottom (cargo ID or #INVALID_CARGO).
uint8_t num_cargoes; ///< Number of cargoes.
CargoID supp_cargoes[MAX_CARGOES]; ///< Cargoes entering from the left (index in #vertical_cargoes, or #CT_INVALID).
CargoID supp_cargoes[MAX_CARGOES]; ///< Cargoes entering from the left (index in #vertical_cargoes, or #INVALID_CARGO).
uint8_t top_end; ///< Stop at the top of the vertical cargoes.
CargoID cust_cargoes[MAX_CARGOES]; ///< Cargoes leaving to the right (index in #vertical_cargoes, or #CT_INVALID).
CargoID cust_cargoes[MAX_CARGOES]; ///< Cargoes leaving to the right (index in #vertical_cargoes, or #INVALID_CARGO).
uint8_t bottom_end; ///< Stop at the bottom of the vertical cargoes.
} cargo; ///< Cargo data (for #CFT_CARGO).
struct {
CargoID cargoes[MAX_CARGOES]; ///< Cargoes to display (or #CT_INVALID).
CargoID cargoes[MAX_CARGOES]; ///< Cargoes to display (or #INVALID_CARGO).
bool left_align; ///< Align all cargo texts to the left (else align to the right).
} cargo_label; ///< Label data (for #CFT_CARGO_LABEL).
StringID header; ///< Header text (for #CFT_HEADER).
@ -2032,8 +2026,8 @@ struct CargoesField {
{
this->type = CFT_INDUSTRY;
this->u.industry.ind_type = ind_type;
std::fill(std::begin(this->u.industry.other_accepted), std::end(this->u.industry.other_accepted), CT_INVALID);
std::fill(std::begin(this->u.industry.other_produced), std::end(this->u.industry.other_produced), CT_INVALID);
std::fill(std::begin(this->u.industry.other_accepted), std::end(this->u.industry.other_accepted), INVALID_CARGO);
std::fill(std::begin(this->u.industry.other_produced), std::end(this->u.industry.other_produced), INVALID_CARGO);
}
/**
@ -2045,7 +2039,7 @@ struct CargoesField {
int ConnectCargo(CargoID cargo, bool producer)
{
assert(this->type == CFT_CARGO);
if (cargo == CT_INVALID) return -1;
if (cargo == INVALID_CARGO) return -1;
/* Find the vertical cargo column carrying the cargo. */
int column = -1;
@ -2058,10 +2052,10 @@ struct CargoesField {
if (column < 0) return -1;
if (producer) {
assert(this->u.cargo.supp_cargoes[column] == CT_INVALID);
assert(this->u.cargo.supp_cargoes[column] == INVALID_CARGO);
this->u.cargo.supp_cargoes[column] = column;
} else {
assert(this->u.cargo.cust_cargoes[column] == CT_INVALID);
assert(this->u.cargo.cust_cargoes[column] == INVALID_CARGO);
this->u.cargo.cust_cargoes[column] = column;
}
return column;
@ -2076,15 +2070,15 @@ struct CargoesField {
assert(this->type == CFT_CARGO);
for (uint i = 0; i < MAX_CARGOES; i++) {
if (this->u.cargo.supp_cargoes[i] != CT_INVALID) return true;
if (this->u.cargo.cust_cargoes[i] != CT_INVALID) return true;
if (this->u.cargo.supp_cargoes[i] != INVALID_CARGO) return true;
if (this->u.cargo.cust_cargoes[i] != INVALID_CARGO) return true;
}
return false;
}
/**
* Make a piece of cargo column.
* @param cargoes Array of #CargoID (may contain #CT_INVALID).
* @param cargoes Array of #CargoID (may contain #INVALID_CARGO).
* @param length Number of cargoes in \a cargoes.
* @param count Number of cargoes to display (should be at least the number of valid cargoes, or \c -1 to let the method compute it).
* @param top_end This is the first cargo field of this column.
@ -2096,7 +2090,7 @@ struct CargoesField {
this->type = CFT_CARGO;
auto insert = std::begin(this->u.cargo.vertical_cargoes);
for (size_t i = 0; insert != std::end(this->u.cargo.vertical_cargoes) && i < length; i++) {
if (cargoes[i] != CT_INVALID) {
if (cargoes[i] != INVALID_CARGO) {
*insert = cargoes[i];
++insert;
}
@ -2104,16 +2098,16 @@ struct CargoesField {
this->u.cargo.num_cargoes = (count < 0) ? static_cast<uint8_t>(insert - std::begin(this->u.cargo.vertical_cargoes)) : count;
CargoIDComparator comparator;
std::sort(std::begin(this->u.cargo.vertical_cargoes), insert, comparator);
std::fill(insert, std::end(this->u.cargo.vertical_cargoes), CT_INVALID);
std::fill(insert, std::end(this->u.cargo.vertical_cargoes), INVALID_CARGO);
this->u.cargo.top_end = top_end;
this->u.cargo.bottom_end = bottom_end;
std::fill(std::begin(this->u.cargo.supp_cargoes), std::end(this->u.cargo.supp_cargoes), CT_INVALID);
std::fill(std::begin(this->u.cargo.cust_cargoes), std::end(this->u.cargo.cust_cargoes), CT_INVALID);
std::fill(std::begin(this->u.cargo.supp_cargoes), std::end(this->u.cargo.supp_cargoes), INVALID_CARGO);
std::fill(std::begin(this->u.cargo.cust_cargoes), std::end(this->u.cargo.cust_cargoes), INVALID_CARGO);
}
/**
* Make a field displaying cargo type names.
* @param cargoes Array of #CargoID (may contain #CT_INVALID).
* @param cargoes Array of #CargoID (may contain #INVALID_CARGO).
* @param length Number of cargoes in \a cargoes.
* @param left_align ALign texts to the left (else to the right).
*/
@ -2122,7 +2116,7 @@ struct CargoesField {
this->type = CFT_CARGO_LABEL;
uint i;
for (i = 0; i < MAX_CARGOES && i < length; i++) this->u.cargo_label.cargoes[i] = cargoes[i];
for (; i < MAX_CARGOES; i++) this->u.cargo_label.cargoes[i] = CT_INVALID;
for (; i < MAX_CARGOES; i++) this->u.cargo_label.cargoes[i] = INVALID_CARGO;
this->u.cargo_label.left_align = left_align;
}
@ -2202,13 +2196,13 @@ struct CargoesField {
}
ypos1 += CargoesField::cargo_border.height + (GetCharacterHeight(FS_NORMAL) - CargoesField::cargo_line.height) / 2;
for (uint i = 0; i < CargoesField::max_cargoes; i++) {
if (other_right[i] != CT_INVALID) {
if (other_right[i] != INVALID_CARGO) {
const CargoSpec *csp = CargoSpec::Get(other_right[i]);
int xp = xpos + industry_width + CargoesField::cargo_stub.width;
DrawHorConnection(xpos + industry_width, xp - 1, ypos1, csp);
GfxDrawLine(xp, ypos1, xp, ypos1 + CargoesField::cargo_line.height - 1, CARGO_LINE_COLOUR);
}
if (other_left[i] != CT_INVALID) {
if (other_left[i] != INVALID_CARGO) {
const CargoSpec *csp = CargoSpec::Get(other_left[i]);
int xp = xpos - CargoesField::cargo_stub.width;
DrawHorConnection(xp + 1, xpos - 1, ypos1, csp);
@ -2246,7 +2240,7 @@ struct CargoesField {
}
ypos += CargoesField::cargo_border.height + vert_inter_industry_space / 2 + (GetCharacterHeight(FS_NORMAL) - CargoesField::cargo_line.height) / 2;
for (uint i = 0; i < MAX_CARGOES; i++) {
if (hor_left[i] != CT_INVALID) {
if (hor_left[i] != INVALID_CARGO) {
int col = hor_left[i];
int dx = 0;
const CargoSpec *csp = CargoSpec::Get(this->u.cargo.vertical_cargoes[col]);
@ -2257,7 +2251,7 @@ struct CargoesField {
}
DrawHorConnection(xpos, cargo_base - dx, ypos, csp);
}
if (hor_right[i] != CT_INVALID) {
if (hor_right[i] != INVALID_CARGO) {
int col = hor_right[i];
int dx = 0;
const CargoSpec *csp = CargoSpec::Get(this->u.cargo.vertical_cargoes[col]);
@ -2276,7 +2270,7 @@ struct CargoesField {
case CFT_CARGO_LABEL:
ypos += CargoesField::cargo_border.height + vert_inter_industry_space / 2;
for (uint i = 0; i < MAX_CARGOES; i++) {
if (this->u.cargo_label.cargoes[i] != CT_INVALID) {
if (this->u.cargo_label.cargoes[i] != INVALID_CARGO) {
const CargoSpec *csp = CargoSpec::Get(this->u.cargo_label.cargoes[i]);
DrawString(xpos + WidgetDimensions::scaled.framerect.left, xpos + industry_width - 1 - WidgetDimensions::scaled.framerect.right, ypos, csp->name, TC_WHITE,
(this->u.cargo_label.left_align) ? SA_LEFT : SA_RIGHT);
@ -2295,7 +2289,7 @@ struct CargoesField {
* @param left Left industry neighbour if available (else \c nullptr should be supplied).
* @param right Right industry neighbour if available (else \c nullptr should be supplied).
* @param pt Click position in the cargo field.
* @return Cargo clicked at, or #CT_INVALID if none.
* @return Cargo clicked at, or #INVALID_CARGO if none.
*/
CargoID CargoClickedAt(const CargoesField *left, const CargoesField *right, Point pt) const
{
@ -2314,50 +2308,50 @@ struct CargoesField {
int vpos = vert_inter_industry_space / 2 + CargoesField::cargo_border.width;
uint row;
for (row = 0; row < MAX_CARGOES; row++) {
if (pt.y < vpos) return CT_INVALID;
if (pt.y < vpos) return INVALID_CARGO;
if (pt.y < vpos + GetCharacterHeight(FS_NORMAL)) break;
vpos += GetCharacterHeight(FS_NORMAL) + CargoesField::cargo_space.width;
}
if (row == MAX_CARGOES) return CT_INVALID;
if (row == MAX_CARGOES) return INVALID_CARGO;
/* row = 0 -> at first horizontal row, row = 1 -> second horizontal row, 2 = 3rd horizontal row. */
if (col == 0) {
if (this->u.cargo.supp_cargoes[row] != CT_INVALID) return this->u.cargo.vertical_cargoes[this->u.cargo.supp_cargoes[row]];
if (this->u.cargo.supp_cargoes[row] != INVALID_CARGO) return this->u.cargo.vertical_cargoes[this->u.cargo.supp_cargoes[row]];
if (left != nullptr) {
if (left->type == CFT_INDUSTRY) return left->u.industry.other_produced[row];
if (left->type == CFT_CARGO_LABEL && !left->u.cargo_label.left_align) return left->u.cargo_label.cargoes[row];
}
return CT_INVALID;
return INVALID_CARGO;
}
if (col == this->u.cargo.num_cargoes) {
if (this->u.cargo.cust_cargoes[row] != CT_INVALID) return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]];
if (this->u.cargo.cust_cargoes[row] != INVALID_CARGO) return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]];
if (right != nullptr) {
if (right->type == CFT_INDUSTRY) return right->u.industry.other_accepted[row];
if (right->type == CFT_CARGO_LABEL && right->u.cargo_label.left_align) return right->u.cargo_label.cargoes[row];
}
return CT_INVALID;
return INVALID_CARGO;
}
if (row >= col) {
/* Clicked somewhere in-between vertical cargo connection.
* Since the horizontal connection is made in the same order as the vertical list, the above condition
* ensures we are left-below the main diagonal, thus at the supplying side.
*/
if (this->u.cargo.supp_cargoes[row] == CT_INVALID) return CT_INVALID;
if (this->u.cargo.supp_cargoes[row] == INVALID_CARGO) return INVALID_CARGO;
return this->u.cargo.vertical_cargoes[this->u.cargo.supp_cargoes[row]];
} else {
/* Clicked at a customer connection. */
if (this->u.cargo.cust_cargoes[row] == CT_INVALID) return CT_INVALID;
if (this->u.cargo.cust_cargoes[row] == INVALID_CARGO) return INVALID_CARGO;
return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]];
}
/* Clicked at a customer connection. */
if (IsValidCargoID(this->u.cargo.cust_cargoes[row])) return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]];
return CT_INVALID;
return INVALID_CARGO;
}
/**
* Decide what cargo the user clicked in the cargo label field.
* @param pt Click position in the cargo label field.
* @return Cargo clicked at, or #CT_INVALID if none.
* @return Cargo clicked at, or #INVALID_CARGO if none.
*/
CargoID CargoLabelClickedAt(Point pt) const
{
@ -2366,11 +2360,11 @@ struct CargoesField {
int vpos = vert_inter_industry_space / 2 + CargoesField::cargo_border.height;
uint row;
for (row = 0; row < MAX_CARGOES; row++) {
if (pt.y < vpos) return CT_INVALID;
if (pt.y < vpos) return INVALID_CARGO;
if (pt.y < vpos + GetCharacterHeight(FS_NORMAL)) break;
vpos += GetCharacterHeight(FS_NORMAL) + CargoesField::cargo_space.height;
}
if (row == MAX_CARGOES) return CT_INVALID;
if (row == MAX_CARGOES) return INVALID_CARGO;
return this->u.cargo_label.cargoes[row];
}
@ -2425,7 +2419,7 @@ struct CargoesRow {
CargoesField *cargo_fld = this->columns + column + 1;
assert(ind_fld->type == CFT_INDUSTRY && cargo_fld->type == CFT_CARGO);
std::fill(std::begin(ind_fld->u.industry.other_produced), std::end(ind_fld->u.industry.other_produced), CT_INVALID);
std::fill(std::begin(ind_fld->u.industry.other_produced), std::end(ind_fld->u.industry.other_produced), INVALID_CARGO);
if (ind_fld->u.industry.ind_type < NUM_INDUSTRYTYPES) {
CargoID others[MAX_CARGOES]; // Produced cargoes not carried in the cargo column.
@ -2440,7 +2434,7 @@ struct CargoesRow {
/* Allocate other cargoes in the empty holes of the horizontal cargo connections. */
for (uint i = 0; i < CargoesField::max_cargoes && other_count > 0; i++) {
if (cargo_fld->u.cargo.supp_cargoes[i] == CT_INVALID) ind_fld->u.industry.other_produced[i] = others[--other_count];
if (cargo_fld->u.cargo.supp_cargoes[i] == INVALID_CARGO) ind_fld->u.industry.other_produced[i] = others[--other_count];
}
} else {
/* Houses only display what is demanded. */
@ -2459,7 +2453,7 @@ struct CargoesRow {
void MakeCargoLabel(int column, bool accepting)
{
CargoID cargoes[MAX_CARGOES];
std::fill(std::begin(cargoes), std::end(cargoes), CT_INVALID);
std::fill(std::begin(cargoes), std::end(cargoes), INVALID_CARGO);
CargoesField *label_fld = this->columns + column;
CargoesField *cargo_fld = this->columns + (accepting ? column - 1 : column + 1);
@ -2483,7 +2477,7 @@ struct CargoesRow {
CargoesField *cargo_fld = this->columns + column - 1;
assert(ind_fld->type == CFT_INDUSTRY && cargo_fld->type == CFT_CARGO);
std::fill(std::begin(ind_fld->u.industry.other_accepted), std::end(ind_fld->u.industry.other_accepted), CT_INVALID);
std::fill(std::begin(ind_fld->u.industry.other_accepted), std::end(ind_fld->u.industry.other_accepted), INVALID_CARGO);
if (ind_fld->u.industry.ind_type < NUM_INDUSTRYTYPES) {
CargoID others[MAX_CARGOES]; // Accepted cargoes not carried in the cargo column.
@ -2498,7 +2492,7 @@ struct CargoesRow {
/* Allocate other cargoes in the empty holes of the horizontal cargo connections. */
for (uint i = 0; i < CargoesField::max_cargoes && other_count > 0; i++) {
if (cargo_fld->u.cargo.cust_cargoes[i] == CT_INVALID) ind_fld->u.industry.other_accepted[i] = others[--other_count];
if (cargo_fld->u.cargo.cust_cargoes[i] == INVALID_CARGO) ind_fld->u.industry.other_accepted[i] = others[--other_count];
}
} else {
/* Houses only display what is demanded. */
@ -2680,7 +2674,7 @@ struct IndustryCargoesWindow : public Window {
static bool HasCommonValidCargo(const CargoID *cargoes1, size_t length1, const CargoID *cargoes2, size_t length2)
{
while (length1 > 0) {
if (*cargoes1 != CT_INVALID) {
if (*cargoes1 != INVALID_CARGO) {
for (size_t i = 0; i < length2; i++) if (*cargoes1 == cargoes2[i]) return true;
}
cargoes1++;
@ -2698,7 +2692,7 @@ struct IndustryCargoesWindow : public Window {
static bool HousesCanSupply(const CargoID *cargoes, size_t length)
{
for (size_t i = 0; i < length; i++) {
if (cargoes[i] == CT_INVALID) continue;
if (cargoes[i] == INVALID_CARGO) continue;
if (cargoes[i] == CT_PASSENGERS || cargoes[i] == CT_MAIL) return true;
}
return false;
@ -2721,7 +2715,7 @@ struct IndustryCargoesWindow : public Window {
default: NOT_REACHED();
}
for (size_t i = 0; i < length; i++) {
if (cargoes[i] == CT_INVALID) continue;
if (cargoes[i] == INVALID_CARGO) continue;
for (uint h = 0; h < NUM_HOUSES; h++) {
HouseSpec *hs = HouseSpec::Get(h);
@ -3095,13 +3089,13 @@ struct IndustryCargoesWindow : public Window {
CargoesField *lft = (fieldxy.x > 0) ? this->fields[fieldxy.y].columns + fieldxy.x - 1 : nullptr;
CargoesField *rgt = (fieldxy.x < 4) ? this->fields[fieldxy.y].columns + fieldxy.x + 1 : nullptr;
CargoID cid = fld->CargoClickedAt(lft, rgt, xy);
if (cid != CT_INVALID) this->ComputeCargoDisplay(cid);
if (cid != INVALID_CARGO) this->ComputeCargoDisplay(cid);
break;
}
case CFT_CARGO_LABEL: {
CargoID cid = fld->CargoLabelClickedAt(xy);
if (cid != CT_INVALID) this->ComputeCargoDisplay(cid);
if (cid != INVALID_CARGO) this->ComputeCargoDisplay(cid);
break;
}
@ -3197,7 +3191,7 @@ struct IndustryCargoesWindow : public Window {
if (!CalculatePositionInWidget(pt, &fieldxy, &xy)) return false;
const CargoesField *fld = this->fields[fieldxy.y].columns + fieldxy.x;
CargoID cid = CT_INVALID;
CargoID cid = INVALID_CARGO;
switch (fld->type) {
case CFT_CARGO: {
CargoesField *lft = (fieldxy.x > 0) ? this->fields[fieldxy.y].columns + fieldxy.x - 1 : nullptr;
@ -3220,7 +3214,7 @@ struct IndustryCargoesWindow : public Window {
default:
break;
}
if (cid != CT_INVALID && (this->ind_cargo < NUM_INDUSTRYTYPES || cid != this->ind_cargo - NUM_INDUSTRYTYPES)) {
if (cid != INVALID_CARGO && (this->ind_cargo < NUM_INDUSTRYTYPES || cid != this->ind_cargo - NUM_INDUSTRYTYPES)) {
const CargoSpec *csp = CargoSpec::Get(cid);
SetDParam(0, csp->name);
GuiShowTooltips(this, STR_INDUSTRY_CARGOES_CARGO_TOOLTIP, close_cond, 1);
@ -3315,7 +3309,7 @@ void ShowIndustryTooltip(Window *w, const TileIndex tile)
for (size_t i = 0; i < accepted_cargo_count; ++i) {
CargoID required_cargo = industry->accepts_cargo[i];
if (required_cargo == CT_INVALID) {
if (required_cargo == INVALID_CARGO) {
continue;
}
@ -3350,7 +3344,7 @@ void ShowIndustryTooltip(Window *w, const TileIndex tile)
if (stockpiling && _settings_client.gui.industry_tooltip_show_stockpiled) {
for (size_t i = 0; i < accepted_cargo_count; ++i) {
CargoID stockpiled_cargo = industry->accepts_cargo[i];
if (stockpiled_cargo == CT_INVALID) continue;
if (stockpiled_cargo == INVALID_CARGO) continue;
const CargoSuffix &suffix = suffixes[i];
@ -3378,7 +3372,7 @@ void ShowIndustryTooltip(Window *w, const TileIndex tile)
for (size_t i = 0; i < produced_cargo_count; i++) {
CargoID produced_cargo = industry->produced_cargo[i];
if (produced_cargo == CT_INVALID) continue;
if (produced_cargo == INVALID_CARGO) continue;
if (!msg.empty()) msg += '\n';

@ -771,7 +771,7 @@ STR_SMALLMAP_LEGENDA_AIRCRAFT :{TINY_FONT}{BLA
STR_SMALLMAP_LEGENDA_TRANSPORT_ROUTES :{TINY_FONT}{BLACK}Transport Routes
STR_SMALLMAP_LEGENDA_FOREST :{TINY_FONT}{BLACK}Forest
STR_SMALLMAP_LEGENDA_RAILROAD_STATION :{TINY_FONT}{BLACK}Railway Station
STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY :{TINY_FONT}{BLACK}Truck Loading Bay
STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY :{TINY_FONT}{BLACK}Lorry Station
STR_SMALLMAP_LEGENDA_BUS_STATION :{TINY_FONT}{BLACK}Bus Station
STR_SMALLMAP_LEGENDA_AIRPORT_HELIPORT :{TINY_FONT}{BLACK}Airport/Heliport
STR_SMALLMAP_LEGENDA_DOCK :{TINY_FONT}{BLACK}Dock
@ -1002,6 +1002,7 @@ STR_GAME_OPTIONS_CURRENCY_HKD :Hong Kong Dolla
STR_GAME_OPTIONS_CURRENCY_INR :Indian Rupee
STR_GAME_OPTIONS_CURRENCY_IDR :Indonesian Rupiah
STR_GAME_OPTIONS_CURRENCY_MYR :Malaysian Ringgit
STR_GAME_OPTIONS_CURRENCY_LVL :Latvian Lats
STR_GAME_OPTIONS_AUTOSAVE_FRAME :{BLACK}Autosave
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}Select interval between automatic game saves
@ -2723,9 +2724,9 @@ STR_RAIL_TOOLBAR_MAGLEV_CONSTRUCTION_CAPTION :Maglev Construc
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK :{BLACK}Build railway track. Ctrl toggles build/remove for railway construction. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL :{BLACK}Build railway track using the Autorail mode. Ctrl toggles build/remove for railway construction. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_TRAIN_DEPOT_FOR_BUILDING :{BLACK}Build train depot (for buying and servicing trains). Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Convert rail to waypoint. Ctrl enables joining waypoints. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Build waypoint on railway. Ctrl enables joining waypoints. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_STATION :{BLACK}Build railway station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Build railway signals. Ctrl toggles semaphore/light signals{}Dragging builds signals along a straight stretch of rail. Ctrl builds signals till the next junction{}Ctrl+Click toggles opening the signal selection window. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Build signal on railway. Ctrl toggles semaphore/light signals{}Dragging builds signals along a straight stretch of rail. Ctrl builds signals up to the next junction or signal{}Ctrl+Click toggles opening the signal selection window. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_BRIDGE :{BLACK}Build railway bridge. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TUNNEL :{BLACK}Build railway tunnel. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR :{BLACK}Toggle build/remove for railway track, signals, waypoints and stations. Hold Ctrl to also remove the rail of waypoints and stations
@ -2813,7 +2814,7 @@ STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT :{BLACK}Build ro
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT :{BLACK}Build tram vehicle depot (for buying and servicing vehicles). Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION :{BLACK}Build bus station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION :{BLACK}Build passenger tram station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Build Truck loading bay. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Build lorry station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION :{BLACK}Build freight tram station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD :{BLACK}Activate/Deactivate one way roads
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE :{BLACK}Build road bridge. Shift toggles building/showing cost estimate
@ -2838,7 +2839,7 @@ STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP :{BLACK}Select t
STR_STATION_BUILD_BUS_ORIENTATION :{WHITE}Bus Station Orientation
STR_STATION_BUILD_BUS_ORIENTATION_TOOLTIP :{BLACK}Select bus station orientation
STR_STATION_BUILD_TRUCK_ORIENTATION :{WHITE}Truck Station Orientation
STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP :{BLACK}Select Truck loading bay orientation
STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP :{BLACK}Select lorry station orientation
STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION :{WHITE}Passenger Tram Station Orientation
STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION_TOOLTIP :{BLACK}Select passenger tram station orientation
STR_STATION_BUILD_CARGO_TRAM_ORIENTATION :{WHITE}Freight Tram Station Orientation
@ -3082,7 +3083,7 @@ STR_LAI_TREE_NAME_CACTUS_PLANTS :Cactus plants
STR_LAI_STATION_DESCRIPTION_RAILROAD_STATION :Railway station
STR_LAI_STATION_DESCRIPTION_AIRCRAFT_HANGAR :Aircraft hangar
STR_LAI_STATION_DESCRIPTION_AIRPORT :Airport
STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA :Truck loading area
STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA :Lorry station
STR_LAI_STATION_DESCRIPTION_BUS_STATION :Bus station
STR_LAI_STATION_DESCRIPTION_SHIP_DOCK :Ship dock
STR_LAI_STATION_DESCRIPTION_BUOY :Buoy

@ -771,7 +771,7 @@ STR_SMALLMAP_LEGENDA_AIRCRAFT :{TINY_FONT}{BLA
STR_SMALLMAP_LEGENDA_TRANSPORT_ROUTES :{TINY_FONT}{BLACK}Transport Routes
STR_SMALLMAP_LEGENDA_FOREST :{TINY_FONT}{BLACK}Forest
STR_SMALLMAP_LEGENDA_RAILROAD_STATION :{TINY_FONT}{BLACK}Railroad Station
STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY :{TINY_FONT}{BLACK}Truck Loading Bay
STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY :{TINY_FONT}{BLACK}Truck Station
STR_SMALLMAP_LEGENDA_BUS_STATION :{TINY_FONT}{BLACK}Bus Station
STR_SMALLMAP_LEGENDA_AIRPORT_HELIPORT :{TINY_FONT}{BLACK}Airport/Heliport
STR_SMALLMAP_LEGENDA_DOCK :{TINY_FONT}{BLACK}Dock
@ -1002,6 +1002,7 @@ STR_GAME_OPTIONS_CURRENCY_HKD :Hong Kong Dolla
STR_GAME_OPTIONS_CURRENCY_INR :Indian Rupee
STR_GAME_OPTIONS_CURRENCY_IDR :Indonesian Rupiah
STR_GAME_OPTIONS_CURRENCY_MYR :Malaysian Ringgit
STR_GAME_OPTIONS_CURRENCY_LVL :Latvian Lats
STR_GAME_OPTIONS_AUTOSAVE_FRAME :{BLACK}Autosave
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}Select interval between automatic game saves
@ -2723,9 +2724,9 @@ STR_RAIL_TOOLBAR_MAGLEV_CONSTRUCTION_CAPTION :Maglev Construc
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK :{BLACK}Build railroad track. Ctrl toggles build/remove for railroad construction. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL :{BLACK}Build railroad track using the Autorail mode. Ctrl toggles build/remove for railroad construction. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_TRAIN_DEPOT_FOR_BUILDING :{BLACK}Build train depot (for buying and maintaining trains). Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Convert rail to waypoint. Ctrl enables joining waypoints. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Build waypoint on railway. Ctrl enables joining waypoints. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_STATION :{BLACK}Build railroad station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Build railroad signals. Ctrl toggles semaphore/light signals{}Dragging builds signals along a straight stretch of track. Ctrl builds signals up to the next junction or signal{}Ctrl+Click toggles opening the signal selection window. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Build signal on railway. Ctrl toggles semaphore/light signals{}Dragging builds signals along a straight stretch of rail. Ctrl builds signals up to the next junction or signal{}Ctrl+Click toggles opening the signal selection window. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_BRIDGE :{BLACK}Build railroad bridge. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TUNNEL :{BLACK}Build railroad tunnel. Shift toggles building/showing cost estimate
STR_RAIL_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR :{BLACK}Toggle build/remove for railroad track, signals, waypoints and stations. Hold Ctrl to also remove the rail of waypoints and stations
@ -2813,7 +2814,7 @@ STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT :{BLACK}Build ro
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT :{BLACK}Build tram vehicle depot (for buying and servicing vehicles). Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION :{BLACK}Build bus station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION :{BLACK}Build passenger streetcar station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Build truck loading bay. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Build truck station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION :{BLACK}Build freight streetcar station. Ctrl enables joining stations. Shift toggles building/showing cost estimate
STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD :{BLACK}Activate/Deactivate one way roads
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE :{BLACK}Build road bridge. Shift toggles building/showing cost estimate
@ -2838,7 +2839,7 @@ STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP :{BLACK}Select s
STR_STATION_BUILD_BUS_ORIENTATION :{WHITE}Bus Station Orientation
STR_STATION_BUILD_BUS_ORIENTATION_TOOLTIP :{BLACK}Select bus station orientation
STR_STATION_BUILD_TRUCK_ORIENTATION :{WHITE}Truck Station Orientation
STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP :{BLACK}Select truck loading bay orientation
STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP :{BLACK}Select truck station orientation
STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION :{WHITE}Passenger Streetcar Station Orientation
STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION_TOOLTIP :{BLACK}Select passenger streetcar station orientation
STR_STATION_BUILD_CARGO_TRAM_ORIENTATION :{WHITE}Freight Streetcar Station Orientation
@ -3082,7 +3083,7 @@ STR_LAI_TREE_NAME_CACTUS_PLANTS :Cactuses
STR_LAI_STATION_DESCRIPTION_RAILROAD_STATION :Railroad station
STR_LAI_STATION_DESCRIPTION_AIRCRAFT_HANGAR :Aircraft hangar
STR_LAI_STATION_DESCRIPTION_AIRPORT :Airport
STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA :Truck loading area
STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA :Truck station
STR_LAI_STATION_DESCRIPTION_BUS_STATION :Bus station
STR_LAI_STATION_DESCRIPTION_SHIP_DOCK :Ship dock
STR_LAI_STATION_DESCRIPTION_BUOY :Buoy

@ -1002,6 +1002,7 @@ STR_GAME_OPTIONS_CURRENCY_HKD :Hongkongin doll
STR_GAME_OPTIONS_CURRENCY_INR :Intian rupia
STR_GAME_OPTIONS_CURRENCY_IDR :Indonesian rupia
STR_GAME_OPTIONS_CURRENCY_MYR :Malesian ringgit
STR_GAME_OPTIONS_CURRENCY_LVL :Latvian lati
STR_GAME_OPTIONS_AUTOSAVE_FRAME :{BLACK}Automaattitallennus
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}Valitse aikaväli automaattisille pelitallennuksille
@ -2723,9 +2724,9 @@ STR_RAIL_TOOLBAR_MAGLEV_CONSTRUCTION_CAPTION :Maglevin rakent
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK :{BLACK}Rakenna rautateitä. Ctrl vaihtaa rakennus-/poistotilan välillä. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL :{BLACK}Rakenna rautatietä automaattisesti valittuun suuntaan. Ctrl vaihtaa rakennus-/poistotilan välillä. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_TRAIN_DEPOT_FOR_BUILDING :{BLACK}Rakenna veturitalli (junien ostamista ja huoltoa varten). Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Muunna raide reittipisteeksi. Ctrl liittää reittipisteet. Shift vaihtaa muuntotilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Rakenna reittipiste rautatielle. Ctrl mahdollistaa reittipisteiden yhdistämisen. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_STATION :{BLACK}Rakenna rautatieasema. Ctrl liittää asemat. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Rakenna opastimia. Ctrl vaihtaa siipi- ja valo-opastimien välillä{}Vetäminen rakentaa opastimia suoralle rataosuudelle. Ctrl rakentaa opastimia seuraavaan risteykseen tai opastimeen saakka{}Ctrl+napsautus avaa opastimenvalintaikkunan. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Rakenna opastin rautatielle. Ctrl vaihtaa siipi- ja valo-opastimien välillä{}Vetäminen rakentaa opastimia suoralle rataosuudelle. Ctrl rakentaa opastimia seuraavaan risteykseen tai opastimeen saakka{}Ctrl+napsautus avaa opastimenvalintaikkunan. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_BRIDGE :{BLACK}Rakenna rautatiesilta. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TUNNEL :{BLACK}Rakenna rautatietunneli. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_RAIL_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR :{BLACK}Rautatien, opastimien, reittipisteiden ja asemien rakentaminen/poisto päälle/pois. Pidä pohjassa Ctrl-näppäintä poistaaksesi myös aseman tai reittipisteen alla olevat raiteet
@ -2813,7 +2814,7 @@ STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT :{BLACK}Rakenna
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT :{BLACK}Rakenna raitiotievarikko (vaunujen ostamiseen ja korjaamiseen). Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION :{BLACK}Rakenna linja-autoasema. Ctrl liittää asemat. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION :{BLACK}Rakenna raitiotien matkustaja-asema. Ctrl liittää asemat. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Rakenna lastauslaituri. Ctrl liittää asemat. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Rakenna lastauslaituri. Ctrl mahdollistaa laitureiden yhdistämisen yhdeksi asemaksi. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION :{BLACK}Rakenna raitiotien rahtiasema. Ctrl liittää asemat. Shift vaihtaa rakennustilan ja kustannusarvion välillä
STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD :{BLACK}Ota yksisuuntaiset tiet käyttöön/pois käytöstä
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE :{BLACK}Rakenna maantiesilta. Shift vaihtaa rakennustilan ja kustannusarvion välillä

@ -1151,7 +1151,7 @@ STR_SMALLMAP_LEGENDA_TRANSPORT_ROUTES :{TINY_FONT}{BLA
STR_SMALLMAP_LEGENDA_FOREST :{G=m}{TINY_FONT}{BLACK}Las
STR_SMALLMAP_LEGENDA_FOREST.d :{TINY_FONT}{BLACK}Lasu
STR_SMALLMAP_LEGENDA_RAILROAD_STATION :{TINY_FONT}{BLACK}Stacja kolejowa
STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY :{TINY_FONT}{BLACK}Załadunek ciężarówek
STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY :{TINY_FONT}{BLACK}Stacja ciężarówek
STR_SMALLMAP_LEGENDA_BUS_STATION :{TINY_FONT}{BLACK}Przystanek
STR_SMALLMAP_LEGENDA_AIRPORT_HELIPORT :{TINY_FONT}{BLACK}Lotnisko
STR_SMALLMAP_LEGENDA_DOCK :{TINY_FONT}{BLACK}Port
@ -1382,6 +1382,7 @@ STR_GAME_OPTIONS_CURRENCY_HKD :Dolar hongkońs
STR_GAME_OPTIONS_CURRENCY_INR :Rupia Indyjska
STR_GAME_OPTIONS_CURRENCY_IDR :Rupia Indonezyjska
STR_GAME_OPTIONS_CURRENCY_MYR :Ringgit malezyjski
STR_GAME_OPTIONS_CURRENCY_LVL :Łat łotewski
STR_GAME_OPTIONS_AUTOSAVE_FRAME :{BLACK}Autozapis
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}Częstotliwość automatycznego zapisu stanu gry
@ -1748,7 +1749,7 @@ STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT :Jeśli włączo
STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :Nowe polecenia są domyślnie „bez zatrzymywania się”: {STRING}
STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT_HELPTEXT :Normalnie pojazd zatrzyma się na każdej stacji, przez którą przejeżdża. Po włączeniu tej opcji, pojazd przejedzie do swojego celu bez zatrzymywania się. Zwróć uwagę na to, że to ustawienie ma wpływ tylko na nowe polecenia. Pojedyncze polecenia mogą być ustalane bez względu na wartość tej opcji
STR_CONFIG_SETTING_STOP_LOCATION :Nowe rozkazy pociągu kończą się domyślnie na {STRING} peronu
STR_CONFIG_SETTING_STOP_LOCATION :Nowe polecenia pociągu domyślnie kończą się na {STRING} peronu
STR_CONFIG_SETTING_STOP_LOCATION_HELPTEXT :Miejsce, w którym pociąg domyślnie zatrzyma się na peronie. „Początek” oznacza blisko wjazdu, „środek” oznacza środkową część peronu, a „koniec” oznacza daleko od wjazdu. Pamiętaj, że to ustawienie określa tylko domyślną wartość dla nowych poleceń. Miejsce zatrzymania poszczególnych poleceń można ustawić, klikając na tekst danego polecenia
###length 3
STR_CONFIG_SETTING_STOP_LOCATION_NEAR_END :początku
@ -1817,7 +1818,7 @@ STR_CONFIG_SETTING_WARN_LOST_VEHICLE :Ostrzeż, jeśl
STR_CONFIG_SETTING_WARN_LOST_VEHICLE_HELPTEXT :Pokazuj wiadomości o pojazdach, które nie są w stanie znaleźć ścieżki do swoich wyznaczonych celów
STR_CONFIG_SETTING_ORDER_REVIEW :Kontroluj polecenia pojazdów: {STRING}
STR_CONFIG_SETTING_ORDER_REVIEW_HELPTEXT :Kiedy włączone, rozkazy wszystkich pojazdów są sprawdzane co jakiś czas, a wykryte nieprawidłowości są zgłaszane w oknach wiadomości
STR_CONFIG_SETTING_ORDER_REVIEW_HELPTEXT :Kiedy włączone, polecenia wszystkich pojazdów są sprawdzane co jakiś czas, a wykryte nieprawidłowości są zgłaszane w oknach wiadomości
###length 3
STR_CONFIG_SETTING_ORDER_REVIEW_OFF :Nie
STR_CONFIG_SETTING_ORDER_REVIEW_EXDEPOT :Tak, ale wyklucz zatrzymane
@ -1871,7 +1872,7 @@ STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL :Oryginalny
STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS :TerraGenesis
STR_CONFIG_SETTING_TERRAIN_TYPE :Typ terenu: {STRING}
STR_CONFIG_SETTING_TERRAIN_TYPE_HELPTEXT :Określa ukształtowanie terenu (tylko dla TerraGenesis)
STR_CONFIG_SETTING_TERRAIN_TYPE_HELPTEXT :Wybierz wysokość wzgórz i gór w krajobrazie
STR_CONFIG_SETTING_INDUSTRY_DENSITY :Liczba przedsiębiorstw: {STRING}
STR_CONFIG_SETTING_INDUSTRY_DENSITY_HELPTEXT :Określa liczbę przedsiębiorstw na początku i w trakcie gry
@ -1880,18 +1881,18 @@ STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE :Maksymalna odle
STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT :Rafinerie są budowane tylko w pobliżu krawędzi map, to znaczy na wybrzeżach dla map wyspiarskich. To ustawienie pozwala ograniczyć jak daleko od krawędzi mapy mogą być budowane rafinerie i platformy wiertnicze. Na mapach większych niż 256 pól, wartość ta jest skalowana w górę.
STR_CONFIG_SETTING_SNOWLINE_HEIGHT :Wysokość granicy wiecznych śniegów: {STRING}
STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :Wysokość linii śniegu w klimacie arktycznym. Poziom pokrywy śnieżnej wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Może być zmodyfikowana poprzez Edytor Scenariuszy, w innym przypadku jest obliczana za pomocą ustawienia „pokrycie śniegiem”
STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :Wybierz, na jakiej wysokości zaczyna zalegać śnieg w krajobrazie arktycznym. Poziom pokrywy śnieżnej wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Może być zmodyfikowana poprzez Edytor Scenariuszy, w innym przypadku jest obliczana za pomocą ustawienia „pokrycie śniegiem”
STR_CONFIG_SETTING_SNOW_COVERAGE :Pokrycie śniegiem: {STRING}
STR_CONFIG_SETTING_SNOW_COVERAGE_HELPTEXT :Ustawia przybliżoną ilość śniegu w krajobrazie arktycznym. Śnieg wpływa również wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Używane tylko podczas generowania mapy. Teren tuż ponad poziomem morza jest zawsze bez śniegu
STR_CONFIG_SETTING_SNOW_COVERAGE_HELPTEXT :Wybierz przybliżoną ilość śniegu w krajobrazie arktycznym. Śnieg wpływa również wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Używane tylko podczas generowania mapy. Teren tuż ponad poziomem wody jest zawsze bez śniegu
STR_CONFIG_SETTING_SNOW_COVERAGE_VALUE :{NUM}%
STR_CONFIG_SETTING_DESERT_COVERAGE :Pokrycie pustynią: {STRING}
STR_CONFIG_SETTING_DESERT_COVERAGE_HELPTEXT :Ustawia przybliżoną ilość pustyni w krajobrazie tropikalnym. Pustynia wpływa również wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Używane tylko podczas generowania mapy.
STR_CONFIG_SETTING_DESERT_COVERAGE_HELPTEXT :Wybierz przybliżoną ilość pustyni w krajobrazie tropikalnym. Pustynia wpływa również na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Używane tylko podczas generowania mapy
STR_CONFIG_SETTING_DESERT_COVERAGE_VALUE :{NUM}%
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN :Gładkość terenu: {STRING}
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_HELPTEXT :(Tylko dla TerraGenesis) Określa liczbę wzgórz na mapie. Łagodne krajobrazy posiadają nieliczne, bardzo rozległe wzgórza, natomiast na terenach pofałdowanych jest ich znacznie więcej i mogą wyglądać podobnie
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_HELPTEXT :Wybierz kształt i ilość wzniesień. Łagodny teren ma mniejszą liczbę szerszych wzniesień, natomiast teren pofałdowany ma więcej mniejszych wzniesień.
###length 4
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH :Bardzo łagodny
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_SMOOTH :Łagodny
@ -1899,7 +1900,7 @@ STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_ROUGH :Pofałdowany
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_ROUGH :Bardzo pofałdowany
STR_CONFIG_SETTING_VARIETY :Różnorodność terenu: {STRING}
STR_CONFIG_SETTING_VARIETY_HELPTEXT :(Tylko dla TerraGenesis) Umożliwia jednoczesne występowanie obszarów górskich i płaskich. Działa na zasadzie obniżania powierzchni, dlatego inny parametr powinien definiować teren górzysty
STR_CONFIG_SETTING_VARIETY_HELPTEXT :Wybierz, czy mapa ma zawierać zarówno obszary górskie, jak i płaskie. Im większa różnorodność, tym większe różnice wysokości między obszarami górskimi i płaskimi.
STR_CONFIG_SETTING_RIVER_AMOUNT :Liczba rzek: {STRING}
STR_CONFIG_SETTING_RIVER_AMOUNT_HELPTEXT :Określa liczbę rzek na mapie
@ -2435,14 +2436,17 @@ STR_CONFIG_SETTING_ACCOUNTING :Finanse
STR_CONFIG_SETTING_VEHICLES :Pojazdy
STR_CONFIG_SETTING_VEHICLES_PHYSICS :Fizyka
STR_CONFIG_SETTING_VEHICLES_ROUTING :Wyznaczanie trasy
STR_CONFIG_SETTING_VEHICLES_ORDERS :Polecenia
STR_CONFIG_SETTING_LIMITATIONS :Ograniczenia
STR_CONFIG_SETTING_ACCIDENTS :Awarie i katastrofy
STR_CONFIG_SETTING_GENWORLD :Tworzenie mapy
STR_CONFIG_SETTING_ENVIRONMENT :Środowisko
STR_CONFIG_SETTING_ENVIRONMENT_TIME :Czas
STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES :Władze lokalne
STR_CONFIG_SETTING_ENVIRONMENT_TOWNS :Miasta
STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES :Przedsiębiorstwa
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST :Dystrybucja ładunków
STR_CONFIG_SETTING_ENVIRONMENT_TREES :Drzewa
STR_CONFIG_SETTING_AI :Rywale
STR_CONFIG_SETTING_AI_NPC :Gracze komputerowi
STR_CONFIG_SETTING_NETWORK :Sieć
@ -2579,12 +2583,20 @@ STR_LIVERY_TRAIN_TOOLTIP :{BLACK}Pokaż s
STR_LIVERY_ROAD_VEHICLE_TOOLTIP :{BLACK}Pokaż schematy koloru pojazdów
STR_LIVERY_SHIP_TOOLTIP :{BLACK}Pokaż schematy koloru statków
STR_LIVERY_AIRCRAFT_TOOLTIP :{BLACK}Pokaż schematy koloru samolotów
STR_LIVERY_TRAIN_GROUP_TOOLTIP :{BLACK}Pokaż kolory grup pociągów
STR_LIVERY_ROAD_VEHICLE_GROUP_TOOLTIP :{BLACK}Pokaż kolory grup pojazdów
STR_LIVERY_SHIP_GROUP_TOOLTIP :{BLACK}Pokaż kolory grup statków
STR_LIVERY_AIRCRAFT_GROUP_TOOLTIP :{BLACK}Pokaż kolory grup samolotów
STR_LIVERY_PRIMARY_TOOLTIP :{BLACK}Wybierz główny kolor dla wybranego schematu. Ctrl+klik ustawi ten kolor dla wszystkich schematów
STR_LIVERY_SECONDARY_TOOLTIP :{BLACK}Wybierz dodatkowy kolor dla wybranego schematu. Ctrl+klik ustawi ten kolor dla wszystkich schematów
STR_LIVERY_PANEL_TOOLTIP :{BLACK}Wybierz schemat kolorów do zmiany, albo wiele schematów z CTRL+klik. Kliknij na okienku aby wł./wył. używanie schematu.
STR_LIVERY_TRAIN_GROUP_EMPTY :Nie utworzono żadnych grup pociągów
STR_LIVERY_ROAD_VEHICLE_GROUP_EMPTY :Nie utworzono żadnych grup pojazdów
STR_LIVERY_SHIP_GROUP_EMPTY :Nie utworzono żadnych grup statków
STR_LIVERY_AIRCRAFT_GROUP_EMPTY :Nie utworzono żadnych grup samolotów
###length 23
STR_LIVERY_DEFAULT :Standardowy wygląd
STR_LIVERY_DEFAULT :Domyślne malowanie
STR_LIVERY_STEAM :Parowóz
STR_LIVERY_DIESEL :Lokomotywa spalinowa
STR_LIVERY_ELECTRIC :Lokomotywa elektryczna
@ -3092,9 +3104,9 @@ STR_RAIL_TOOLBAR_MAGLEV_CONSTRUCTION_CAPTION :Konstrukcja lin
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK :{BLACK}Budowa torów kolejowych. Ctrl przełącza buduj/usuń dla konstrukcji kolejowych. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL :{BLACK}Zbuduj tory kolejowe za pomocą trybu Autotory. Ctrl przełącza buduj/usuń dla konstrukcji kolejowych. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_TRAIN_DEPOT_FOR_BUILDING :{BLACK}Budowa warsztatów (do kupowania i serwisowania pociągów). Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Zamiana torów na posterunek. Ctrl umożliwia łączenie posterunków. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Zbuduj posterunek na torach. Ctrl umożliwia łączenie posterunków. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_STATION :{BLACK}Zbuduj stację kolejową. Ctrl umożliwia łączenie stacji. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Zbuduj sygnały kolejowe. Ctrl przełącza semafory/sygnały świetlne{}Przeciągnięcie pozwala na budowę sygnałów wzdłuż prostej linii torów. Ctrl pozwala na budowę sygnałów do następnego skrzyżowania{}Ctrl+klik przełącza do okna wyboru sygnałów. Shift przełącza pomiędzy budowaniem a szacowaniem kosztów
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Zbuduj sygnały na torach. Ctrl przełącza semafory/sygnały świetlne{}Przeciąganie buduje sygnały wzdłuż prostej linii torów, z Ctrl buduje sygnały aż do najbliższego skrzyżowania lub sygnału{}Ctrl+klik przełącza wyświetlanie okna wyboru sygnałów. Shift przełącza pomiędzy budowaniem a szacowaniem jego kosztów
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_BRIDGE :{BLACK}Zbuduj most kolejowy. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TUNNEL :{BLACK}Zbuduj tunel kolejowy. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_RAIL_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR :{BLACK}Przełącz buduj/usuń dla torów kolejowych, sygnałów, posterunków i stacji. Przetrzymanie Ctrl usuwa także tory kolejowe z posterunków i stacji
@ -3182,7 +3194,7 @@ STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT :{BLACK}Wybuduj
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT :{BLACK}Wybuduj zajezdnię tramwajową (do kupowania i serwisowania pojazdów). Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION :{BLACK}Zbuduj przystanek autobusowy. Ctrl umożliwia łączenie stacji. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION :{BLACK}Zbuduj pasażerski przystanek tramwajowy. Ctrl umożliwia łączenie stacji. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Zbuduj stację załadunku ciężarówek. Ctrl umożliwia łączenie stacji. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Zbuduj stację ciężarówek. Ctrl umożliwia łączenie stacji. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION :{BLACK}Zbuduj tramwajową stację załadunkową. Ctrl umożliwia łączenie stacji. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD :{BLACK}Włącz/wyłącz drogi jednokierunkowe
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE :{BLACK}Zbuduj most drogowy. Shift przełącza pomiędzy trybem budowania a szacowaniem jego kosztów
@ -3207,7 +3219,7 @@ STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP :{BLACK}Wybierz
STR_STATION_BUILD_BUS_ORIENTATION :{WHITE}Ukierunkowanie przystanku
STR_STATION_BUILD_BUS_ORIENTATION_TOOLTIP :{BLACK}Wybierz ukierunkowanie przystanku
STR_STATION_BUILD_TRUCK_ORIENTATION :{WHITE}Ukierunkowanie stacji załadunku ciężarówek
STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP :{BLACK}Wybierz ukierunkowanie stacji załadunku ciężarówek
STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP :{BLACK}Wybierz ukierunkowanie stacji ciężarówek
STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION :{WHITE}Ukierunkowanie przystanku tramwajowego
STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION_TOOLTIP :{BLACK}Wybierz ukierunkowanie przystanku tramwajowego
STR_STATION_BUILD_CARGO_TRAM_ORIENTATION :{WHITE}Ukierunkowanie tramwajowej stacji załadunkowej
@ -3451,7 +3463,7 @@ STR_LAI_TREE_NAME_CACTUS_PLANTS :Kaktusy
STR_LAI_STATION_DESCRIPTION_RAILROAD_STATION :Stacja kolejowa
STR_LAI_STATION_DESCRIPTION_AIRCRAFT_HANGAR :Hangar
STR_LAI_STATION_DESCRIPTION_AIRPORT :Lotnisko
STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA :Stacja załadunku ciężarówek
STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA :Stacja ciężarówek
STR_LAI_STATION_DESCRIPTION_BUS_STATION :Przystanek
STR_LAI_STATION_DESCRIPTION_SHIP_DOCK :Port
STR_LAI_STATION_DESCRIPTION_BUOY :Boja
@ -4948,21 +4960,21 @@ STR_ORDER_STOP_LOCATION_FAR_END :[dalszy koniec]
STR_ORDER_OUT_OF_RANGE :{RED} (Kolejny punkt docelowy jest poza zasięgiem)
STR_ORDER_CONDITIONAL_UNCONDITIONAL :Skocz do rozkazu {COMMA}
STR_ORDER_CONDITIONAL_NUM :Skocz do rozkazu {COMMA} kiedy {STRING} {STRING} {COMMA}
STR_ORDER_CONDITIONAL_TRUE_FALSE :Skocz do rozkazu {0:COMMA} kiedy {2:STRING} że {1:STRING}
STR_ORDER_CONDITIONAL_UNCONDITIONAL :Skocz do polecenia {COMMA}
STR_ORDER_CONDITIONAL_NUM :Skocz do polecenia {COMMA}, kiedy {STRING} {STRING} {COMMA}
STR_ORDER_CONDITIONAL_TRUE_FALSE :Skocz do polecenia {0:COMMA}, kiedy {2:STRING}, że {1:STRING}
STR_INVALID_ORDER :{RED} (Błędne polecenie)
# Time table window
STR_TIMETABLE_TITLE :{WHITE}{VEHICLE} (Rozkład jazdy)
STR_TIMETABLE_ORDER_VIEW :{BLACK}Rozkazy
STR_TIMETABLE_ORDER_VIEW :{BLACK}Polecenia
STR_TIMETABLE_ORDER_VIEW_TOOLTIP :{BLACK}Przełącz do okna poleceń
STR_TIMETABLE_TOOLTIP :{BLACK}Rozkład jazdy - kliknij na poleceniu aby je zaznaczyć
STR_TIMETABLE_NO_TRAVEL :Nie podróżuje
STR_TIMETABLE_NOT_TIMETABLEABLE :Podróż (automatycznie; zaplanowana przez następny ręczny rozkaz)
STR_TIMETABLE_NOT_TIMETABLEABLE :Podróż (automatycznie; zaplanowana przez następne ręczne polecenie)
STR_TIMETABLE_TRAVEL_NOT_TIMETABLED :Przejazd (bez ustalonego czasu)
STR_TIMETABLE_TRAVEL_NOT_TIMETABLED_SPEED :Podróżuj (poza rozkładem) z maksymalną prędkością {2:VELOCITY}
STR_TIMETABLE_TRAVEL_FOR :Przejazd przez {STRING}
@ -5319,7 +5331,7 @@ STR_ERROR_DRIVE_THROUGH_JUNCTION :{WHITE}... przy
STR_ERROR_CAN_T_REMOVE_PART_OF_STATION :{WHITE}Nie można usunąć części stacji...
STR_ERROR_MUST_REMOVE_RAILWAY_STATION_FIRST :{WHITE}Należy najpierw usunąć stację kolejową
STR_ERROR_CAN_T_REMOVE_BUS_STATION :{WHITE}Nie można usunąć przystanku...
STR_ERROR_CAN_T_REMOVE_TRUCK_STATION :{WHITE}Nie można usunąć stacji załadunkowej...
STR_ERROR_CAN_T_REMOVE_TRUCK_STATION :{WHITE}Nie można usunąć stacji ciężarówek...
STR_ERROR_CAN_T_REMOVE_PASSENGER_TRAM_STATION :{WHITE}Nie można usunąć przystanku tramwajowego...
STR_ERROR_CAN_T_REMOVE_CARGO_TRAM_STATION :{WHITE}Nie można usunąć tramwajowej stacji załadunkowej...
STR_ERROR_MUST_REMOVE_ROAD_STOP_FIRST :{WHITE}Należy najpierw usunąć przystanek
@ -5556,7 +5568,7 @@ STR_ERROR_CAN_T_SKIP_ORDER :{WHITE}Nie moż
STR_ERROR_CAN_T_SKIP_TO_ORDER :{WHITE}Nie można przejść do wybranego polecenia...
STR_ERROR_CAN_T_COPY_SHARE_ORDER :{WHITE}... pojazd nie może jechać do wszystkich stacji
STR_ERROR_CAN_T_ADD_ORDER :{WHITE}... pojazd nie może jechać do tej stacji
STR_ERROR_CAN_T_ADD_ORDER_SHARED :{WHITE}... pojazd dzielący ten rozkaz nie może jechać do tej stacji
STR_ERROR_CAN_T_ADD_ORDER_SHARED :{WHITE}... pojazd współdzielący to polecenie nie może jechać do tej stacji
STR_ERROR_CAN_T_COPY_ORDER_VEHICLE_LIST :{WHITE}... nie wszystkie pojazdy mają takie same polecenia
STR_ERROR_CAN_T_SHARE_ORDER_VEHICLE_LIST :{WHITE}... nie wszystkie pojazdy współdzielą polecenia

@ -772,7 +772,7 @@ STR_SMALLMAP_LEGENDA_AIRCRAFT :{TINY_FONT}{BLA
STR_SMALLMAP_LEGENDA_TRANSPORT_ROUTES :{TINY_FONT}{BLACK}Rotas de Transporte
STR_SMALLMAP_LEGENDA_FOREST :{TINY_FONT}{BLACK}Floresta
STR_SMALLMAP_LEGENDA_RAILROAD_STATION :{TINY_FONT}{BLACK}Estação Ferroviária
STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY :{TINY_FONT}{BLACK}Área de Carregamento de Camiões
STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY :{TINY_FONT}{BLACK}Estação de Camiões
STR_SMALLMAP_LEGENDA_BUS_STATION :{TINY_FONT}{BLACK}Estação de Autocarros
STR_SMALLMAP_LEGENDA_AIRPORT_HELIPORT :{TINY_FONT}{BLACK}Aeroporto/Heliporto
STR_SMALLMAP_LEGENDA_DOCK :{TINY_FONT}{BLACK}Doca
@ -1003,6 +1003,7 @@ STR_GAME_OPTIONS_CURRENCY_HKD :Dólar de Hong
STR_GAME_OPTIONS_CURRENCY_INR :Rupia Indiana
STR_GAME_OPTIONS_CURRENCY_IDR :Rupia Indonésia
STR_GAME_OPTIONS_CURRENCY_MYR :Ringgit da Malásia
STR_GAME_OPTIONS_CURRENCY_LVL :Lats da Letónia
STR_GAME_OPTIONS_AUTOSAVE_FRAME :{BLACK}Guardar automaticamente
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}Seleccionar o intervalo para guardar automático
@ -2056,14 +2057,17 @@ STR_CONFIG_SETTING_ACCOUNTING :Contabilidade
STR_CONFIG_SETTING_VEHICLES :Veículos
STR_CONFIG_SETTING_VEHICLES_PHYSICS :Física
STR_CONFIG_SETTING_VEHICLES_ROUTING :Em rota
STR_CONFIG_SETTING_VEHICLES_ORDERS :Ordens
STR_CONFIG_SETTING_LIMITATIONS :Limitações
STR_CONFIG_SETTING_ACCIDENTS :Desastres / Acidentes
STR_CONFIG_SETTING_GENWORLD :Geração do mundo
STR_CONFIG_SETTING_ENVIRONMENT :Meio Ambiente
STR_CONFIG_SETTING_ENVIRONMENT_TIME :Tempo
STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES :Autoridades
STR_CONFIG_SETTING_ENVIRONMENT_TOWNS :Localidades
STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES :Industrias
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST :Distribuição de Carga
STR_CONFIG_SETTING_ENVIRONMENT_TREES :Árvores
STR_CONFIG_SETTING_AI :Oponentes
STR_CONFIG_SETTING_AI_NPC :Jogadores Computador
STR_CONFIG_SETTING_NETWORK :Rede
@ -2721,9 +2725,9 @@ STR_RAIL_TOOLBAR_MAGLEV_CONSTRUCTION_CAPTION :Construir Magle
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK :{BLACK}Construir linha férrea. Ctrl alterna a construção/remoção de linha férrea. Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL :{BLACK}Construir caminhos-de-ferro usando o modo automático. Ctrl alterna a construção/remoção de caminhos-de-ferro. Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_TRAIN_DEPOT_FOR_BUILDING :{BLACK}Construir depósito ferroviário (para compra e manutenção de comboios). Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Converter linha em ponto de controlo. Ctrl permite juntar pontos de controlo. Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Construir ponto de controlo na ferrovia. Ctrl permite juntar pontos de controlo. Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_STATION :{BLACK}Construir estação ferroviária. Ctrl permite juntar estações. Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Construir sinais ferroviários. Ctrl alterna entre semáforos/sinais elétricos{}Arrastar constrói sinais ao longo de uma linha reta de carris. Ctrl constrói sinais até a próxima junção ou sinal{}Ctrl+Clique alterna entre abrir a janela de seleção de sinais. Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Construir sinais na ferrovia. Ctrl alterna entre semáforos/sinais elétricos{}Arrastar constrói sinais ao longo de uma linha reta de carris. Ctrl constrói sinais até a próxima junção ou sinal{}Ctrl+Clique alterna entre abrir a janela de seleção de sinais. Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_BRIDGE :{BLACK}Construir ponte ferroviária. Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TUNNEL :{BLACK}Construir túnel ferroviário. Shift alterna construir/mostrar custo estimado
STR_RAIL_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR :{BLACK}Alternar entre construir/remover linha férrea, sinais, pontos de passagem e estações. Fixar o Ctrl também remove a linha férrea de pontos de passagem e estações
@ -2811,7 +2815,7 @@ STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT :{BLACK}Construi
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT :{BLACK}Construir garagem para elétricos (para compra e manutenção). Shift alterna construir/mostrar custo estimado
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION :{BLACK}Construir estação de autocarros. Ctrl permite juntar estações. Shift alterna construir/mostrar custo estimado
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION :{BLACK}Construir paragem de elétricos para passageiros. Ctrl permite juntar estações. Shift alterna construir/mostrar custo estimado
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Construir área de carregamento de camiões. Ctrl permite juntar estações. Shift alterna construir/mostrar custo estimado
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY :{BLACK}Construir estação de camiões. Ctrl permite juntar estações. Shift alterna construir/mostrar custo estimado
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION :{BLACK}Construir paragem de elétricos para carga. Ctrl permite juntar estações. Shift alterna construir/mostrar custo estimado
STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD :{BLACK}Ativar/Desativar estradas de sentido único
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE :{BLACK}Construir ponte rodoviária. Shift alterna construir/mostrar custo estimado
@ -2836,7 +2840,7 @@ STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP :{BLACK}Selecion
STR_STATION_BUILD_BUS_ORIENTATION :{WHITE}Orientação da estação de autocarros
STR_STATION_BUILD_BUS_ORIENTATION_TOOLTIP :{BLACK}Seleccionar a orientação da estação de autocarros
STR_STATION_BUILD_TRUCK_ORIENTATION :{WHITE}Orientação da estação de carga
STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP :{BLACK}Seleccionar a orientação da estação de carregamento de camiões
STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP :{BLACK}Selecionar a orientação da estação de camiões
STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION :{WHITE}Orientação da Estação de Eléctricos de Passageiros
STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION_TOOLTIP :{BLACK}Seleccionar orientação da estação de eléctricos
STR_STATION_BUILD_CARGO_TRAM_ORIENTATION :{WHITE}Orientação da Estação de Eléctricos
@ -3080,7 +3084,7 @@ STR_LAI_TREE_NAME_CACTUS_PLANTS :Cactos
STR_LAI_STATION_DESCRIPTION_RAILROAD_STATION :Estação ferroviária
STR_LAI_STATION_DESCRIPTION_AIRCRAFT_HANGAR :Hangar
STR_LAI_STATION_DESCRIPTION_AIRPORT :Aeroporto
STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA :Área de carregamento de camiões
STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA :Estação de camiões
STR_LAI_STATION_DESCRIPTION_BUS_STATION :Estação de autocarros
STR_LAI_STATION_DESCRIPTION_SHIP_DOCK :Doca
STR_LAI_STATION_DESCRIPTION_BUOY :Bóia

@ -1147,6 +1147,7 @@ STR_GAME_OPTIONS_CURRENCY_HKD :Гонконг
STR_GAME_OPTIONS_CURRENCY_INR :Индийская рупия
STR_GAME_OPTIONS_CURRENCY_IDR :Индонезийская рупия
STR_GAME_OPTIONS_CURRENCY_MYR :Малайзийский ринггит
STR_GAME_OPTIONS_CURRENCY_LVL :Латвийский лат
STR_GAME_OPTIONS_AUTOSAVE_FRAME :{BLACK}Автосохранение
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}Интервал автосохранения игры
@ -2886,9 +2887,9 @@ STR_RAIL_TOOLBAR_MAGLEV_CONSTRUCTION_CAPTION :Магнитн
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK :{BLACK}Строительство железной дороги. При нажатом Ctrl - удаление путей. При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL :{BLACK}Строительство ж/д путей в автоматическом режиме. При нажатом Ctrl - удаление путей. При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_TRAIN_DEPOT_FOR_BUILDING :{BLACK}Строительство депо (для приобретения и обслуживания поездов). При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Установка на рельсах точек пути. Нажатие Ctrl позволяет объединять точки. При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}Установка на рельсах маршрутных точек. Нажатие Ctrl позволяет объединять точки. При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_STATION :{BLACK}Строительство ж/д станций. Нажатие Ctrl позволяет объединять станции. При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Установка сигналов. Ctrl переключает семафоры/светофоры.{}Перетаскиванием можно строить сигналы на прямом участке пути. С нажатым Ctrl - строительство сигналов до ближайшего пересечения или сигнала.{}Ctrl+щелчок переключает открытие окна выбора сигналов. При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}Установка сигналов на ж/д путях. Ctrl переключает семафоры/светофоры.{}Перетаскиванием можно строить сигналы на прямом участке пути. С нажатым Ctrl - строительство сигналов до ближайшего пересечения или сигнала.{}Ctrl+щелчок переключает открытие окна выбора сигналов. При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_BRIDGE :{BLACK}Строительство ж/д мостов. При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TUNNEL :{BLACK}Строительство ж/д туннелей. При нажатом Shift - оценка стоимости строительства.
STR_RAIL_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR :{BLACK}Переключение между строительством и удалением ж/д путей, сигналов, станций. При нажатом Ctrl убирает станции с рельсами.

@ -379,6 +379,10 @@ STR_COLOUR_WHITE :Bela
STR_COLOUR_RANDOM :Nasumična
###length 17
STR_COLOUR_SECONDARY_GREEN :Zelena
STR_COLOUR_SECONDARY_ORANGE :Narandžasta
STR_COLOUR_SECONDARY_BROWN :Braon
STR_COLOUR_SECONDARY_SAME_AS_PRIMARY :Identično primarnom
# Units used in OpenTTD
@ -678,6 +682,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Obriši sve por
# About menu
STR_ABOUT_MENU_LAND_BLOCK_INFO :Podaci o zemljištu
STR_ABOUT_MENU_HELP :Pomoć & priručnici
STR_ABOUT_MENU_TOGGLE_CONSOLE :Uključi/isključi konzolu
STR_ABOUT_MENU_AI_DEBUG :Korekcija VI / skripte igre
STR_ABOUT_MENU_SCREENSHOT :Sačuvaj sliku
@ -1106,12 +1111,16 @@ STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT :{BLACK}Kopiraj
# Game options window
STR_GAME_OPTIONS_CAPTION :{WHITE}Opcije
STR_GAME_OPTIONS_TAB_GRAPHICS :Grrafika
STR_GAME_OPTIONS_SFX_VOLUME :Zvučni efekti
STR_GAME_OPTIONS_VOLUME_0 :0%
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}Valuta
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}Izbor valute
STR_GAME_OPTIONS_CURRENCY_CODE :{STRING} ({STRING})
###length 43
STR_GAME_OPTIONS_CURRENCY_GBP :Britanska funta
@ -1163,6 +1172,7 @@ STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}Izbor vr
# Autosave dropdown
###length 5
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF :Isključeno
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_10_MINUTES :Svakih 10 minuta
STR_GAME_OPTIONS_LANGUAGE :{BLACK}Jezik
STR_GAME_OPTIONS_LANGUAGE_TOOLTIP :{BLACK}Odaberi jezik za interfejs
@ -1199,6 +1209,7 @@ STR_GAME_OPTIONS_GUI_SCALE_3X :3x
STR_GAME_OPTIONS_GUI_SCALE_4X :4x
STR_GAME_OPTIONS_GUI_SCALE_5X :5x
STR_GAME_OPTIONS_PARTICIPATE_SURVEY_LINK_TOOLTIP :{BLACK}Ovo otvara pretraživač sa više informacija o automatskim anketama
STR_GAME_OPTIONS_GRAPHICS :{BLACK}Grafike
@ -1219,6 +1230,7 @@ STR_GAME_OPTIONS_BASE_MUSIC :{BLACK}Osnovni
STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP :{BLACK}Odaberi željeni skup osnovne muzike
STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP :{BLACK}Dodatni podaci o osnovnom skupu muzike
STR_BASESET_STATUS :{STRING} {RED}({NUM} fajl{P '' a ovi} nedostaj{P e e u}/{P je su su} korumpiran{P '' a i}
STR_ERROR_RESOLUTION_LIST_FAILED :{WHITE}Neuspešno dobijanje spiska podržanih rezolucija
STR_ERROR_FULLSCREEN_FAILED :{WHITE}Neuspešno prebacivanje u ceo ekran
@ -1381,9 +1393,11 @@ STR_CONFIG_SETTING_HORIZONTAL_POS_LEFT :Levo
STR_CONFIG_SETTING_HORIZONTAL_POS_CENTER :Sredina
STR_CONFIG_SETTING_HORIZONTAL_POS_RIGHT :Desno
STR_CONFIG_SETTING_SECONDS_VALUE :{COMMA}{NBSP}sekund{P a e e}
STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN :Najveći zajam na početku: {STRING}
STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_HELPTEXT :Najveći iznos koji preduzeće može da pozajmi (ne uzimajući u obzir inflaciju)
STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_VALUE :{CURRENCY_LONG}
###setting-zero-is-special
STR_CONFIG_SETTING_INTEREST_RATE :Kamatna stopa: {STRING}
@ -1790,6 +1804,8 @@ STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS_HELPTEXT :Omogući upotre
STR_CONFIG_SETTING_LOADING_INDICATORS :Koristiti pokazatelj utovarivanja: {STRING}
STR_CONFIG_SETTING_LOADING_INDICATORS_HELPTEXT :Odaberi da li će se prikazati indikatori utovara i istovara iznad vozila
STR_CONFIG_SETTING_TIMETABLE_MODE :Jedinica vremena za red vožnje: {STRING}
STR_CONFIG_SETTING_TIMETABLE_MODE_HELPTEXT :Izaberi jedinicu vremena koja se koristi za redove vožnje
###length 3
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE :Prikazivanje polaska i dolaska u rasporedima: {STRING}
@ -2123,6 +2139,7 @@ STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperijalne mer
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metričke mere (km/h)
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s)
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Jedinice igre (pločica/dan)
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Čvorovi
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Mere za snagu vozila: {STRING}
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Kada je prikazana snaga vozila u korisničkom interfejsu, prikaži je u odabranim jedinicama
@ -2176,10 +2193,12 @@ STR_CONFIG_SETTING_LIMITATIONS :Ograničenja
STR_CONFIG_SETTING_ACCIDENTS :Katastrofe / Nezgode
STR_CONFIG_SETTING_GENWORLD :Stvaranje sveta
STR_CONFIG_SETTING_ENVIRONMENT :Okoliš
STR_CONFIG_SETTING_ENVIRONMENT_TIME :Vreme
STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES :Vlasti
STR_CONFIG_SETTING_ENVIRONMENT_TOWNS :Naselja
STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES :Fabrike
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST :Distribucija tereta
STR_CONFIG_SETTING_ENVIRONMENT_TREES :Drveće
STR_CONFIG_SETTING_AI :Suparnici
STR_CONFIG_SETTING_AI_NPC :Računar
STR_CONFIG_SETTING_NETWORK :Mreža
@ -2221,6 +2240,7 @@ STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}Dodela {
# Video initalization errors
STR_VIDEO_DRIVER_ERROR :{WHITE}Greška sa podešavanjima videa...
STR_VIDEO_DRIVER_ERROR_NO_HARDWARE_ACCELERATION :{WHITE}... kompatibilan GPU nije pronađen. Hardversko ubrzanje je isključeno
STR_VIDEO_DRIVER_ERROR_HARDWARE_ACCELERATION_CRASH :{WHITE}... GPU drajver je oborio igru. Hardversko ubrzanje je onemogućeno
# Intro window
STR_INTRO_CAPTION :{WHITE}OpenTTD {REV}
@ -2277,6 +2297,9 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Da li z
STR_ABANDON_SCENARIO_QUERY :{YELLOW}Da li zaista želiš da napustiš ovaj scenario?
# Help window
STR_HELP_WINDOW_DOCUMENTS :{BLACK}Dokumenti
STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Poznati Bagovi
STR_HELP_WINDOW_LICENSE :{BLACK}Licenca
# Cheat window
STR_CHEATS :{WHITE}Varanja
@ -2301,9 +2324,11 @@ STR_LIVERY_TRAIN_TOOLTIP :{BLACK}Prikaži
STR_LIVERY_ROAD_VEHICLE_TOOLTIP :{BLACK}Prikaži šeme boja drumskih vozila
STR_LIVERY_SHIP_TOOLTIP :{BLACK}Prikaži šeme boja brodova
STR_LIVERY_AIRCRAFT_TOOLTIP :{BLACK}Prikaži šeme boja letelica
STR_LIVERY_SHIP_GROUP_TOOLTIP :{BLACK}Prikaži boje grupa brodova
STR_LIVERY_PRIMARY_TOOLTIP :{BLACK}Izaberi osnovnu boju za označenu kategoriju. Ctrl+klik će izabrati ovu boju za sve kategorije
STR_LIVERY_SECONDARY_TOOLTIP :{BLACK}Izaberi dodatnu boju za označenu kategoriju. Ctrl+klik će izabrati ovu boju za sve kategorije
STR_LIVERY_PANEL_TOOLTIP :{BLACK}Označi šemu boja za izmenu, ili više njih koristeći Ctrl+klik. Klikom na kutijicu aktivira se upotreba date šeme
STR_LIVERY_AIRCRAFT_GROUP_EMPTY :Nijedna grupa letelica nije formirana
###length 23
STR_LIVERY_DEFAULT :Uobičajene boje
@ -2525,6 +2550,7 @@ STR_NETWORK_CLIENT_LIST_NEW_COMPANY :(novo preduzeć
STR_NETWORK_CLIENT_LIST_NEW_COMPANY_TOOLTIP :{BLACK}Napravi novo preduzeće i pridruži mu se
STR_NETWORK_CLIENT_LIST_PLAYER_ICON_SELF_TOOLTIP :{BLACK}Ovo si ti
STR_NETWORK_CLIENT_LIST_PLAYER_ICON_HOST_TOOLTIP :{BLACK}Ovo je domaćin igre
STR_NETWORK_CLIENT_LIST_CLIENT_COMPANY_COUNT :{BLACK}{NUM} klijen{P t ata ata} - {NUM}/{NUM} preduzeć{P e a a}
# Matches ConnectionType
###length 5
@ -2551,6 +2577,9 @@ STR_NETWORK_ASK_RELAY_NO :{BLACK}Ne
STR_NETWORK_ASK_RELAY_YES_ONCE :{BLACK}Da, jednom
STR_NETWORK_ASK_RELAY_YES_ALWAYS :{BLACK}Da, ne pitaj ponovo
STR_NETWORK_ASK_SURVEY_TEXT :Da li želiš da učestvuješ u automatskoj anketi?{}OpenTTD će slati anketu kada izlaziš iz igre.{}Možeš promentiti ovo podešavanje u bilo kom trenutku pod "Opcijama igre".
STR_NETWORK_ASK_SURVEY_PREVIEW :Pregledaj rezultate ankete
STR_NETWORK_ASK_SURVEY_LINK :O anketi i privatnosti
STR_NETWORK_SPECTATORS :Posmatrači
@ -2867,6 +2896,8 @@ STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP :{BLACK}Povećav
STR_SELECT_RAIL_BRIDGE_CAPTION :{WHITE}Izbor železničkog mosta
STR_SELECT_ROAD_BRIDGE_CAPTION :{WHITE}Izbor drumskog mosta
STR_SELECT_BRIDGE_SELECTION_TOOLTIP :{BLACK}Izbor mosta - gradnja se potvrđuje klikom na željeni most
STR_SELECT_BRIDGE_INFO_NAME :{GOLD}{STRING}
STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED :{GOLD}{STRING},{} {VELOCITY}
STR_BRIDGE_NAME_SUSPENSION_STEEL :Viseći, čelični
STR_BRIDGE_NAME_GIRDER_STEEL :Gredni, čelični
STR_BRIDGE_NAME_CANTILEVER_STEEL :Obešeni, čelični
@ -3298,6 +3329,7 @@ STR_MAPGEN_MAPSIZE :{BLACK}Veličin
STR_MAPGEN_MAPSIZE_TOOLTIP :{BLACK}Izaberi veličinu mape u pločicama. Broj dostupnih pločica će biti neznatno manji
STR_MAPGEN_BY :{BLACK}*
STR_MAPGEN_NUMBER_OF_TOWNS :{BLACK}Broj naselja:
STR_MAPGEN_NUMBER_OF_TOWNS_TOOLTIP :{BLACK}Izaberi gustinu gradova, ili unesi broj
STR_MAPGEN_TOWN_NAME_LABEL :{BLACK}Imena naselja:
STR_MAPGEN_TOWN_NAME_DROPDOWN_TOOLTIP :{BLACK}Izaberi stil imena naselja
STR_MAPGEN_DATE :{BLACK}Datum:
@ -3319,6 +3351,7 @@ STR_MAPGEN_QUANTITY_OF_RIVERS :{BLACK}Broj rek
STR_MAPGEN_SMOOTHNESS :{BLACK}Postepenost:
STR_MAPGEN_VARIETY :{BLACK}Raznolikost:
STR_MAPGEN_GENERATE :{WHITE}Napravi
STR_MAPGEN_GENERATE_TOOLTIP :{BLACK}Kreiraj svet i igraj OpenTTD!
STR_MAPGEN_NEWGRF_SETTINGS :{BLACK}Podešavanja NewGRF
STR_MAPGEN_NEWGRF_SETTINGS_TOOLTIP :{BLACK}Prikazuje podešavanja NewGRF
STR_MAPGEN_AI_SETTINGS :{BLACK}Podešavanja VI
@ -4677,6 +4710,7 @@ STR_TIMETABLE_STATUS_ON_TIME :{BLACK}Vozilo t
STR_TIMETABLE_STATUS_LATE :{BLACK}Vozilo trenutno kasni za {STRING} od rasporeda
STR_TIMETABLE_STATUS_EARLY :{BLACK}Vozilo trenutno žuri za {STRING} od rasporeda
STR_TIMETABLE_STATUS_NOT_STARTED :{BLACK}Ovaj raspored još nije počeo
STR_TIMETABLE_STATUS_START_IN_SECONDS :{BLACK}Ovaj red vožnje će započeti za {COMMA} sekund{P u e e}
@ -4702,6 +4736,7 @@ STR_TIMETABLE_EXPECTED :{BLACK}Očekiva
STR_TIMETABLE_SCHEDULED :{BLACK}Po planu
STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Prebacivanje između prikaza očekivanog i po planu
STR_TIMETABLE_DEPARTURE_SECONDS_IN_FUTURE :D: {COLOUR}{COMMA} sek
# Date window (for timetable)
@ -4793,6 +4828,7 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN
# Textfile window
STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING}
STR_TEXTFILE_WRAP_TEXT :{WHITE}Prelomiti tekst
STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK} Prelomiti tekst prozora tako da stane bez potrebe skrolovanja
STR_TEXTFILE_VIEW_README :{BLACK}Prikaži uputstvo
@ -4802,6 +4838,7 @@ STR_TEXTFILE_VIEW_LICENCE :{BLACK}Licenca
STR_TEXTFILE_README_CAPTION :{WHITE}{STRING} uputstvo za {STRING}
STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} izmene od {STRING}
STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} licenca od {STRING}
STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}OpenTTD dokument '{STRING}'
# Vehicle loading indicators
@ -5240,6 +5277,7 @@ STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION :{WHITE}... prev
STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE :{WHITE}... letelica nema dovoljan domet
# Extra messages which go on the third line of errors, explaining why orders failed
STR_ERROR_NO_BUS_STATION :{WHITE}Nema autobuske stanice
# Timetable related errors
STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Raspored se ne može dodeliti vozilu...
@ -5729,6 +5767,7 @@ STR_JUST_COMMA :{COMMA}
STR_JUST_CURRENCY_SHORT :{CURRENCY_SHORT}
STR_JUST_CURRENCY_LONG :{CURRENCY_LONG}
STR_JUST_CARGO_LIST :{CARGO_LIST}
STR_JUST_DECIMAL :{DECIMAL}
STR_JUST_INT :{NUM}
STR_JUST_DATE_TINY :{DATE_TINY}
STR_JUST_DATE_SHORT :{DATE_SHORT}

@ -207,7 +207,7 @@ STR_COLOUR_SECONDARY_ORANGE :橘黄色
STR_COLOUR_SECONDARY_BROWN :棕 色
STR_COLOUR_SECONDARY_GREY :浅灰色
STR_COLOUR_SECONDARY_WHITE :白 色
STR_COLOUR_SECONDARY_SAME_AS_PRIMARY :主色调相同
STR_COLOUR_SECONDARY_SAME_AS_PRIMARY :主色调
# Units used in OpenTTD
@ -1002,6 +1002,7 @@ STR_GAME_OPTIONS_CURRENCY_HKD :港币
STR_GAME_OPTIONS_CURRENCY_INR :印度卢布
STR_GAME_OPTIONS_CURRENCY_IDR :印尼盾
STR_GAME_OPTIONS_CURRENCY_MYR :马来西亚林吉特
STR_GAME_OPTIONS_CURRENCY_LVL :拉脱维亚拉特
STR_GAME_OPTIONS_AUTOSAVE_FRAME :{BLACK}自动保存
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}选择自动保存的周期
@ -1359,7 +1360,7 @@ STR_CONFIG_SETTING_SIGNALSIDE :显示信号灯
STR_CONFIG_SETTING_SIGNALSIDE_HELPTEXT :选择在铁路哪一边放置信号灯
###length 3
STR_CONFIG_SETTING_SIGNALSIDE_LEFT :在左边
STR_CONFIG_SETTING_SIGNALSIDE_DRIVING_SIDE :在前进方向
STR_CONFIG_SETTING_SIGNALSIDE_DRIVING_SIDE :道路通行方向
STR_CONFIG_SETTING_SIGNALSIDE_RIGHT :在右侧
STR_CONFIG_SETTING_SHOWFINANCES :在年终显示财务报表:{STRING}
@ -1549,8 +1550,8 @@ STR_CONFIG_SETTING_SE_FLAT_WORLD_HEIGHT :由水面场景
STR_CONFIG_SETTING_EDGES_NOT_EMPTY :{WHITE}一个或多个北边的地块不是闲置的
STR_CONFIG_SETTING_EDGES_NOT_WATER :{WHITE}一个或多个地图某边的地块不是水域
STR_CONFIG_SETTING_STATION_SPREAD :车站占地上限格数 {STRING}
STR_CONFIG_SETTING_STATION_SPREAD_HELPTEXT :设置车站最大占地面积,注意:太大影响游戏速度
STR_CONFIG_SETTING_STATION_SPREAD :最大车站范围 {STRING}
STR_CONFIG_SETTING_STATION_SPREAD_HELPTEXT :设置车站的最大范围,即最大长宽。请注意较高数值会使游戏变慢。
STR_CONFIG_SETTING_SERVICEATHELIPAD :直升机在降落平台自动保养:{STRING}
STR_CONFIG_SETTING_SERVICEATHELIPAD_HELPTEXT :直升飞机在降落平台自动保养,即使机场没有机库
@ -2723,7 +2724,7 @@ STR_RAIL_TOOLBAR_MAGLEV_CONSTRUCTION_CAPTION :磁悬浮铁路
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK :{BLACK}建设轨道。按住 Ctrl 键切换建设/移除轨道。按住 Shift 键显示预计费用。
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL :{BLACK}使用多向路轨工具铺设轨道。按住 Ctrl 键切换建设/移除轨道。按住 Shift 键显示预计费用。
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_TRAIN_DEPOT_FOR_BUILDING :{BLACK}建设列车车库(可以购买或维护列车)按住 Shift 键显示预计费用。
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}将铁路变为路点。按住 Ctrl 键允许合并路点。按住 Shift 键显示预计费用。
STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT :{BLACK}建设铁路路点。按住 Ctrl 键允许合并路点。按住 Shift 键显示预计费用。
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_STATION :{BLACK}建设火车站。按住 Ctrl 键允许合并站台。按住 Shift 键显示预计费用。
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS :{BLACK}建造铁路信号。{} 按住 Ctrl 键点选铁路,系统会切换悬臂式/电子式信号灯,或者更改被点选信号灯的种类{} 在一段直线铁路上拖拽,系统会依照设置的信号间距,沿铁路建立信号灯。如果按住 Ctrl 键拖拽,系统会建造信号灯至拖拽方向前的下一个道岔{} 如果按住 Shift 键点击铁路或在铁路上拖拽,系统会显示建置成本但不设置信号灯{} 如果按住 Ctrl 键点击此键,系统会切换信号灯选择窗口的显示状态
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_BRIDGE :{BLACK}建设铁路桥梁。按住 Shift 键显示预计费用。

@ -306,7 +306,7 @@ public:
}
/** Bare constructor, only for save/load. */
LinkGraph() : cargo(CT_INVALID), last_compression(0) {}
LinkGraph() : cargo(INVALID_CARGO), last_compression(0) {}
/**
* Real constructor.
* @param cargo Cargo the link graph is about.

@ -23,7 +23,7 @@
* Only the cargo type of the most saturated linkgraph is taken into account.
*/
struct LinkProperties {
LinkProperties() : capacity(0), usage(0), planned(0), cargo(CT_INVALID), time(0), shared(false) {}
LinkProperties() : capacity(0), usage(0), planned(0), cargo(INVALID_CARGO), time(0), shared(false) {}
/** Return the usage of the link to display. */
uint Usage() const { return std::max(this->usage, this->planned); }

@ -74,7 +74,7 @@
* @param is_full_loading If the vehicle is full loading.
*/
LinkRefresher::LinkRefresher(Vehicle *vehicle, HopSet *seen_hops, bool allow_merge, bool is_full_loading, CargoTypes cargo_mask) :
vehicle(vehicle), seen_hops(seen_hops), cargo(CT_INVALID), allow_merge(allow_merge),
vehicle(vehicle), seen_hops(seen_hops), cargo(INVALID_CARGO), allow_merge(allow_merge),
is_full_loading(is_full_loading), cargo_mask(cargo_mask)
{
memset(this->capacities, 0, sizeof(this->capacities));

@ -60,7 +60,7 @@ protected:
struct Hop {
OrderID from; ///< Last order where vehicle could interact with cargo or absolute first order.
OrderID to; ///< Next order to be processed.
CargoID cargo; ///< Cargo the consist is probably carrying or CT_INVALID if unknown.
CargoID cargo; ///< Cargo the consist is probably carrying or INVALID_CARGO if unknown.
uint8_t flags; ///< Flags, for branches
/**

@ -868,7 +868,7 @@ static CargoTypes TranslateRefitMask(uint32_t refit_mask)
CargoTypes result = 0;
for (uint8_t bit : SetBitIterator(refit_mask)) {
CargoID cargo = GetCargoTranslation(bit, _cur.grffile, true);
if (cargo != CT_INVALID) SetBit(result, cargo);
if (cargo != INVALID_CARGO) SetBit(result, cargo);
}
return result;
}
@ -1094,15 +1094,15 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop
if (ctype == 0xFF) {
/* 0xFF is specified as 'use first refittable' */
ei->cargo_type = CT_INVALID;
ei->cargo_type = INVALID_CARGO;
} else if (_cur.grffile->grf_version >= 8) {
/* Use translated cargo. Might result in CT_INVALID (first refittable), if cargo is not defined. */
/* Use translated cargo. Might result in INVALID_CARGO (first refittable), if cargo is not defined. */
ei->cargo_type = GetCargoTranslation(ctype, _cur.grffile);
} else if (ctype < NUM_CARGO) {
/* Use untranslated cargo. */
ei->cargo_type = ctype;
} else {
ei->cargo_type = CT_INVALID;
ei->cargo_type = INVALID_CARGO;
grfmsg(2, "RailVehicleChangeInfo: Invalid cargo type %d, using first refittable", ctype);
}
break;
@ -1259,7 +1259,7 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop
ctt = 0;
while (count--) {
CargoID ctype = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
if (ctype == CT_INVALID) continue;
if (ctype == INVALID_CARGO) continue;
SetBit(ctt, ctype);
}
break;
@ -1356,15 +1356,15 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint engine, int numinfo, int prop
if (ctype == 0xFF) {
/* 0xFF is specified as 'use first refittable' */
ei->cargo_type = CT_INVALID;
ei->cargo_type = INVALID_CARGO;
} else if (_cur.grffile->grf_version >= 8) {
/* Use translated cargo. Might result in CT_INVALID (first refittable), if cargo is not defined. */
/* Use translated cargo. Might result in INVALID_CARGO (first refittable), if cargo is not defined. */
ei->cargo_type = GetCargoTranslation(ctype, _cur.grffile);
} else if (ctype < NUM_CARGO) {
/* Use untranslated cargo. */
ei->cargo_type = ctype;
} else {
ei->cargo_type = CT_INVALID;
ei->cargo_type = INVALID_CARGO;
grfmsg(2, "RailVehicleChangeInfo: Invalid cargo type %d, using first refittable", ctype);
}
break;
@ -1469,7 +1469,7 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint engine, int numinfo, int prop
ctt = 0;
while (count--) {
CargoID ctype = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
if (ctype == CT_INVALID) continue;
if (ctype == INVALID_CARGO) continue;
SetBit(ctt, ctype);
}
break;
@ -1552,15 +1552,15 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint engine, int numinfo, int prop
if (ctype == 0xFF) {
/* 0xFF is specified as 'use first refittable' */
ei->cargo_type = CT_INVALID;
ei->cargo_type = INVALID_CARGO;
} else if (_cur.grffile->grf_version >= 8) {
/* Use translated cargo. Might result in CT_INVALID (first refittable), if cargo is not defined. */
/* Use translated cargo. Might result in INVALID_CARGO (first refittable), if cargo is not defined. */
ei->cargo_type = GetCargoTranslation(ctype, _cur.grffile);
} else if (ctype < NUM_CARGO) {
/* Use untranslated cargo. */
ei->cargo_type = ctype;
} else {
ei->cargo_type = CT_INVALID;
ei->cargo_type = INVALID_CARGO;
grfmsg(2, "ShipVehicleChangeInfo: Invalid cargo type %d, using first refittable", ctype);
}
break;
@ -1653,7 +1653,7 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint engine, int numinfo, int prop
ctt = 0;
while (count--) {
CargoID ctype = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
if (ctype == CT_INVALID) continue;
if (ctype == INVALID_CARGO) continue;
SetBit(ctt, ctype);
}
break;
@ -1815,7 +1815,7 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint engine, int numinfo, int
ctt = 0;
while (count--) {
CargoID ctype = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
if (ctype == CT_INVALID) continue;
if (ctype == INVALID_CARGO) continue;
SetBit(ctt, ctype);
}
break;
@ -2537,7 +2537,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con
uint8_t cargo_part = GB(cargotypes, 8 * j, 8);
CargoID cargo = GetCargoTranslation(cargo_part, _cur.grffile);
if (cargo == CT_INVALID) {
if (cargo == INVALID_CARGO) {
/* Disable acceptance of invalid cargo type */
housespec->cargo_acceptance[j] = 0;
} else {
@ -2555,7 +2555,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con
byte count = buf->ReadByte();
for (byte j = 0; j < count; j++) {
CargoID cargo = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
if (cargo != CT_INVALID) SetBit(housespec->watched_cargoes, cargo);
if (cargo != INVALID_CARGO) SetBit(housespec->watched_cargoes, cargo);
}
break;
}
@ -2583,7 +2583,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con
housespec->accepts_cargo[i] = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
housespec->cargo_acceptance[i] = buf->ReadByte();
} else {
housespec->accepts_cargo[i] = CT_INVALID;
housespec->accepts_cargo[i] = INVALID_CARGO;
housespec->cargo_acceptance[i] = 0;
}
}
@ -3344,7 +3344,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr
/* Tile acceptance can be negative to counteract the INDTILE_SPECIAL_ACCEPTS_ALL_CARGO flag */
tsp->acceptance[i] = (int8_t)buf->ReadByte();
} else {
tsp->accepts_cargo[i] = CT_INVALID;
tsp->accepts_cargo[i] = INVALID_CARGO;
tsp->acceptance[i] = 0;
}
}
@ -3471,8 +3471,8 @@ static bool ValidateIndustryLayout(const IndustryTileLayout &layout)
}
bool have_regular_tile = false;
for (size_t i = 0; i < size; i++) {
if (layout[i].gfx != GFX_WATERTILE_SPECIALCHECK) {
for (const auto &tilelayout : layout) {
if (tilelayout.gfx != GFX_WATERTILE_SPECIALCHECK) {
have_regular_tile = true;
break;
}
@ -3791,7 +3791,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
CargoID cargo = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
indsp->produced_cargo[i] = cargo;
} else {
indsp->produced_cargo[i] = CT_INVALID;
indsp->produced_cargo[i] = INVALID_CARGO;
}
}
break;
@ -3809,7 +3809,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
CargoID cargo = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
indsp->accepts_cargo[i] = cargo;
} else {
indsp->accepts_cargo[i] = CT_INVALID;
indsp->accepts_cargo[i] = INVALID_CARGO;
}
}
break;
@ -6246,7 +6246,7 @@ static void NewSpriteGroup(ByteReader *buf)
for (uint i = 0; i < group->num_input; i++) {
byte rawcargo = buf->ReadByte();
CargoID cargo = GetCargoTranslation(rawcargo, _cur.grffile);
if (cargo == CT_INVALID) {
if (cargo == INVALID_CARGO) {
/* The mapped cargo is invalid. This is permitted at this point,
* as long as the result is not used. Mark it invalid so this
* can be tested later. */
@ -6268,7 +6268,7 @@ static void NewSpriteGroup(ByteReader *buf)
for (uint i = 0; i < group->num_output; i++) {
byte rawcargo = buf->ReadByte();
CargoID cargo = GetCargoTranslation(rawcargo, _cur.grffile);
if (cargo == CT_INVALID) {
if (cargo == INVALID_CARGO) {
/* Mark this result as invalid to use */
group->version = 0xFF;
} else if (std::find(group->cargo_output, group->cargo_output + i, cargo) != group->cargo_output + i) {
@ -6303,14 +6303,14 @@ static void NewSpriteGroup(ByteReader *buf)
static CargoID TranslateCargo(uint8_t feature, uint8_t ctype)
{
/* Special cargo types for purchase list and stations */
if ((feature == GSF_STATIONS || feature == GSF_ROADSTOPS) && ctype == 0xFE) return CT_DEFAULT_NA;
if (ctype == 0xFF) return CT_PURCHASE;
if ((feature == GSF_STATIONS || feature == GSF_ROADSTOPS) && ctype == 0xFE) return SpriteGroupCargo::SG_DEFAULT_NA;
if (ctype == 0xFF) return SpriteGroupCargo::SG_PURCHASE;
if (_cur.grffile->cargo_list.empty()) {
/* No cargo table, so use bitnum values */
if (ctype >= 32) {
grfmsg(1, "TranslateCargo: Cargo bitnum %d out of range (max 31), skipping.", ctype);
return CT_INVALID;
return INVALID_CARGO;
}
for (const CargoSpec *cs : CargoSpec::Iterate()) {
@ -6321,30 +6321,30 @@ static CargoID TranslateCargo(uint8_t feature, uint8_t ctype)
}
grfmsg(5, "TranslateCargo: Cargo bitnum %d not available in this climate, skipping.", ctype);
return CT_INVALID;
return INVALID_CARGO;
}
/* Check if the cargo type is out of bounds of the cargo translation table */
if (ctype >= _cur.grffile->cargo_list.size()) {
grfmsg(1, "TranslateCargo: Cargo type %d out of range (max %d), skipping.", ctype, (unsigned int)_cur.grffile->cargo_list.size() - 1);
return CT_INVALID;
return INVALID_CARGO;
}
/* Look up the cargo label from the translation table */
CargoLabel cl = _cur.grffile->cargo_list[ctype];
if (cl == 0) {
grfmsg(5, "TranslateCargo: Cargo type %d not available in this climate, skipping.", ctype);
return CT_INVALID;
return INVALID_CARGO;
}
ctype = GetCargoIDByLabel(cl);
if (ctype == CT_INVALID) {
CargoID cid = GetCargoIDByLabel(cl);
if (cid == INVALID_CARGO) {
grfmsg(5, "TranslateCargo: Cargo '%c%c%c%c' unsupported, skipping.", GB(cl, 24, 8), GB(cl, 16, 8), GB(cl, 8, 8), GB(cl, 0, 8));
return CT_INVALID;
return INVALID_CARGO;
}
grfmsg(6, "TranslateCargo: Cargo '%c%c%c%c' mapped to cargo type %d.", GB(cl, 24, 8), GB(cl, 16, 8), GB(cl, 8, 8), GB(cl, 0, 8), ctype);
return ctype;
grfmsg(6, "TranslateCargo: Cargo '%c%c%c%c' mapped to cargo type %d.", GB(cl, 24, 8), GB(cl, 16, 8), GB(cl, 8, 8), GB(cl, 0, 8), cid);
return cid;
}
@ -6407,8 +6407,8 @@ static void VehicleMapSpriteGroup(ByteReader *buf, byte feature, uint8_t idcount
grfmsg(8, "VehicleMapSpriteGroup: * [%d] Cargo type 0x%X, group id 0x%02X", c, ctype, groupid);
ctype = TranslateCargo(feature, ctype);
if (ctype == CT_INVALID) continue;
CargoID cid = TranslateCargo(feature, ctype);
if (cid == INVALID_CARGO) continue;
for (uint i = 0; i < idcount; i++) {
EngineID engine = engines[i];
@ -6416,9 +6416,9 @@ static void VehicleMapSpriteGroup(ByteReader *buf, byte feature, uint8_t idcount
grfmsg(7, "VehicleMapSpriteGroup: [%d] Engine %d...", i, engine);
if (wagover) {
SetWagonOverrideSprites(engine, ctype, GetGroupByID(groupid), last_engines, last_engines_count);
SetWagonOverrideSprites(engine, cid, GetGroupByID(groupid), last_engines, last_engines_count);
} else {
SetCustomEngineSprites(engine, ctype, GetGroupByID(groupid));
SetCustomEngineSprites(engine, cid, GetGroupByID(groupid));
}
}
}
@ -6432,9 +6432,9 @@ static void VehicleMapSpriteGroup(ByteReader *buf, byte feature, uint8_t idcount
EngineID engine = engines[i];
if (wagover) {
SetWagonOverrideSprites(engine, CT_DEFAULT, GetGroupByID(groupid), last_engines, last_engines_count);
SetWagonOverrideSprites(engine, SpriteGroupCargo::SG_DEFAULT, GetGroupByID(groupid), last_engines, last_engines_count);
} else {
SetCustomEngineSprites(engine, CT_DEFAULT, GetGroupByID(groupid));
SetCustomEngineSprites(engine, SpriteGroupCargo::SG_DEFAULT, GetGroupByID(groupid));
SetEngineGRF(engine, _cur.grffile);
}
}
@ -6487,7 +6487,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8_t idcount)
if (!IsValidGroupID(groupid, "StationMapSpriteGroup")) continue;
ctype = TranslateCargo(GSF_STATIONS, ctype);
if (ctype == CT_INVALID) continue;
if (ctype == INVALID_CARGO) continue;
for (uint i = 0; i < idcount; i++) {
StationSpec *statspec = stations[i] >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[stations[i]].get();
@ -6517,7 +6517,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8_t idcount)
continue;
}
statspec->grf_prop.spritegroup[CT_DEFAULT] = GetGroupByID(groupid);
statspec->grf_prop.spritegroup[SpriteGroupCargo::SG_DEFAULT] = GetGroupByID(groupid);
statspec->grf_prop.grffile = _cur.grffile;
statspec->grf_prop.local_id = stations[i];
StationClass::Assign(statspec);
@ -6877,7 +6877,7 @@ static void RoadStopMapSpriteGroup(ByteReader *buf, uint8_t idcount)
if (!IsValidGroupID(groupid, "RoadStopMapSpriteGroup")) continue;
ctype = TranslateCargo(GSF_ROADSTOPS, ctype);
if (ctype == CT_INVALID) continue;
if (ctype == INVALID_CARGO) continue;
for (uint i = 0; i < idcount; i++) {
RoadStopSpec *roadstopspec = (roadstops[i] >= _cur.grffile->roadstops.size()) ? nullptr : _cur.grffile->roadstops[roadstops[i]].get();
@ -6912,7 +6912,7 @@ static void RoadStopMapSpriteGroup(ByteReader *buf, uint8_t idcount)
continue;
}
roadstopspec->grf_prop.spritegroup[CT_DEFAULT] = GetGroupByID(groupid);
roadstopspec->grf_prop.spritegroup[SpriteGroupCargo::SG_DEFAULT] = GetGroupByID(groupid);
roadstopspec->grf_prop.grffile = _cur.grffile;
roadstopspec->grf_prop.local_id = roadstops[i];
RoadStopClass::Assign(roadstopspec);
@ -7732,9 +7732,9 @@ static void SkipIf(ByteReader *buf)
if (condtype >= 0x0B) {
/* Tests that ignore 'param' */
switch (condtype) {
case 0x0B: result = GetCargoIDByLabel(BSWAP32(cond_val)) == CT_INVALID;
case 0x0B: result = GetCargoIDByLabel(BSWAP32(cond_val)) == INVALID_CARGO;
break;
case 0x0C: result = GetCargoIDByLabel(BSWAP32(cond_val)) != CT_INVALID;
case 0x0C: result = GetCargoIDByLabel(BSWAP32(cond_val)) != INVALID_CARGO;
break;
case 0x0D: result = GetRailTypeByLabel(BSWAP32(cond_val)) == INVALID_RAILTYPE;
break;
@ -10587,7 +10587,7 @@ static void CalculateRefitMasks()
CargoTypes original_known_cargoes = 0;
for (int ct = 0; ct != NUM_ORIGINAL_CARGO; ++ct) {
CargoID cid = GetDefaultCargoID(_settings_game.game_creation.landscape, static_cast<CargoType>(ct));
if (cid != CT_INVALID) SetBit(original_known_cargoes, cid);
if (cid != INVALID_CARGO) SetBit(original_known_cargoes, cid);
}
for (Engine *e : Engine::Iterate()) {
@ -10677,7 +10677,7 @@ static void CalculateRefitMasks()
/* Translate cargo_type using the original climate-specific cargo table. */
ei->cargo_type = GetDefaultCargoID(_settings_game.game_creation.landscape, static_cast<CargoType>(ei->cargo_type));
if (ei->cargo_type != CT_INVALID) ClrBit(_gted[engine].ctt_exclude_mask, ei->cargo_type);
if (ei->cargo_type != INVALID_CARGO) ClrBit(_gted[engine].ctt_exclude_mask, ei->cargo_type);
}
/* Compute refittability */
@ -10706,17 +10706,17 @@ static void CalculateRefitMasks()
}
/* Clear invalid cargoslots (from default vehicles or pre-NewCargo GRFs) */
if (ei->cargo_type != CT_INVALID && !HasBit(_cargo_mask, ei->cargo_type)) ei->cargo_type = CT_INVALID;
if (ei->cargo_type != INVALID_CARGO && !HasBit(_cargo_mask, ei->cargo_type)) ei->cargo_type = INVALID_CARGO;
/* 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;
if (!only_defaultcargo && (e->type != VEH_SHIP || e->u.ship.old_refittable) && IsValidCargoID(ei->cargo_type) && !HasBit(ei->refit_mask, ei->cargo_type)) {
ei->cargo_type = INVALID_CARGO;
}
/* Check if this engine's cargo type is valid. If not, set to the first refittable
* cargo type. Finally disable the vehicle, if there is still no cargo. */
if (ei->cargo_type == CT_INVALID && ei->refit_mask != 0) {
if (ei->cargo_type == INVALID_CARGO && ei->refit_mask != 0) {
/* Figure out which CTT to use for the default cargo, if it is 'first refittable'. */
const GRFFile *file = _gted[engine].defaultcargo_grf;
if (file == nullptr) file = e->GetGRF();
@ -10732,12 +10732,12 @@ static void CalculateRefitMasks()
}
}
if (ei->cargo_type == CT_INVALID) {
if (ei->cargo_type == INVALID_CARGO) {
/* Use first refittable cargo slot */
ei->cargo_type = (CargoID)FindFirstBit(ei->refit_mask);
}
}
if (ei->cargo_type == CT_INVALID) ei->climates = 0;
if (ei->cargo_type == INVALID_CARGO) ei->climates = 0;
/* Clear refit_mask for not refittable ships */
if (e->type == VEH_SHIP && !e->u.ship.old_refittable) {
@ -11033,15 +11033,14 @@ static void FinaliseIndustriesArray()
}
}
for (uint j = 0; j < NUM_INDUSTRYTYPES; j++) {
IndustrySpec *indsp = &_industry_specs[j];
if (indsp->enabled && indsp->grf_prop.grffile != nullptr) {
for (uint i = 0; i < 3; i++) {
indsp->conflicting[i] = MapNewGRFIndustryType(indsp->conflicting[i], indsp->grf_prop.grffile->grfid);
for (auto &indsp : _industry_specs) {
if (indsp.enabled && indsp.grf_prop.grffile != nullptr) {
for (auto &conflicting : indsp.conflicting) {
conflicting = MapNewGRFIndustryType(conflicting, indsp.grf_prop.grffile->grfid);
}
}
if (!indsp->enabled) {
indsp->name = STR_NEWGRF_INVALID_INDUSTRYTYPE;
if (!indsp.enabled) {
indsp.name = STR_NEWGRF_INVALID_INDUSTRYTYPE;
}
}
}

@ -85,8 +85,8 @@ private:
};
void AnimateAirportTile(TileIndex tile);
void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoID cargo_type = INVALID_CARGO);
void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID cargo_type = INVALID_CARGO);
uint8_t GetAirportTileAnimationSpeed(TileIndex tile);
bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts);

@ -74,13 +74,13 @@ uint16_t GetCargoCallback(CallbackID callback, uint32_t param1, uint32_t param2,
* @param usebit Defines the meaning of \a cargo for GRF version < 7.
* If true, then \a cargo is a bitnum. If false, then \a cargo is a cargoslot.
* For GRF version >= 7 \a cargo is always a translated cargo bit.
* @return CargoID or CT_INVALID if the cargo is not available.
* @return CargoID or INVALID_CARGO if the cargo is not available.
*/
CargoID GetCargoTranslation(uint8_t cargo, const GRFFile *grffile, bool usebit)
{
/* Pre-version 7 uses the 'climate dependent' ID in callbacks and properties, i.e. cargo is the cargo ID */
if (grffile->grf_version < 7 && !usebit) {
if (cargo >= CargoSpec::GetArraySize() || !CargoSpec::Get(cargo)->IsValid()) return CT_INVALID;
if (cargo >= CargoSpec::GetArraySize() || !CargoSpec::Get(cargo)->IsValid()) return INVALID_CARGO;
return cargo;
}
@ -94,5 +94,5 @@ CargoID GetCargoTranslation(uint8_t cargo, const GRFFile *grffile, bool usebit)
/* Else the cargo value is a 'climate independent' 'bitnum' */
return GetCargoIDByBitnum(cargo);
}
return CT_INVALID;
return INVALID_CARGO;
}

@ -14,9 +14,16 @@
#include "cargo_type.h"
#include "gfx_type.h"
static const CargoID CT_DEFAULT = NUM_CARGO + 0;
static const CargoID CT_PURCHASE = NUM_CARGO + 1;
static const CargoID CT_DEFAULT_NA = NUM_CARGO + 2;
/**
* Sprite Group Cargo types.
* These special cargo types are used when resolving sprite groups when non-cargo-specific sprites or callbacks are needed,
* e.g. in purchase lists, or if no specific cargo type sprite group is supplied.
*/
namespace SpriteGroupCargo {
static constexpr CargoID SG_DEFAULT = NUM_CARGO; ///< Default type used when no more-specific cargo matches.
static constexpr CargoID SG_PURCHASE = NUM_CARGO + 1; ///< Used in purchase lists before an item exists.
static constexpr CargoID SG_DEFAULT_NA = NUM_CARGO + 2; ///< Used only by stations and roads when no more-specific cargo matches.
};
/* Forward declarations of structs used */
struct CargoSpec;

@ -799,7 +799,7 @@ struct NewGRFInspectWindow : Window {
break;
case NIT_CARGO:
string = value != CT_INVALID ? CargoSpec::Get(value)->name : STR_QUANTITY_N_A;
string = (value != INVALID_CARGO) ? CargoSpec::Get(value)->name : STR_QUANTITY_N_A;
break;
default:

@ -38,7 +38,7 @@ void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const SpriteGroup *
{
Engine *e = Engine::Get(engine);
assert(cargo < NUM_CARGO + 2); // Include CT_DEFAULT and CT_PURCHASE pseudo cargoes.
assert(cargo < NUM_CARGO + 2); // Include SpriteGroupCargo::SG_DEFAULT and SpriteGroupCargo::SG_PURCHASE pseudo cargoes.
WagonOverride *wo = &e->overrides.emplace_back();
wo->group = group;
@ -51,7 +51,7 @@ const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, Eng
const Engine *e = Engine::Get(engine);
for (const WagonOverride &wo : e->overrides) {
if (wo.cargo != cargo && wo.cargo != CT_DEFAULT) continue;
if (wo.cargo != cargo && wo.cargo != SpriteGroupCargo::SG_DEFAULT) continue;
if (std::find(wo.engines.begin(), wo.engines.end(), overriding_engine) != wo.engines.end()) return wo.group;
}
return nullptr;
@ -591,8 +591,8 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
/* Pick the most common cargo type */
auto cargo_it = std::max_element(std::begin(common_cargoes), std::end(common_cargoes));
/* Return CT_INVALID if nothing is carried */
CargoID common_cargo_type = (*cargo_it == 0) ? (CargoID)CT_INVALID : static_cast<CargoID>(std::distance(std::begin(common_cargoes), cargo_it));
/* Return INVALID_CARGO if nothing is carried */
CargoID common_cargo_type = (*cargo_it == 0) ? INVALID_CARGO : static_cast<CargoID>(std::distance(std::begin(common_cargoes), cargo_it));
/* Count subcargo types of common_cargo_type */
std::array<uint8_t, UINT8_MAX + 1> common_subtypes{};
@ -627,7 +627,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
* And this is only done by CheckCaches().
*/
const GRFFile *grffile = object->ro.grffile;
uint8_t common_bitnum = (common_cargo_type == CT_INVALID) ? 0xFF :
uint8_t common_bitnum = (common_cargo_type == INVALID_CARGO) ? 0xFF :
(grffile == nullptr || grffile->grf_version < 8) ? CargoSpec::Get(common_cargo_type)->bitnum : grffile->cargo_map[common_cargo_type];
return (v->grf_cache.consist_cargo_information & 0xFFFF00FF) | common_bitnum << 8;
@ -1109,7 +1109,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
case 0x47: { // Vehicle cargo info
const Engine *e = Engine::Get(this->self_type);
CargoID cargo_type = e->GetDefaultCargoType();
if (cargo_type != CT_INVALID) {
if (cargo_type != INVALID_CARGO) {
const CargoSpec *cs = CargoSpec::Get(cargo_type);
return (cs->classes << 16) | (cs->weight << 8) | this->ro.grffile->cargo_map[cargo_type];
} else {
@ -1204,7 +1204,7 @@ VehicleResolverObject::VehicleResolverObject(EngineID engine_type, const Vehicle
cached_relative_count(0)
{
if (wagon_override == WO_SELF) {
this->root_spritegroup = GetWagonOverrideSpriteSet(engine_type, CT_DEFAULT, engine_type);
this->root_spritegroup = GetWagonOverrideSpriteSet(engine_type, SpriteGroupCargo::SG_DEFAULT, engine_type);
} else {
if (wagon_override != WO_NONE && v != nullptr && v->IsGroundVehicle()) {
assert(v->engine_type == engine_type); // overrides make little sense with fake scopes
@ -1221,9 +1221,9 @@ VehicleResolverObject::VehicleResolverObject(EngineID engine_type, const Vehicle
if (this->root_spritegroup == nullptr) {
const Engine *e = Engine::Get(engine_type);
CargoID cargo = v != nullptr ? v->cargo_type : CT_PURCHASE;
CargoID cargo = v != nullptr ? v->cargo_type : SpriteGroupCargo::SG_PURCHASE;
assert(cargo < lengthof(e->grf_prop.spritegroup));
this->root_spritegroup = e->grf_prop.spritegroup[cargo] != nullptr ? e->grf_prop.spritegroup[cargo] : e->grf_prop.spritegroup[CT_DEFAULT];
this->root_spritegroup = e->grf_prop.spritegroup[cargo] != nullptr ? e->grf_prop.spritegroup[cargo] : e->grf_prop.spritegroup[SpriteGroupCargo::SG_DEFAULT];
}
}
}
@ -1399,7 +1399,7 @@ static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, uint16_t base_r
v->waiting_triggers |= trigger;
const Engine *e = Engine::Get(v->engine_type);
if (!(e->grf_prop.spritegroup[v->cargo_type] || e->grf_prop.spritegroup[CT_DEFAULT])) return;
if (!(e->grf_prop.spritegroup[v->cargo_type] || e->grf_prop.spritegroup[SpriteGroupCargo::SG_DEFAULT])) return;
}
/* Rerandomise bits. Scopes other than SELF are invalid for rerandomisation. For bug-to-bug-compatibility with TTDP we ignore the scope. */
@ -1618,7 +1618,7 @@ void AnalyseEngineCallbacks()
};
for (uint i = 0; i < NUM_CARGO + 2; i++) {
process_sg(e->grf_prop.spritegroup[i], i == CT_PURCHASE);
process_sg(e->grf_prop.spritegroup[i], i == SpriteGroupCargo::SG_PURCHASE);
}
for (const WagonOverride &wo : e->overrides) {
process_sg(wo.group, false);
@ -1631,9 +1631,9 @@ void AnalyseEngineCallbacks()
}
}
if (refit_cap_whitelist_ok && non_purchase_groups <= 1 && HasBit(e->info.callback_mask, CBM_VEHICLE_REFIT_CAPACITY) && e->grf_prop.spritegroup[CT_DEFAULT] != nullptr) {
const SpriteGroup *purchase_sg = e->grf_prop.spritegroup[CT_PURCHASE];
e->grf_prop.spritegroup[CT_PURCHASE] = nullptr; // Temporarily disable separate purchase sprite group
if (refit_cap_whitelist_ok && non_purchase_groups <= 1 && HasBit(e->info.callback_mask, CBM_VEHICLE_REFIT_CAPACITY) && e->grf_prop.spritegroup[SpriteGroupCargo::SG_DEFAULT] != nullptr) {
const SpriteGroup *purchase_sg = e->grf_prop.spritegroup[SpriteGroupCargo::SG_PURCHASE];
e->grf_prop.spritegroup[SpriteGroupCargo::SG_PURCHASE] = nullptr; // Temporarily disable separate purchase sprite group
if (refit_cap_no_var_47) {
cb_refit_cap_values[GetVehicleCallback(CBID_VEHICLE_REFIT_CAPACITY, 0, 0, e->index, nullptr)] = ALL_CARGOTYPES;
} else {
@ -1644,7 +1644,7 @@ void AnalyseEngineCallbacks()
}
e->info.cargo_type = default_cb;
}
e->grf_prop.spritegroup[CT_PURCHASE] = purchase_sg;
e->grf_prop.spritegroup[SpriteGroupCargo::SG_PURCHASE] = purchase_sg;
bool all_ok = true;
uint index = 0;
e->refit_capacity_values.reset(MallocT<EngineRefitCapacityValue>(cb_refit_cap_values.size()));
@ -1681,8 +1681,8 @@ void DumpVehicleSpriteGroup(const Vehicle *v, SpriteGroupDumper &dumper)
root_spritegroup = e->grf_prop.spritegroup[cargo];
seprintf(buffer, lastof(buffer), "Cargo: %u", cargo);
} else {
root_spritegroup = e->grf_prop.spritegroup[CT_DEFAULT];
seprintf(buffer, lastof(buffer), "CT_DEFAULT");
root_spritegroup = e->grf_prop.spritegroup[SpriteGroupCargo::SG_DEFAULT];
seprintf(buffer, lastof(buffer), "SG_DEFAULT");
}
dumper.Print(buffer);
}
@ -1693,11 +1693,11 @@ void DumpVehicleSpriteGroup(const Vehicle *v, SpriteGroupDumper &dumper)
if (e->grf_prop.spritegroup[i] != root_spritegroup && e->grf_prop.spritegroup[i] != nullptr) {
dumper.Print("");
switch (i) {
case CT_DEFAULT:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: CT_DEFAULT");
case SpriteGroupCargo::SG_DEFAULT:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: SG_DEFAULT");
break;
case CT_PURCHASE:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: CT_PURCHASE");
case SpriteGroupCargo::SG_PURCHASE:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: SG_PURCHASE");
break;
default:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: Cargo: %u", i);

@ -378,7 +378,7 @@ static uint32_t GetDistanceFromNearbyHouse(uint8_t parameter, TileIndex tile, Ho
/* Cargo acceptance history of nearby stations */
case 0x64: {
CargoID cid = GetCargoTranslation(parameter, this->ro.grffile);
if (cid == CT_INVALID) return 0;
if (cid == INVALID_CARGO) return 0;
/* Extract tile offset. */
int8_t x_offs = GB(GetRegister(0x100), 0, 8);

@ -342,7 +342,7 @@ uint32_t IndustriesScopeResolver::GetCountAndDistanceOfClosestInstance(byte para
case 0x70:
case 0x71: {
CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile);
if (cargo == CT_INVALID) return 0;
if (cargo == INVALID_CARGO) return 0;
int index = this->industry->GetCargoProducedIndex(cargo);
if (index < 0) return 0; // invalid cargo
switch (variable) {
@ -361,7 +361,7 @@ uint32_t IndustriesScopeResolver::GetCountAndDistanceOfClosestInstance(byte para
case 0x6E:
case 0x6F: {
CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile);
if (cargo == CT_INVALID) return 0;
if (cargo == INVALID_CARGO) return 0;
int index = this->industry->GetCargoAcceptedIndex(cargo);
if (index < 0) return 0; // invalid cargo
if (variable == 0x6E) return this->industry->last_cargo_accepted_at[index].base();
@ -669,11 +669,11 @@ void IndustryProductionCallback(Industry *ind, int reason)
if (group->version < 2) {
/* Callback parameters map directly to industry cargo slot indices */
for (uint i = 0; i < group->num_input; i++) {
if (ind->accepts_cargo[i] == CT_INVALID) continue;
if (ind->accepts_cargo[i] == INVALID_CARGO) continue;
ind->incoming_cargo_waiting[i] = ClampTo<uint16_t>(ind->incoming_cargo_waiting[i] - DerefIndProd(group->subtract_input[i], deref) * multiplier);
}
for (uint i = 0; i < group->num_output; i++) {
if (ind->produced_cargo[i] == CT_INVALID) continue;
if (ind->produced_cargo[i] == INVALID_CARGO) continue;
ind->produced_cargo_waiting[i] = ClampTo<uint16_t>(ind->produced_cargo_waiting[i] + std::max(DerefIndProd(group->add_output[i], deref), 0) * multiplier);
}
} else {

@ -261,11 +261,11 @@ RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec,
this->town_scope = nullptr;
CargoID ctype = CT_DEFAULT_NA;
CargoID ctype = SpriteGroupCargo::SG_DEFAULT_NA;
if (st == nullptr) {
/* No station, so we are in a purchase list */
ctype = CT_PURCHASE;
ctype = SpriteGroupCargo::SG_PURCHASE;
} else if (Station::IsExpected(st)) {
const Station *station = Station::From(st);
/* Pick the first cargo that we have waiting */
@ -279,7 +279,7 @@ RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec,
}
if (roadstopspec->grf_prop.spritegroup[ctype] == nullptr) {
ctype = CT_DEFAULT;
ctype = SpriteGroupCargo::SG_DEFAULT;
}
/* Remember the cargo type we've picked */
@ -431,8 +431,8 @@ void TriggerRoadStopAnimation(BaseStation *st, TileIndex trigger_tile, StationAn
const RoadStopSpec *ss = GetRoadStopSpec(cur_tile);
if (ss != nullptr && HasBit(ss->animation.triggers, trigger)) {
CargoID cargo;
if (cargo_type == CT_INVALID) {
cargo = CT_INVALID;
if (cargo_type == INVALID_CARGO) {
cargo = INVALID_CARGO;
} else {
cargo = ss->grf_prop.grffile->cargo_map[cargo_type];
}
@ -464,7 +464,7 @@ void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTri
/* Check the cached cargo trigger bitmask to see if we need
* to bother with any further processing. */
if (st->cached_roadstop_cargo_triggers == 0) return;
if (cargo_type != CT_INVALID && !HasBit(st->cached_roadstop_cargo_triggers, cargo_type)) return;
if (cargo_type != INVALID_CARGO && !HasBit(st->cached_roadstop_cargo_triggers, cargo_type)) return;
SetBit(st->waiting_triggers, trigger);
@ -484,7 +484,7 @@ void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTri
if ((ss->cargo_triggers & ~empty_mask) != 0) return;
}
if (cargo_type == CT_INVALID || HasBit(ss->cargo_triggers, cargo_type)) {
if (cargo_type == INVALID_CARGO || HasBit(ss->cargo_triggers, cargo_type)) {
RoadStopResolverObject object(ss, st, cur_tile, INVALID_ROADTYPE, GetStationType(cur_tile), GetStationGfx(cur_tile));
object.waiting_triggers = st->waiting_triggers;
@ -682,11 +682,11 @@ void StationUpdateRoadStopCachedTriggers(BaseStation *st)
void DumpRoadStopSpriteGroup(const BaseStation *st, const RoadStopSpec *spec, SpriteGroupDumper &dumper)
{
CargoID ctype = CT_DEFAULT_NA;
CargoID ctype = SpriteGroupCargo::SG_DEFAULT_NA;
if (st == nullptr) {
/* No station, so we are in a purchase list */
ctype = CT_PURCHASE;
ctype = SpriteGroupCargo::SG_PURCHASE;
} else if (Station::IsExpected(st)) {
const Station *station = Station::From(st);
/* Pick the first cargo that we have waiting */
@ -700,7 +700,7 @@ void DumpRoadStopSpriteGroup(const BaseStation *st, const RoadStopSpec *spec, Sp
}
if (spec->grf_prop.spritegroup[ctype] == nullptr) {
ctype = CT_DEFAULT;
ctype = SpriteGroupCargo::SG_DEFAULT;
}
dumper.DumpSpriteGroup(spec->grf_prop.spritegroup[ctype], 0);

@ -192,8 +192,8 @@ uint16_t GetRoadStopCallback(CallbackID callback, uint32_t param1, uint32_t para
void AnimateRoadStopTile(TileIndex tile);
uint8_t GetRoadStopTileAnimationSpeed(TileIndex tile);
void TriggerRoadStopAnimation(BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTrigger trigger, CargoID cargo_type = CT_INVALID);
void TriggerRoadStopAnimation(BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type = INVALID_CARGO);
void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTrigger trigger, CargoID cargo_type = INVALID_CARGO);
bool GetIfNewStopsByType(RoadStopType rs, RoadType roadtype);
bool GetIfClassHasNewStopsByType(RoadStopClass *roadstopclass, RoadStopType rs, RoadType roadtype);

@ -434,7 +434,7 @@ uint32_t Station::GetNewGRFVariable(const ResolverObject &object, uint16_t varia
if ((variable >= 0x60 && variable <= 0x65) || variable == 0x69) {
CargoID c = GetCargoTranslation(parameter, object.grffile);
if (c == CT_INVALID) {
if (c == INVALID_CARGO) {
switch (variable) {
case 0x62: return 0xFFFFFFFF;
case 0x64: return 0xFF00;
@ -522,13 +522,13 @@ uint32_t Waypoint::GetNewGRFVariable(const ResolverObject &object, uint16_t vari
const Station *st = Station::From(this->station_scope.st);
switch (this->station_scope.cargo_type) {
case CT_INVALID:
case CT_DEFAULT_NA:
case CT_PURCHASE:
case INVALID_CARGO:
case SpriteGroupCargo::SG_DEFAULT_NA:
case SpriteGroupCargo::SG_PURCHASE:
cargo = 0;
break;
case CT_DEFAULT:
case SpriteGroupCargo::SG_DEFAULT:
for (const GoodsEntry &ge : st->goods) {
cargo += ge.CargoTotalCount();
}
@ -585,11 +585,11 @@ StationResolverObject::StationResolverObject(const StationSpec *statspec, BaseSt
/* Invalidate all cached vars */
_svc.valid = 0;
CargoID ctype = CT_DEFAULT_NA;
CargoID ctype = SpriteGroupCargo::SG_DEFAULT_NA;
if (this->station_scope.st == nullptr) {
/* No station, so we are in a purchase list */
ctype = CT_PURCHASE;
ctype = SpriteGroupCargo::SG_PURCHASE;
} else if (Station::IsExpected(this->station_scope.st)) {
const Station *st = Station::From(this->station_scope.st);
/* Pick the first cargo that we have waiting */
@ -603,7 +603,7 @@ StationResolverObject::StationResolverObject(const StationSpec *statspec, BaseSt
}
if (this->station_scope.statspec->grf_prop.spritegroup[ctype] == nullptr) {
ctype = CT_DEFAULT;
ctype = SpriteGroupCargo::SG_DEFAULT;
}
/* Remember the cargo type we've picked */
@ -923,8 +923,8 @@ void TriggerStationAnimation(BaseStation *st, TileIndex trigger_tile, StationAni
const StationSpec *ss = GetStationSpec(tile);
if (ss != nullptr && HasBit(ss->animation.triggers, trigger)) {
CargoID cargo;
if (cargo_type == CT_INVALID) {
cargo = CT_INVALID;
if (cargo_type == INVALID_CARGO) {
cargo = INVALID_CARGO;
} else {
cargo = ss->grf_prop.grffile->cargo_map[cargo_type];
}
@ -954,7 +954,7 @@ void TriggerStationRandomisation(Station *st, TileIndex trigger_tile, StationRan
/* Check the cached cargo trigger bitmask to see if we need
* to bother with any further processing. */
if (st->cached_cargo_triggers == 0) return;
if (cargo_type != CT_INVALID && !HasBit(st->cached_cargo_triggers, cargo_type)) return;
if (cargo_type != INVALID_CARGO && !HasBit(st->cached_cargo_triggers, cargo_type)) return;
uint32_t whole_reseed = 0;
ETileArea area = ETileArea(st, trigger_tile, tas[trigger]);
@ -978,7 +978,7 @@ void TriggerStationRandomisation(Station *st, TileIndex trigger_tile, StationRan
if ((ss->cargo_triggers & ~empty_mask) != 0) continue;
}
if (cargo_type == CT_INVALID || HasBit(ss->cargo_triggers, cargo_type)) {
if (cargo_type == INVALID_CARGO || HasBit(ss->cargo_triggers, cargo_type)) {
StationResolverObject object(ss, st, tile, INVALID_RAILTYPE, CBID_RANDOM_TRIGGER, 0);
object.waiting_triggers = st->waiting_triggers;
@ -1039,14 +1039,14 @@ void DumpStationSpriteGroup(const StationSpec *statspec, BaseStation *st, Sprite
StationResolverObject ro(statspec, st, INVALID_TILE, INVALID_RAILTYPE);
switch (ro.station_scope.cargo_type) {
case CT_DEFAULT:
seprintf(buffer, lastof(buffer), "CT_DEFAULT");
case SpriteGroupCargo::SG_DEFAULT:
seprintf(buffer, lastof(buffer), "SG_DEFAULT");
break;
case CT_PURCHASE:
seprintf(buffer, lastof(buffer), "CT_PURCHASE");
case SpriteGroupCargo::SG_PURCHASE:
seprintf(buffer, lastof(buffer), "SG_PURCHASE");
break;
case CT_DEFAULT_NA:
seprintf(buffer, lastof(buffer), "CT_DEFAULT_NA");
case SpriteGroupCargo::SG_DEFAULT_NA:
seprintf(buffer, lastof(buffer), "SG_DEFAULT_NA");
break;
default:
seprintf(buffer, lastof(buffer), "Cargo: %u", ro.station_scope.cargo_type);
@ -1060,14 +1060,14 @@ void DumpStationSpriteGroup(const StationSpec *statspec, BaseStation *st, Sprite
if (statspec->grf_prop.spritegroup[i] != ro.root_spritegroup && statspec->grf_prop.spritegroup[i] != nullptr) {
dumper.Print("");
switch (i) {
case CT_DEFAULT:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: CT_DEFAULT");
case SpriteGroupCargo::SG_DEFAULT:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: SG_DEFAULT");
break;
case CT_PURCHASE:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: CT_PURCHASE");
case SpriteGroupCargo::SG_PURCHASE:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: SG_PURCHASE");
break;
case CT_DEFAULT_NA:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: CT_DEFAULT_NA");
case SpriteGroupCargo::SG_DEFAULT_NA:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: SG_DEFAULT_NA");
break;
default:
seprintf(buffer, lastof(buffer), "OTHER SPRITE GROUP: Cargo: %u", i);

@ -39,7 +39,7 @@ struct StationScopeResolver : public ScopeResolver {
* @param rt %RailType of the station (unbuilt stations only).
*/
StationScopeResolver(ResolverObject &ro, const StationSpec *statspec, BaseStation *st, TileIndex tile, RailType rt)
: ScopeResolver(ro), tile(tile), st(st), statspec(statspec), cargo_type(CT_INVALID), axis(INVALID_AXIS), rt(rt)
: ScopeResolver(ro), tile(tile), st(st), statspec(statspec), cargo_type(INVALID_CARGO), axis(INVALID_AXIS), rt(rt)
{
}
@ -219,8 +219,8 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
void AnimateStationTile(TileIndex tile);
uint8_t GetStationTileAnimationSpeed(TileIndex tile);
void TriggerStationAnimation(BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
void TriggerStationRandomisation(Station *st, TileIndex tile, StationRandomTrigger trigger, CargoID cargo_type = CT_INVALID);
void TriggerStationAnimation(BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type = INVALID_CARGO);
void TriggerStationRandomisation(Station *st, TileIndex tile, StationRandomTrigger trigger, CargoID cargo_type = INVALID_CARGO);
void StationUpdateCachedTriggers(BaseStation *st);
void UpdateStationTileCacheFlags(bool force_update);

@ -171,7 +171,7 @@ public:
Order *next; ///< Pointer to next order. If nullptr, end of list
Order() : flags(0), refit_cargo(CT_NO_REFIT), max_speed(UINT16_MAX) {}
Order() : flags(0), refit_cargo(CARGO_NO_REFIT), max_speed(UINT16_MAX) {}
~Order();
Order(uint64_t packed);
@ -213,7 +213,7 @@ public:
void Free();
void MakeGoToStation(StationID destination);
void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type = ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OrderDepotActionFlags action = ODATF_SERVICE_ONLY, CargoID cargo = CT_NO_REFIT);
void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type = ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OrderDepotActionFlags action = ODATF_SERVICE_ONLY, CargoID cargo = CARGO_NO_REFIT);
void MakeGoToWaypoint(StationID destination);
void MakeLoading(bool ordered);
void MakeLeaveStation();
@ -263,14 +263,14 @@ public:
* @pre IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION)
* @return true if a refit should happen.
*/
inline bool IsRefit() const { return this->refit_cargo < NUM_CARGO || this->refit_cargo == CT_AUTO_REFIT; }
inline bool IsRefit() const { return this->refit_cargo < NUM_CARGO || this->refit_cargo == CARGO_AUTO_REFIT; }
/**
* Is this order a auto-refit order.
* @pre IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION)
* @return true if a auto-refit should happen.
*/
inline bool IsAutoRefit() const { return this->refit_cargo == CT_AUTO_REFIT; }
inline bool IsAutoRefit() const { return this->refit_cargo == CARGO_AUTO_REFIT; }
/**
* Get the cargo to to refit to.

@ -340,7 +340,7 @@ Order::Order(uint64_t packed)
this->dest = GB(packed, 24, 16);
this->extra = nullptr;
this->next = nullptr;
this->refit_cargo = CT_NO_REFIT;
this->refit_cargo = CARGO_NO_REFIT;
this->occupancy = 0;
this->wait_time = 0;
this->travel_time = 0;
@ -1804,7 +1804,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
VehicleID veh = GB(p1, 0, 20);
ModifyOrderFlags mof = Extract<ModifyOrderFlags, 0, 8>(p2);
uint16_t data = GB(p2, 8, 16);
CargoID cargo_id = (mof == MOF_CARGO_TYPE_UNLOAD || mof == MOF_CARGO_TYPE_LOAD) ? (CargoID) GB(p2, 24, 8) : (CargoID) CT_INVALID;
CargoID cargo_id = (mof == MOF_CARGO_TYPE_UNLOAD || mof == MOF_CARGO_TYPE_LOAD) ? (CargoID) GB(p2, 24, 8) : (CargoID) INVALID_CARGO;
if (mof >= MOF_END) return CMD_ERROR;
@ -1878,7 +1878,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
break;
case MOF_CARGO_TYPE_UNLOAD:
if (cargo_id >= NUM_CARGO && cargo_id != CT_INVALID) return CMD_ERROR;
if (cargo_id >= NUM_CARGO && cargo_id != INVALID_CARGO) return CMD_ERROR;
if (data == OUFB_CARGO_TYPE_UNLOAD) return CMD_ERROR;
/* FALL THROUGH */
case MOF_UNLOAD:
@ -1892,7 +1892,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
break;
case MOF_CARGO_TYPE_LOAD:
if (cargo_id >= NUM_CARGO && cargo_id != CT_INVALID) return CMD_ERROR;
if (cargo_id >= NUM_CARGO && cargo_id != INVALID_CARGO) return CMD_ERROR;
if (data == OLFB_CARGO_TYPE_LOAD || data == OLF_FULL_LOAD_ANY) return CMD_ERROR;
/* FALL THROUGH */
case MOF_LOAD:
@ -2090,7 +2090,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
case MOF_NON_STOP:
order->SetNonStopType((OrderNonStopFlags)data);
if (data & ONSF_NO_STOP_AT_DESTINATION_STATION) {
order->SetRefit(CT_NO_REFIT);
order->SetRefit(CARGO_NO_REFIT);
order->SetLoadType(OLF_LOAD_IF_POSSIBLE);
order->SetUnloadType(OUF_UNLOAD_IF_POSSIBLE);
if (order->IsWaitTimetabled() || order->GetWaitTime() > 0) {
@ -2111,7 +2111,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
break;
case MOF_CARGO_TYPE_UNLOAD:
if (cargo_id == CT_INVALID) {
if (cargo_id == INVALID_CARGO) {
for (CargoID i = 0; i < NUM_CARGO; i++) {
order->SetUnloadType((OrderUnloadFlags)data, i);
}
@ -2122,11 +2122,11 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
case MOF_LOAD:
order->SetLoadType((OrderLoadFlags)data);
if (data & OLFB_NO_LOAD) order->SetRefit(CT_NO_REFIT);
if (data & OLFB_NO_LOAD) order->SetRefit(CARGO_NO_REFIT);
break;
case MOF_CARGO_TYPE_LOAD:
if (cargo_id == CT_INVALID) {
if (cargo_id == INVALID_CARGO) {
for (CargoID i = 0; i < NUM_CARGO; i++) {
order->SetLoadType((OrderLoadFlags)data, i);
}
@ -2146,19 +2146,19 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
case DA_SERVICE:
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() | ODTFB_SERVICE));
order->SetDepotActionType((OrderDepotActionFlags)(base_order_action_type));
order->SetRefit(CT_NO_REFIT);
order->SetRefit(CARGO_NO_REFIT);
break;
case DA_STOP:
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
order->SetDepotActionType((OrderDepotActionFlags)(base_order_action_type | ODATFB_HALT));
order->SetRefit(CT_NO_REFIT);
order->SetRefit(CARGO_NO_REFIT);
break;
case DA_SELL:
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
order->SetDepotActionType((OrderDepotActionFlags)(base_order_action_type | ODATFB_HALT | ODATFB_SELL));
order->SetRefit(CT_NO_REFIT);
order->SetRefit(CARGO_NO_REFIT);
break;
default:
@ -2374,7 +2374,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
}
switch (mof) {
case MOF_CARGO_TYPE_UNLOAD:
if (cargo_id == CT_INVALID) {
if (cargo_id == INVALID_CARGO) {
for (CargoID i = 0; i < NUM_CARGO; i++) {
u->current_order.SetUnloadType((OrderUnloadFlags)data, i);
}
@ -2384,7 +2384,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
break;
case MOF_CARGO_TYPE_LOAD:
if (cargo_id == CT_INVALID) {
if (cargo_id == INVALID_CARGO) {
for (CargoID i = 0; i < NUM_CARGO; i++) {
u->current_order.SetLoadType((OrderLoadFlags)data, i);
}
@ -2717,7 +2717,7 @@ CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint
VehicleOrderID order_number = GB(p2, 16, 16);
CargoID cargo = GB(p2, 0, 8);
if (cargo >= NUM_CARGO && cargo != CT_NO_REFIT && cargo != CT_AUTO_REFIT) return CMD_ERROR;
if (cargo >= NUM_CARGO && cargo != CARGO_NO_REFIT && cargo != CARGO_AUTO_REFIT) return CMD_ERROR;
const Vehicle *v = Vehicle::GetIfValid(veh);
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
@ -2729,7 +2729,7 @@ CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint
if (order == nullptr) return CMD_ERROR;
/* Automatic refit cargo is only supported for goto station orders. */
if (cargo == CT_AUTO_REFIT && !order->IsType(OT_GOTO_STATION)) return CMD_ERROR;
if (cargo == CARGO_AUTO_REFIT && !order->IsType(OT_GOTO_STATION)) return CMD_ERROR;
if (order->GetLoadType() & OLFB_NO_LOAD) return CMD_ERROR;
@ -2737,7 +2737,7 @@ CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint
order->SetRefit(cargo);
/* Make the depot order an 'always go' order. */
if (cargo != CT_NO_REFIT && order->IsType(OT_GOTO_DEPOT)) {
if (cargo != CARGO_NO_REFIT && order->IsType(OT_GOTO_DEPOT)) {
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() & ~(ODATFB_HALT | ODATFB_SELL)));
}

@ -264,7 +264,7 @@ public:
this->GetWidget<NWidgetCore>(widget)->SetDataTip(this->cargo_type_order_dropdown[this->GetOrderActionTypeForCargo(cargo_id)], STR_CARGO_TYPE_LOAD_ORDERS_DROP_TOOLTIP + this->variant);
this->SetWidgetDirty(widget);
} else if (widget == WID_CTO_SET_TO_ALL_DROPDOWN) {
ModifyOrder(this->vehicle, this->order_id, mof | (action_type << 8) | (CT_INVALID << 24));
ModifyOrder(this->vehicle, this->order_id, mof | (action_type << 8) | (INVALID_CARGO << 24));
for (int i = 0; i < (int)_sorted_standard_cargo_specs.size(); i++) {
const CargoSpec *cs = _sorted_cargo_specs[i];
@ -1812,10 +1812,10 @@ private:
{
if (_ctrl_pressed) {
/* Cancel refitting */
DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, CMD_ORDER_REFIT);
DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | (CARGO_NO_REFIT << 8) | CARGO_NO_REFIT, CMD_ORDER_REFIT);
} else {
if (i == 1) { // Auto-refit to available cargo type.
DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | CT_AUTO_REFIT, CMD_ORDER_REFIT);
DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | CARGO_AUTO_REFIT, CMD_ORDER_REFIT);
} else {
ShowVehicleRefitWindow(this->vehicle, this->OrderGetSel(), this, auto_refit);
}
@ -3225,7 +3225,7 @@ public:
}
if (this->query_text_widget == WID_O_ADD_VEH_GROUP) {
DoCommandP(0, VehicleListIdentifier(VL_SINGLE_VEH, this->vehicle->type, this->vehicle->owner, this->vehicle->index).Pack(), CF_ANY, CMD_CREATE_GROUP_FROM_LIST | CMD_MSG(STR_ERROR_GROUP_CAN_T_CREATE), nullptr, str);
DoCommandP(0, VehicleListIdentifier(VL_SINGLE_VEH, this->vehicle->type, this->vehicle->owner, this->vehicle->index).Pack(), CargoFilterCriteria::CF_ANY, CMD_CREATE_GROUP_FROM_LIST | CMD_MSG(STR_ERROR_GROUP_CAN_T_CREATE), nullptr, str);
}
if (this->query_text_widget == WID_O_TEXT_LABEL && str != nullptr) {

@ -1831,11 +1831,11 @@ bool AfterLoadGame()
/* Setting no refit flags to all orders in savegames from before refit in orders were added */
if (IsSavegameVersionBefore(SLV_36)) {
for (Order *order : Order::Iterate()) {
order->SetRefit(CT_NO_REFIT);
order->SetRefit(CARGO_NO_REFIT);
}
for (Vehicle *v : Vehicle::Iterate()) {
v->current_order.SetRefit(CT_NO_REFIT);
v->current_order.SetRefit(CARGO_NO_REFIT);
}
}
@ -3573,7 +3573,7 @@ bool AfterLoadGame()
/* Make sure added industry cargo slots are cleared */
for (Industry *i : Industry::Iterate()) {
for (size_t ci = 2; ci < lengthof(i->produced_cargo); ci++) {
i->produced_cargo[ci] = CT_INVALID;
i->produced_cargo[ci] = INVALID_CARGO;
i->produced_cargo_waiting[ci] = 0;
i->production_rate[ci] = 0;
i->last_month_production[ci] = 0;
@ -3583,13 +3583,13 @@ bool AfterLoadGame()
i->this_month_transported[ci] = 0;
}
for (size_t ci = 3; ci < lengthof(i->accepts_cargo); ci++) {
i->accepts_cargo[ci] = CT_INVALID;
i->accepts_cargo[ci] = INVALID_CARGO;
i->incoming_cargo_waiting[ci] = 0;
}
/* Make sure last_cargo_accepted_at is copied to elements for every valid input cargo.
* The loading routine should put the original singular value into the first array element. */
for (size_t ci = 0; ci < lengthof(i->accepts_cargo); ci++) {
if (i->accepts_cargo[ci] != CT_INVALID) {
if (i->accepts_cargo[ci] != INVALID_CARGO) {
i->last_cargo_accepted_at[ci] = i->last_cargo_accepted_at[0];
} else {
i->last_cargo_accepted_at[ci] = 0;

@ -56,9 +56,9 @@ public:
*/
enum SpecialCargoID {
/* Note: these values represent part of the in-game CargoTypes enum */
CT_AUTO_REFIT = ::CT_AUTO_REFIT, ///< Automatically choose cargo type when doing auto-refitting.
CT_NO_REFIT = ::CT_NO_REFIT, ///< Do not refit cargo of a vehicle.
CT_INVALID = ::CT_INVALID, ///< An invalid cargo type.
CT_AUTO_REFIT = ::CARGO_AUTO_REFIT, ///< Automatically choose cargo type when doing auto-refitting.
CT_NO_REFIT = ::CARGO_NO_REFIT, ///< Do not refit cargo of a vehicle.
CT_INVALID = ::INVALID_CARGO, ///< An invalid cargo type.
};
/**

@ -31,7 +31,7 @@ ScriptCargoList_IndustryAccepting::ScriptCargoList_IndustryAccepting(IndustryID
Industry *ind = ::Industry::Get(industry_id);
for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) {
CargoID cargo_id = ind->accepts_cargo[i];
if (cargo_id != CT_INVALID) {
if (cargo_id != INVALID_CARGO) {
this->AddItem(cargo_id);
}
}
@ -44,7 +44,7 @@ ScriptCargoList_IndustryProducing::ScriptCargoList_IndustryProducing(IndustryID
Industry *ind = ::Industry::Get(industry_id);
for (uint i = 0; i < lengthof(ind->produced_cargo); i++) {
CargoID cargo_id = ind->produced_cargo[i];
if (cargo_id != CT_INVALID) {
if (cargo_id != INVALID_CARGO) {
this->AddItem(cargo_id);
}
}

@ -50,12 +50,12 @@
/* static */ CargoID ScriptEngine::GetCargoType(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return CT_INVALID;
if (!IsValidEngine(engine_id)) return INVALID_CARGO;
CargoArray cap = ::GetCapacityOfArticulatedParts(engine_id);
auto it = std::max_element(std::cbegin(cap), std::cend(cap));
if (*it == 0) return CT_INVALID;
if (*it == 0) return INVALID_CARGO;
return CargoID(std::distance(std::cbegin(cap), it));
}

@ -37,11 +37,11 @@ std::optional<std::string> ScriptEventEnginePreview::GetName()
CargoID ScriptEventEnginePreview::GetCargoType()
{
if (!this->IsEngineValid()) return CT_INVALID;
if (!this->IsEngineValid()) return INVALID_CARGO;
CargoArray cap = ::GetCapacityOfArticulatedParts(this->engine);
auto it = std::max_element(std::cbegin(cap), std::cend(cap));
if (*it == 0) return CT_INVALID;
if (*it == 0) return INVALID_CARGO;
return CargoID(std::distance(std::cbegin(cap), it));
}

@ -229,7 +229,7 @@
Industry *i = Industry::GetIfValid(industry_id);
if (i == nullptr) return ScriptDate::DATE_INVALID;
if (cargo_type == CT_INVALID) {
if (cargo_type == INVALID_CARGO) {
return (ScriptDate::Date)std::accumulate(std::begin(i->last_cargo_accepted_at), std::end(i->last_cargo_accepted_at), Date(0), [](Date a, Date b) { return std::max(a, b); }).base();
} else {
int index = i->GetCargoAcceptedIndex(cargo_type);

@ -258,9 +258,9 @@ public:
/**
* Get the last date this industry accepted any cargo delivery.
* @param industry_id The index of the industry.
* @param cargo_type The cargo to query, or CT_INVALID to query latest of all accepted cargoes.
* @param cargo_type The cargo to query, or INVALID_CARGO to query latest of all accepted cargoes.
* @pre IsValidIndustry(industry_id).
* @pre IsValidCargo(cargo_type) || cargo_type == CT_INVALID.
* @pre IsValidCargo(cargo_type) || cargo_type == INVALID_CARGO.
* @return Date the industry last received cargo from a delivery, or ScriptDate::DATE_INVALID on error.
* @api -ai
*/

@ -376,11 +376,11 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
/* static */ CargoID ScriptOrder::GetOrderRefit(VehicleID vehicle_id, OrderPosition order_position)
{
if (!IsValidVehicleOrder(vehicle_id, order_position)) return CT_NO_REFIT;
if (order_position != ORDER_CURRENT && !IsGotoStationOrder(vehicle_id, order_position) && !IsGotoDepotOrder(vehicle_id, order_position)) return CT_NO_REFIT;
if (!IsValidVehicleOrder(vehicle_id, order_position)) return CARGO_NO_REFIT;
if (order_position != ORDER_CURRENT && !IsGotoStationOrder(vehicle_id, order_position) && !IsGotoDepotOrder(vehicle_id, order_position)) return CARGO_NO_REFIT;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
return order->IsRefit() ? order->GetRefitCargo() : (CargoID)CT_NO_REFIT;
return order->IsRefit() ? order->GetRefitCargo() : CARGO_NO_REFIT;
}
/* static */ bool ScriptOrder::SetOrderJumpTo(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to)
@ -446,8 +446,8 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
{
EnforceCompanyModeValid(false);
EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
EnforcePrecondition(false, IsGotoStationOrder(vehicle_id, order_position) || (IsGotoDepotOrder(vehicle_id, order_position) && refit_cargo != CT_AUTO_REFIT));
EnforcePrecondition(false, ScriptCargo::IsValidCargo(refit_cargo) || refit_cargo == CT_AUTO_REFIT || refit_cargo == CT_NO_REFIT);
EnforcePrecondition(false, IsGotoStationOrder(vehicle_id, order_position) || (IsGotoDepotOrder(vehicle_id, order_position) && refit_cargo != CARGO_AUTO_REFIT));
EnforcePrecondition(false, ScriptCargo::IsValidCargo(refit_cargo) || refit_cargo == CARGO_AUTO_REFIT || refit_cargo == CARGO_NO_REFIT);
uint32_t p1 = vehicle_id;
uint32_t p2 = refit_cargo | ScriptOrderPositionToRealOrderPosition(vehicle_id, ScriptOrder::ResolveOrderPosition(vehicle_id, order_position)) << 16;

@ -66,7 +66,7 @@
/* static */ CargoID ScriptSubsidy::GetCargoType(SubsidyID subsidy_id)
{
if (!IsValidSubsidy(subsidy_id)) return CT_INVALID;
if (!IsValidSubsidy(subsidy_id)) return INVALID_CARGO;
return ::Subsidy::Get(subsidy_id)->cargo_type;
}

@ -98,7 +98,7 @@ ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(IndustryID in
{
bool cargo_accepts = false;
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
if (i->accepts_cargo[j] != CT_INVALID && acceptance[i->accepts_cargo[j]] != 0) cargo_accepts = true;
if (i->accepts_cargo[j] != INVALID_CARGO && acceptance[i->accepts_cargo[j]] != 0) cargo_accepts = true;
}
if (!cargo_accepts) continue;
}

@ -72,7 +72,7 @@
{
EnforceCompanyModeValid(VEHICLE_INVALID);
EnforcePrecondition(VEHICLE_INVALID, ScriptEngine::IsBuildable(engine_id));
EnforcePrecondition(VEHICLE_INVALID, cargo == CT_INVALID || ScriptCargo::IsValidCargo(cargo));
EnforcePrecondition(VEHICLE_INVALID, cargo == INVALID_CARGO || ScriptCargo::IsValidCargo(cargo));
::VehicleType type = ::Engine::Get(engine_id)->type;
@ -86,7 +86,7 @@
/* static */ VehicleID ScriptVehicle::BuildVehicle(TileIndex depot, EngineID engine_id)
{
return _BuildVehicleInternal(depot, engine_id, CT_INVALID);
return _BuildVehicleInternal(depot, engine_id, INVALID_CARGO);
}
/* static */ VehicleID ScriptVehicle::BuildVehicleWithRefit(TileIndex depot, EngineID engine_id, CargoID cargo)

@ -1440,7 +1440,7 @@ static bool LoadOldSubsidy(LoadgameState *ls, int num)
{
Subsidy *s = new (num) Subsidy();
bool ret = LoadChunk(ls, s, subsidy_chunk);
if (s->cargo_type == CT_INVALID) delete s;
if (s->cargo_type == INVALID_CARGO) delete s;
return ret;
}

@ -169,7 +169,7 @@ static bool CMSAMine(TileIndex tile)
for (uint i = 0; i < lengthof(ind->produced_cargo); i++) {
/* The industry extracts something non-liquid, i.e. no oil or plastic, so it is a mine.
* Also the production of passengers and mail is ignored. */
if (ind->produced_cargo[i] != CT_INVALID &&
if (ind->produced_cargo[i] != INVALID_CARGO &&
(CargoSpec::Get(ind->produced_cargo[i])->classes & (CC_LIQUID | CC_PASSENGERS | CC_MAIL)) == 0) {
return true;
}
@ -639,7 +639,7 @@ CargoArray GetProductionAroundTiles(TileIndex north_tile, int w, int h, int rad)
for (uint j = 0; j < lengthof(i->produced_cargo); j++) {
CargoID cargo = i->produced_cargo[j];
if (cargo != CT_INVALID) produced[cargo]++;
if (cargo != INVALID_CARGO) produced[cargo]++;
}
}

@ -1927,7 +1927,7 @@ struct StationViewWindow : public Window {
* @param cargo Current cargo being drawn (if cargo column has been passed).
* @return row (in "pos" counting) after the one we have last drawn to.
*/
int DrawEntries(CargoDataEntry *entry, const Rect &r, int pos, int maxrows, int column, CargoID cargo = CT_INVALID)
int DrawEntries(CargoDataEntry *entry, const Rect &r, int pos, int maxrows, int column, CargoID cargo = INVALID_CARGO)
{
if (this->sortings[column] == CargoSortType::AsGrouping) {
if (this->groupings[column] != GR_CARGO) {

@ -1481,9 +1481,9 @@ static void FormatString(StringBuilder builder, const char *str_arg, StringParam
case SCC_CARGO_LONG: { // {CARGO_LONG}
/* First parameter is cargo type, second parameter is cargo count */
CargoID cargo = args.GetNextParameter<CargoID>();
if (cargo != CT_INVALID && cargo >= CargoSpec::GetArraySize()) break;
if (cargo != INVALID_CARGO && cargo >= CargoSpec::GetArraySize()) break;
StringID cargo_str = (cargo == CT_INVALID) ? STR_QUANTITY_N_A : CargoSpec::Get(cargo)->quantifier;
StringID cargo_str = (cargo == INVALID_CARGO) ? STR_QUANTITY_N_A : CargoSpec::Get(cargo)->quantifier;
auto tmp_args = MakeParameters(args.GetNextParameter<int64_t>());
GetStringWithArgs(builder, cargo_str, tmp_args);
break;

@ -392,12 +392,12 @@ bool FindSubsidyIndustryCargoRoute()
int num_cargos = 0;
uint cargo_index;
for (cargo_index = 0; cargo_index < lengthof(src_ind->produced_cargo); cargo_index++) {
if (src_ind->produced_cargo[cargo_index] != CT_INVALID) num_cargos++;
if (src_ind->produced_cargo[cargo_index] != INVALID_CARGO) num_cargos++;
}
if (num_cargos == 0) return false; // industry produces nothing
int cargo_num = RandomRange(num_cargos) + 1;
for (cargo_index = 0; cargo_index < lengthof(src_ind->produced_cargo); cargo_index++) {
if (src_ind->produced_cargo[cargo_index] != CT_INVALID) cargo_num--;
if (src_ind->produced_cargo[cargo_index] != INVALID_CARGO) cargo_num--;
if (cargo_num == 0) break;
}
assert(cargo_num == 0); // indicates loop didn't break as intended
@ -409,7 +409,7 @@ bool FindSubsidyIndustryCargoRoute()
* or if the pct transported is already large enough
* or if the cargo is automatically distributed */
if (total == 0 || trans > SUBSIDY_MAX_PCT_TRANSPORTED ||
cid == CT_INVALID ||
cid == INVALID_CARGO ||
_settings_game.linkgraph.GetDistributionType(cid) != DT_MANUAL) {
return false;
}

@ -20,7 +20,7 @@ extern SubsidyPool _subsidy_pool;
/** Struct about subsidies, offered and awarded */
struct Subsidy : SubsidyPool::PoolItem<&_subsidy_pool> {
CargoID cargo_type; ///< Cargo type involved in this subsidy, CT_INVALID for invalid subsidy
CargoID cargo_type; ///< Cargo type involved in this subsidy, INVALID_CARGO for invalid subsidy
uint16_t remaining; ///< Remaining months when this subsidy is valid
CompanyID awarded; ///< Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone
SourceType src_type; ///< Source of subsidised path (SourceType::Industry or SourceType::Town)

@ -248,7 +248,7 @@ class NIHVehicle : public NIHelper {
seprintf(buffer, lastof(buffer), " V Cache: max speed: %u, cargo age period: %u, vis effect: %u",
v->vcache.cached_max_speed, v->vcache.cached_cargo_age_period, v->vcache.cached_vis_effect);
output.print(buffer);
if (v->cargo_type != CT_INVALID) {
if (v->cargo_type != INVALID_CARGO) {
seprintf(buffer, lastof(buffer), " V Cargo: type: %u, sub type: %u, cap: %u, transfer: %u, deliver: %u, keep: %u, load: %u",
v->cargo_type, v->cargo_subtype, v->cargo_cap,
v->cargo.ActionCount(VehicleCargoList::MTA_TRANSFER), v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER),
@ -545,7 +545,7 @@ class NIHVehicle : public NIHelper {
if (root_spritegroup == nullptr) {
CargoID cargo = v->cargo_type;
assert(cargo < lengthof(e->grf_prop.spritegroup));
root_spritegroup = e->grf_prop.spritegroup[cargo] != nullptr ? e->grf_prop.spritegroup[cargo] : e->grf_prop.spritegroup[CT_DEFAULT];
root_spritegroup = e->grf_prop.spritegroup[cargo] != nullptr ? e->grf_prop.spritegroup[cargo] : e->grf_prop.spritegroup[SpriteGroupCargo::SG_DEFAULT];
}
auto iter = e->sprite_group_cb36_properties_used.find(root_spritegroup);
if (iter != e->sprite_group_cb36_properties_used.end()) {
@ -1196,7 +1196,7 @@ class NIHIndustry : public NIHelper {
}
output.print(" Produces:");
for (uint i = 0; i < lengthof(ind->produced_cargo); i++) {
if (ind->produced_cargo[i] != CT_INVALID) {
if (ind->produced_cargo[i] != INVALID_CARGO) {
seprintf(buffer, lastof(buffer), " %s:", GetStringPtr(CargoSpec::Get(ind->produced_cargo[i])->name));
output.print(buffer);
seprintf(buffer, lastof(buffer), " Waiting: %u, rate: %u",
@ -1212,7 +1212,7 @@ class NIHIndustry : public NIHelper {
}
output.print(" Accepts:");
for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) {
if (ind->accepts_cargo[i] != CT_INVALID) {
if (ind->accepts_cargo[i] != INVALID_CARGO) {
seprintf(buffer, lastof(buffer), " %s: waiting: %u",
GetStringPtr(CargoSpec::Get(ind->accepts_cargo[i])->name), ind->incoming_cargo_waiting[i]);
output.print(buffer);

@ -1130,7 +1130,7 @@ struct TimetableWindow : GeneralVehicleWindow {
}
case WID_VT_ADD_VEH_GROUP: {
DoCommandP(0, VehicleListIdentifier(VL_SINGLE_VEH, v->type, v->owner, v->index).Pack(), CF_ANY, CMD_CREATE_GROUP_FROM_LIST | CMD_MSG(STR_ERROR_GROUP_CAN_T_CREATE), nullptr, str);
DoCommandP(0, VehicleListIdentifier(VL_SINGLE_VEH, v->type, v->owner, v->index).Pack(), CargoFilterCriteria::CF_ANY, CMD_CREATE_GROUP_FROM_LIST | CMD_MSG(STR_ERROR_GROUP_CAN_T_CREATE), nullptr, str);
break;
}
}

@ -718,7 +718,7 @@ static void TileLoop_Town(TileIndex tile)
if (callback == CALLBACK_FAILED || callback == CALLBACK_HOUSEPRODCARGO_END) break;
CargoID cargo = GetCargoTranslation(GB(callback, 8, 7), hs->grf_prop.grffile);
if (cargo == CT_INVALID) continue;
if (cargo == INVALID_CARGO) continue;
uint amt = GB(callback, 0, 8);
if (amt == 0) continue;
@ -858,7 +858,7 @@ void AddProducedHouseCargo(HouseID house_id, TileIndex tile, CargoArray &produce
CargoID cargo = GetCargoTranslation(GB(callback, 8, 7), hs->grf_prop.grffile);
if (cargo == CT_INVALID) continue;
if (cargo == INVALID_CARGO) continue;
produced[cargo]++;
}
} else {
@ -878,7 +878,7 @@ static void AddProducedCargo_Town(TileIndex tile, CargoArray &produced)
static inline void AddAcceptedCargoSetMask(CargoID cargo, uint amount, CargoArray &acceptance, CargoTypes *always_accepted)
{
if (cargo == CT_INVALID || amount == 0) return;
if (cargo == INVALID_CARGO || amount == 0) return;
acceptance[cargo] += amount;
SetBit(*always_accepted, cargo);
}

@ -7110,7 +7110,7 @@ CommandCost CmdBuildVirtualRailVehicle(TileIndex tile, DoCommandFlag flags, uint
/* Validate the cargo type. */
CargoID cargo = GB(p1, 24, 8);
if (cargo >= NUM_CARGO && cargo != CT_INVALID) return CMD_ERROR;
if (cargo >= NUM_CARGO && cargo != INVALID_CARGO) return CMD_ERROR;
bool should_execute = (flags & DC_EXEC) != 0;
@ -7122,7 +7122,7 @@ CommandCost CmdBuildVirtualRailVehicle(TileIndex tile, DoCommandFlag flags, uint
return_cmd_error(err);
}
if (cargo != CT_INVALID) {
if (cargo != INVALID_CARGO) {
CargoID default_cargo = Engine::Get(eid)->GetDefaultCargoType();
if (default_cargo != cargo) {
CommandCost refit_res = CmdRefitVehicle(tile, flags, train->index, cargo, nullptr);
@ -7210,12 +7210,12 @@ CommandCost CmdTemplateReplaceVehicle(TileIndex tile, DoCommandFlag flags, uint3
const bool need_refit = (diff & TBTRDF_REFIT);
const bool refit_to_template = tv->refit_as_template;
CargoID store_refit_ct = CT_INVALID;
CargoID store_refit_ct = INVALID_CARGO;
uint16_t store_refit_csubt = 0;
// if a train shall keep its old refit, store the refit setting of its first vehicle
if (!refit_to_template) {
for (Train *getc = incoming; getc != nullptr; getc = getc->GetNextUnit()) {
if (getc->cargo_type != CT_INVALID && getc->cargo_cap > 0) {
if (getc->cargo_type != INVALID_CARGO && getc->cargo_cap > 0) {
store_refit_ct = getc->cargo_type;
break;
}
@ -7276,7 +7276,7 @@ CommandCost CmdTemplateReplaceVehicle(TileIndex tile, DoCommandFlag flags, uint3
}
CargoID refit_cargo = refit_to_template ? cur_tmpl->cargo_type : store_refit_ct;
uint32_t refit_cmd = (refit_cargo != CT_INVALID) ? (refit_cargo << 24) : 0;
uint32_t refit_cmd = (refit_cargo != INVALID_CARGO) ? (refit_cargo << 24) : 0;
buy.AddCost(DoCommand(tile, cur_tmpl->engine_type | (1 << 16) | refit_cmd, 0, flags, CMD_BUILD_VEHICLE));
};
for (const TemplateVehicle *cur_tmpl = tv; cur_tmpl != nullptr; cur_tmpl = cur_tmpl->GetNextUnit()) {

@ -214,7 +214,7 @@ static void TrainDetailsCargoTab(const CargoSummaryItem *item, int left, int rig
SetDParam(3, _settings_game.vehicle.freight_trains);
str = FreightWagonMult(item->cargo) > 1 ? STR_VEHICLE_DETAILS_CARGO_FROM_MULT : STR_VEHICLE_DETAILS_CARGO_FROM;
} else {
str = item->cargo == CT_INVALID ? STR_QUANTITY_N_A : STR_VEHICLE_DETAILS_CARGO_EMPTY;
str = item->cargo == INVALID_CARGO ? STR_QUANTITY_N_A : STR_VEHICLE_DETAILS_CARGO_EMPTY;
}
DrawString(left, right, y, str, TC_LIGHT_BLUE);
@ -306,7 +306,7 @@ static void TrainDetailsInfoTab(const Train *v, int left, int right, int y, byte
static void TrainDetailsCapacityTab(const CargoSummaryItem *item, int left, int right, int y)
{
StringID str;
if (item->cargo != CT_INVALID) {
if (item->cargo != INVALID_CARGO) {
SetDParam(0, item->cargo);
SetDParam(1, item->capacity);
SetDParam(4, item->subtype);
@ -332,9 +332,9 @@ static void GetCargoSummaryOfArticulatedVehicle(const Train *v, CargoSummary &su
if (!v->GetEngine()->CanCarryCargo()) continue;
CargoSummaryItem new_item;
new_item.cargo = v->cargo_cap > 0 ? v->cargo_type : (CargoID)CT_INVALID;
new_item.cargo = v->cargo_cap > 0 ? v->cargo_type : INVALID_CARGO;
new_item.subtype = GetCargoSubtypeText(v);
if (new_item.cargo == CT_INVALID && new_item.subtype == STR_EMPTY) continue;
if (new_item.cargo == INVALID_CARGO && new_item.subtype == STR_EMPTY) continue;
auto item = std::find(std::begin(summary), std::end(summary), new_item);
if (item == std::end(summary)) {

@ -295,7 +295,7 @@ bool Vehicle::NeedsServicing() const
if (union_mask != 0 && v->type == VEH_SHIP && v->Next() != nullptr) {
CargoTypes cargoes = 0;
for (const Vehicle *u = v; u != nullptr; u = u->Next()) {
if (u->cargo_type != CT_INVALID && u->GetEngine()->CanCarryCargo()) {
if (u->cargo_type != INVALID_CARGO && u->GetEngine()->CanCarryCargo()) {
SetBit(cargoes, u->cargo_type);
}
}
@ -319,7 +319,7 @@ bool Vehicle::NeedsServicing() const
/* engine_type is already a mixed cargo type which matches the incoming vehicle by default, no refit required */
} else {
/* Did the old vehicle carry anything? */
if (cargo_type != CT_INVALID) {
if (cargo_type != INVALID_CARGO) {
/* We can't refit the vehicle to carry the cargo we want */
if (!HasBit(available_cargo_types, cargo_type)) continue;
}
@ -2987,7 +2987,7 @@ bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype)
*/
LiveryScheme GetEngineLiveryScheme(EngineID engine_type, EngineID parent_engine_type, const Vehicle *v)
{
CargoID cargo_type = v == nullptr ? (CargoID)CT_INVALID : v->cargo_type;
CargoID cargo_type = v == nullptr ? INVALID_CARGO : v->cargo_type;
const Engine *e = Engine::Get(engine_type);
switch (e->type) {
default: NOT_REACHED();
@ -3000,8 +3000,8 @@ LiveryScheme GetEngineLiveryScheme(EngineID engine_type, EngineID parent_engine_
/* Note: Luckily cargo_type is not needed for engines */
}
if (cargo_type == CT_INVALID) cargo_type = e->GetDefaultCargoType();
if (cargo_type == CT_INVALID) cargo_type = CT_GOODS; // The vehicle does not carry anything, let's pick some freight cargo
if (cargo_type == INVALID_CARGO) cargo_type = e->GetDefaultCargoType();
if (cargo_type == INVALID_CARGO) cargo_type = CT_GOODS; // The vehicle does not carry anything, let's pick some freight cargo
if (e->u.rail.railveh_type == RAILVEH_WAGON) {
if (!CargoSpec::Get(cargo_type)->is_freight) {
if (parent_engine_type == INVALID_ENGINE) {
@ -3040,8 +3040,8 @@ LiveryScheme GetEngineLiveryScheme(EngineID engine_type, EngineID parent_engine_
e = Engine::Get(engine_type);
cargo_type = v->First()->cargo_type;
}
if (cargo_type == CT_INVALID) cargo_type = e->GetDefaultCargoType();
if (cargo_type == CT_INVALID) cargo_type = CT_GOODS; // The vehicle does not carry anything, let's pick some freight cargo
if (cargo_type == INVALID_CARGO) cargo_type = e->GetDefaultCargoType();
if (cargo_type == INVALID_CARGO) cargo_type = CT_GOODS; // The vehicle does not carry anything, let's pick some freight cargo
/* Important: Use Tram Flag of front part. Luckily engine_type refers to the front part here. */
if (HasBit(e->info.misc_flags, EF_ROAD_TRAM)) {
@ -3053,8 +3053,8 @@ LiveryScheme GetEngineLiveryScheme(EngineID engine_type, EngineID parent_engine_
}
case VEH_SHIP:
if (cargo_type == CT_INVALID) cargo_type = e->GetDefaultCargoType();
if (cargo_type == CT_INVALID) cargo_type = CT_GOODS; // The vehicle does not carry anything, let's pick some freight cargo
if (cargo_type == INVALID_CARGO) cargo_type = e->GetDefaultCargoType();
if (cargo_type == INVALID_CARGO) cargo_type = CT_GOODS; // The vehicle does not carry anything, let's pick some freight cargo
return IsCargoInClass(cargo_type, CC_PASSENGERS) ? LS_PASSENGER_SHIP : LS_FREIGHT_SHIP;
case VEH_AIRCRAFT:

@ -111,16 +111,16 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32_t p1, ui
/* Validate the cargo type. */
CargoID cargo = GB(p1, 24, 8);
if (cargo >= NUM_CARGO && cargo != CT_INVALID) return CMD_ERROR;
if (cargo >= NUM_CARGO && cargo != INVALID_CARGO) return CMD_ERROR;
const Engine *e = Engine::Get(eid);
CommandCost value(EXPENSES_NEW_VEHICLES, e->GetCost());
/* Engines without valid cargo should not be available */
CargoID default_cargo = e->GetDefaultCargoType();
if (default_cargo == CT_INVALID) return CMD_ERROR;
if (default_cargo == INVALID_CARGO) return CMD_ERROR;
bool refitting = cargo != CT_INVALID && cargo != default_cargo;
bool refitting = cargo != INVALID_CARGO && cargo != default_cargo;
/* Check whether the number of vehicles we need to build can be built according to pool space. */
uint num_vehicles;
@ -1550,7 +1550,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32_t p1, ui
DoCommandFlag build_flags = flags;
if ((flags & DC_EXEC) && !v->IsPrimaryVehicle()) build_flags |= DC_AUTOREPLACE;
CommandCost cost = DoCommand(tile, v->engine_type | (1 << 16) | (CT_INVALID << 24), 0, build_flags, GetCmdBuildVeh(v));
CommandCost cost = DoCommand(tile, v->engine_type | (1 << 16) | (INVALID_CARGO << 24), 0, build_flags, GetCmdBuildVeh(v));
if (cost.Failed()) {
/* Can't build a part, then sell the stuff we already made; clear up the mess */
@ -1630,9 +1630,9 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32_t p1, ui
}
} else {
const Engine *e = v->GetEngine();
CargoID initial_cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : (CargoID)CT_INVALID);
CargoID initial_cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : INVALID_CARGO);
if (v->cargo_type != initial_cargo && initial_cargo != CT_INVALID) {
if (v->cargo_type != initial_cargo && initial_cargo != INVALID_CARGO) {
bool dummy;
total_cost.AddCost(GetRefitCost(nullptr, v->engine_type, v->cargo_type, v->cargo_subtype, &dummy));
}

@ -286,7 +286,7 @@ void BaseVehicleListWindow::BuildVehicleList()
static bool GroupCargoFilter(const GUIVehicleGroup* group, const CargoID cid)
{
if (cid == CF_ANY) return true;
if (cid == CargoFilterCriteria::CF_ANY) return true;
for (VehicleList::const_iterator v = group->vehicles_begin; v != group->vehicles_end; ++v) {
if (VehicleCargoFilter(*v, cid)) return true;
}
@ -306,7 +306,7 @@ void BaseVehicleListWindow::SetCargoFilter(CargoID cid)
if (this->cargo_filter_criteria != cid) {
this->cargo_filter_criteria = cid;
/* Deactivate filter if criteria is 'Show All', activate it otherwise. */
this->vehgroups.SetFilterState(this->cargo_filter_criteria != CF_ANY);
this->vehgroups.SetFilterState(this->cargo_filter_criteria != CargoFilterCriteria::CF_ANY);
this->vehgroups.SetFilterType(0);
this->vehgroups.ForceRebuild();
}
@ -315,9 +315,9 @@ void BaseVehicleListWindow::SetCargoFilter(CargoID cid)
/** Populate the filter list and set the cargo filter criteria. */
void BaseVehicleListWindow::SetCargoFilterArray()
{
this->cargo_filter_criteria = CF_ANY;
this->cargo_filter_criteria = CargoFilterCriteria::CF_ANY;
this->vehgroups.SetFilterFuncs(_filter_funcs);
this->vehgroups.SetFilterState(this->cargo_filter_criteria != CF_ANY);
this->vehgroups.SetFilterState(this->cargo_filter_criteria != CargoFilterCriteria::CF_ANY);
}
/** Filter the engine list against the currently selected cargo filter */
@ -372,9 +372,9 @@ void BaseVehicleListWindow::OnInit()
StringID BaseVehicleListWindow::GetCargoFilterLabel(CargoID cid) const
{
switch (cid) {
case CF_ANY: return STR_CARGO_TYPE_FILTER_ALL;
case CF_FREIGHT: return STR_CARGO_TYPE_FILTER_FREIGHT;
case CF_NONE: return STR_CARGO_TYPE_FILTER_NONE;
case CargoFilterCriteria::CF_ANY: return STR_CARGO_TYPE_FILTER_ALL;
case CargoFilterCriteria::CF_FREIGHT: return STR_CARGO_TYPE_FILTER_FREIGHT;
case CargoFilterCriteria::CF_NONE: return STR_CARGO_TYPE_FILTER_NONE;
default: return CargoSpec::Get(cid)->name;
}
}
@ -389,11 +389,11 @@ DropDownList BaseVehicleListWindow::BuildCargoDropDownList(bool full) const
DropDownList list;
/* Add item for disabling filtering. */
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_ANY), CF_ANY, false));
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CargoFilterCriteria::CF_ANY), CargoFilterCriteria::CF_ANY, false));
/* Add item for freight (i.e. vehicles with cargo capacity and with no passenger capacity). */
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_FREIGHT), CF_FREIGHT, false));
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CargoFilterCriteria::CF_FREIGHT), CargoFilterCriteria::CF_FREIGHT, false));
/* Add item for vehicles not carrying anything, e.g. train engines. */
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_NONE), CF_NONE, false));
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CargoFilterCriteria::CF_NONE), CargoFilterCriteria::CF_NONE, false));
/* Add cargos */
Dimension d = GetLargestCargoIconSize();
@ -834,7 +834,7 @@ struct RefitWindow : public Window {
{
size_t scroll_row = 0;
size_t rows = 0;
CargoID cargo = this->selected_refit == nullptr ? (CargoID)CT_INVALID : this->selected_refit->cargo;
CargoID cargo = this->selected_refit == nullptr ? INVALID_CARGO : this->selected_refit->cargo;
for (const auto &pair : this->refit_list) {
if (pair.first == cargo) {

@ -110,16 +110,16 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine
/** Cargo filter functions */
bool VehicleCargoFilter(const Vehicle *v, const CargoID cid)
{
if (cid == CF_ANY) {
if (cid == CargoFilterCriteria::CF_ANY) {
return true;
} else if (cid == CF_NONE) {
} else if (cid == CargoFilterCriteria::CF_NONE) {
for (const Vehicle *w = v; w != nullptr; w = w->Next()) {
if (w->cargo_cap > 0) {
return false;
}
}
return true;
} else if (cid == CF_FREIGHT) {
} else if (cid == CargoFilterCriteria::CF_FREIGHT) {
bool have_capacity = false;
for (const Vehicle *w = v; w != nullptr; w = w->Next()) {
if (w->cargo_cap) {
@ -152,7 +152,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
list->clear();
auto add_veh = [&](const Vehicle *v) {
if (cid == CF_ANY || VehicleCargoFilter(v, cid)) list->push_back(v);
if (cid == CargoFilterCriteria::CF_ANY || VehicleCargoFilter(v, cid)) list->push_back(v);
};
auto fill_all_vehicles = [&]() {

@ -52,18 +52,11 @@ struct VehicleListIdentifier {
VehicleListIdentifier() : type(), vtype(), company(), index() {}
};
/** Special cargo filter criteria */
enum VehicleCargoFilterSpecialType {
CF_ANY = CT_NO_REFIT, ///< Show all vehicles independent of carried cargo (i.e. no filtering)
CF_NONE = CT_INVALID, ///< Show only vehicles which do not carry cargo (e.g. train engines)
CF_FREIGHT = CT_AUTO_REFIT, ///< Show only vehicles which carry any freight (non-passenger) cargo
};
/** A list of vehicles. */
typedef std::vector<const Vehicle *> VehicleList;
bool VehicleCargoFilter(const Vehicle *v, const CargoID cid);
bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &identifier, const CargoID cid = CF_ANY);
bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &identifier, const CargoID cid = CargoFilterCriteria::CF_ANY);
void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine_list, VehicleList *wagon_list, bool individual_wagons = false);
uint GetUnitNumberDigits(VehicleList &vehicles);

@ -236,12 +236,12 @@ SpriteID TileZoneCheckUnservedIndustriesEvaluation(TileIndex tile, Owner owner)
return ZONING_INVALID_SPRITE_ID;
} else if (st->facilities & (FACIL_BUS_STOP | FACIL_TRUCK_STOP)) {
for (uint i = 0; i < lengthof(ind->produced_cargo); i++) {
if (ind->produced_cargo[i] != CT_INVALID && st->facilities & (IsCargoInClass(ind->produced_cargo[i], CC_PASSENGERS) ? FACIL_BUS_STOP : FACIL_TRUCK_STOP)) {
if (ind->produced_cargo[i] != INVALID_CARGO && st->facilities & (IsCargoInClass(ind->produced_cargo[i], CC_PASSENGERS) ? FACIL_BUS_STOP : FACIL_TRUCK_STOP)) {
return ZONING_INVALID_SPRITE_ID;
}
}
for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) {
if (ind->accepts_cargo[i] != CT_INVALID && st->facilities & (IsCargoInClass(ind->accepts_cargo[i], CC_PASSENGERS) ? FACIL_BUS_STOP : FACIL_TRUCK_STOP)) {
if (ind->accepts_cargo[i] != INVALID_CARGO && st->facilities & (IsCargoInClass(ind->accepts_cargo[i], CC_PASSENGERS) ? FACIL_BUS_STOP : FACIL_TRUCK_STOP)) {
return ZONING_INVALID_SPRITE_ID;
}
}

Loading…
Cancel
Save