43#include "table/strings.h"
48const StringID _veh_build_msg_table[] = {
49 STR_ERROR_CAN_T_BUY_TRAIN,
50 STR_ERROR_CAN_T_BUY_ROAD_VEHICLE,
51 STR_ERROR_CAN_T_BUY_SHIP,
52 STR_ERROR_CAN_T_BUY_AIRCRAFT,
55const StringID _veh_sell_msg_table[] = {
56 STR_ERROR_CAN_T_SELL_TRAIN,
57 STR_ERROR_CAN_T_SELL_ROAD_VEHICLE,
58 STR_ERROR_CAN_T_SELL_SHIP,
59 STR_ERROR_CAN_T_SELL_AIRCRAFT,
62const StringID _veh_refit_msg_table[] = {
63 STR_ERROR_CAN_T_REFIT_TRAIN,
64 STR_ERROR_CAN_T_REFIT_ROAD_VEHICLE,
65 STR_ERROR_CAN_T_REFIT_SHIP,
66 STR_ERROR_CAN_T_REFIT_AIRCRAFT,
69const StringID _send_to_depot_msg_table[] = {
70 STR_ERROR_CAN_T_SEND_TRAIN_TO_DEPOT,
71 STR_ERROR_CAN_T_SEND_ROAD_VEHICLE_TO_DEPOT,
72 STR_ERROR_CAN_T_SEND_SHIP_TO_DEPOT,
73 STR_ERROR_CAN_T_SEND_AIRCRAFT_TO_HANGAR,
114 case VEH_SHIP: num_vehicles = 1;
break;
116 default: NOT_REACHED();
142 default: NOT_REACHED();
146 uint refitted_capacity = 0;
147 uint16_t refitted_mail_capacity = 0;
159 std::tie(cc, refitted_capacity, refitted_mail_capacity, cargo_capacities) =
CmdRefitVehicle(flags, v->
index, cargo, 0,
false,
false, 1);
165 refitted_capacity = cargo_capacities[default_cargo];
166 refitted_mail_capacity = 0;
169 cargo_capacities[default_cargo] = refitted_capacity;
170 CargoID mail = GetCargoIDByLabel(CT_MAIL);
171 if (
IsValidCargoID(mail)) cargo_capacities[mail] = refitted_mail_capacity;
203 if (flags != subflags) {
211 return { value, veh_id, refitted_capacity, refitted_mail_capacity, cargo_capacities };
231 if (ret.
Failed())
return ret;
239 front->
orders !=
nullptr &&
244 backup_order =
false;
276 if (e->
GetGRF() !=
nullptr) {
282 *auto_refit_allowed =
HasBit(cb_res, 14);
283 int factor =
GB(cb_res, 0, 14);
284 if (factor >= 0x2000) factor -= 0x4000;
289 *auto_refit_allowed = e->info.refit_cost == 0;
290 return (v ==
nullptr || v->
cargo_type != new_cid) ? e->info.refit_cost : 0;
307 int cost_factor =
GetRefitCostFactor(v, engine_type, new_cid, new_subtype, auto_refit_allowed);
310 base_price = PR_BUILD_VEHICLE_SHIP;
315 base_price = PR_BUILD_VEHICLE_ROAD;
320 base_price = PR_BUILD_VEHICLE_AIRCRAFT;
325 base_price = (e->u.rail.railveh_type ==
RAILVEH_WAGON) ? PR_BUILD_VEHICLE_WAGON : PR_BUILD_VEHICLE_TRAIN;
330 default: NOT_REACHED();
332 if (cost_factor < 0) {
362 uint total_capacity = 0;
363 uint total_mail_capacity = 0;
364 num_vehicles = num_vehicles == 0 ? UINT8_MAX : num_vehicles;
367 VehicleSet vehicles_to_refit;
374 std::vector<RefitResult> refit_result;
377 uint8_t actual_subtype = new_subtype;
378 for (; v !=
nullptr; v = (only_this ? nullptr : v->
Next())) {
382 if (v->
type ==
VEH_TRAIN && std::ranges::find(vehicles_to_refit, v->
index) == vehicles_to_refit.end() && !only_this)
continue;
390 if (!refittable && v->
cargo_type != new_cid) {
392 if (amount > 0) cargo_capacities[v->
cargo_type] += amount;
397 if (actual_subtype == 0xFF) {
409 uint16_t mail_capacity = 0;
411 total_capacity += amount;
413 total_mail_capacity += mail_capacity;
415 cargo_capacities[new_cid] += amount;
416 CargoID mail = GetCargoIDByLabel(CT_MAIL);
417 if (
IsValidCargoID(mail)) cargo_capacities[mail] += mail_capacity;
419 if (!refittable)
continue;
425 bool auto_refit_allowed;
427 if (auto_refit && (flags &
DC_QUERY_COST) == 0 && !auto_refit_allowed) {
431 total_capacity -= amount;
432 total_mail_capacity -= mail_capacity;
452 refit_result.push_back({v, amount, mail_capacity, actual_subtype});
466 assert(w !=
nullptr);
474 refit_result.clear();
475 return { cost, total_capacity, total_mail_capacity, cargo_capacities };
493 if (v ==
nullptr)
return {
CMD_ERROR, 0, 0, {} };
502 if (ret.
Failed())
return { ret, 0, 0, {} };
514 return {
CommandCost(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT + front->
type), 0, 0, {} };
525 auto [cost, refit_capacity, mail_capacity, cargo_capacities] =
RefitVehicle(v, only_this, num_vehicles, new_cid, new_subtype, flags, auto_refit);
548 default: NOT_REACHED();
562 return { cost, refit_capacity, mail_capacity, cargo_capacities };
581 if (ret.
Failed())
return ret;
605 if (evaluate_startstop_cb) {
610 if (v->
GetGRF()->grf_version < 8) {
614 if (callback < 0x400) {
622 error = STR_ERROR_INCOMPATIBLE_RAIL_TYPES;
665 if (vehicle_list_window) {
673 for (
const Vehicle *v : list) {
676 if (!vehicle_list_window && !v->IsChainInDepot())
continue;
705 bool had_success =
false;
706 for (
const Vehicle *v : list) {
716 return had_success ? cost : last_error;
737 for (
const Vehicle *v : list) {
739 if (!v->IsChainInDepot())
continue;
756 if (!v->name.empty() && v->name == name)
return false;
772 size_t number_position;
773 for (number_position = src->
name.length(); number_position > 0; number_position--) {
776 if (src->
name[number_position - 1] <
'0' || src->
name[number_position - 1] >
'9')
break;
782 if (number_position == src->
name.length()) {
786 number_position = buf.length();
790 buf = src->
name.substr(0, number_position);
792 auto num_str = src->
name.substr(number_position);
793 padding = (uint8_t)num_str.length();
795 std::istringstream iss(num_str);
801 for (
int max_iterations = 1000; max_iterations > 0; max_iterations--, num++) {
802 std::ostringstream oss;
805 oss << buf << std::setw(padding) << std::setfill(
'0') << std::internal << num;
808 auto new_name = oss.str();
810 dst->
name = new_name;
855 }
while ((v = v->
Next()) !=
nullptr);
913 w->SetServiceIntervalIsCustom(v->ServiceIntervalIsCustom());
914 w->SetServiceIntervalIsPercent(v->ServiceIntervalIsPercent());
922 new_veh_id = w_front->
index;
944 assert(w !=
nullptr);
973 }
while (v !=
nullptr);
1003 return { total_cost, new_veh_id };
1020 bool had_success =
false;
1021 for (uint i = 0; i < list.size(); i++) {
1032 if (!(flags &
DC_EXEC))
break;
1075 if (ret.
Failed())
return ret;
1077 bool reset = text.empty();
1113 if (ret.
Failed())
return ret;
1125 v->SetServiceInterval(serv_int);
1126 v->SetServiceIntervalIsCustom(is_custom);
1127 v->SetServiceIntervalIsPercent(is_percent);
@ VAF_HELI_DIRECT_DESCENT
The helicopter is descending directly at its destination (helipad or in front of hangar)
void UpdateAircraftCache(Aircraft *v, bool update_range=false)
Update cached values of an aircraft.
CommandCost CmdBuildAircraft(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
Build an aircraft.
Command definitions related to aircraft.
Various declarations for airports.
@ STARTTAKEOFF
Airplane has arrived at a runway for take-off.
@ TERM7
Heading for terminal 7.
CargoArray GetCapacityOfArticulatedParts(EngineID engine)
Get the capacity of the parts of a given engine.
uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
Count the number of articulated parts of an engine.
Functions related to articulated vehicles.
Command definitions related to autoreplace.
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
Rebuild the left autoreplace list if an engine is removed or added.
Functions related to the autoreplace GUIs.
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
debug_inline static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
bool IsValidCargoID(CargoID t)
Test whether cargo type is not INVALID_CARGO.
static const CargoID NUM_CARGO
Maximum number of cargo types in a game.
Common return value for all commands.
bool Succeeded() const
Did this command succeed?
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
Money GetCost() const
The costs as made up to this moment.
bool Failed() const
Did this command fail?
uint Truncate(uint max_move=UINT_MAX)
Truncates the cargo in this list to the given amount.
uint TotalCount() const
Returns sum of cargo, including reserved cargo.
Functions related to commands.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
DoCommandFlag
List of flags for a command.
@ DC_AUTOREPLACE
autoreplace/autorenew is in progress, this shall disable vehicle limits when building,...
@ DC_QUERY_COST
query cost only, don't build.
@ DC_EXEC
execute the given command
Definition of stuff that is very close to a company, like the company struct itself.
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
bool CheckCompanyHasMoney(CommandCost &cost)
Verify whether the company can pay the bill.
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
CompanyID _current_company
Company currently doing an action.
Functions related to companies.
bool IsLocalCompany()
Is the current company the local company?
Map related accessors for depots.
bool IsDepotTile(Tile tile)
Is the given tile a tile with a depot on it?
VehicleType GetDepotVehicleType(Tile t)
Get the type of vehicles that can use a depot.
bool do_start
flag for starting playback of next_file at next opportunity
Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift)
Determine a certain price.
ExpensesType
Types of expenses.
@ EXPENSES_ROADVEH_RUN
Running costs road vehicles.
@ EXPENSES_TRAIN_RUN
Running costs trains.
@ EXPENSES_AIRCRAFT_RUN
Running costs aircraft.
@ EXPENSES_SHIP_RUN
Running costs ships.
@ EXPENSES_NEW_VEHICLES
New vehicles.
Price
Enumeration of all base prices for use with Prices.
bool IsEngineBuildable(EngineID engine, VehicleType type, CompanyID company)
Check if an engine is buildable.
Functions related to engines.
uint16_t EngineID
Unique identification number of an engine.
@ AIR_CTOL
Conventional Take Off and Landing, i.e. planes.
@ EF_AUTO_REFIT
Automatic refitting is allowed.
@ RAILVEH_WAGON
simple wagon, not motorized
@ RAILVEH_MULTIHEAD
indicates a combination of two locomotives
debug_inline constexpr bool HasFlag(const T x, const T y)
Checks if a value in a bitset enum is set.
Base class for groups and group functions.
Command definitions related to engine groups.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
virtual void MarkDirty()
Marks the vehicles to be redrawn and updates cached variables.
ClientID
'Unique' identifier to be given to clients
@ INVALID_CLIENT_ID
Client is not part of anything.
Base for the NewGRF implementation.
@ CBID_VEHICLE_REFIT_COST
Called to determine the cost factor for refitting a vehicle.
@ CBID_VEHICLE_START_STOP_CHECK
Called when the company (or AI) tries to start or stop a vehicle.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
uint16_t GetVehicleCallback(CallbackID callback, uint32_t param1, uint32_t param2, EngineID engine, const Vehicle *v)
Evaluate a newgrf callback for vehicles.
StringID GetGRFStringID(uint32_t grfid, StringID stringid)
Returns the index for this stringid associated with its grfID.
Header of Action 04 "universal holder" structure and functions.
Functions related to news.
void DeleteVehicleNews(VehicleID vid, StringID news)
Delete a news item type about a vehicle.
Functions related to order backups.
uint16_t GetServiceIntervalClamped(int interval, bool ispercent)
Clamp the service interval to the correct min/max.
Command definitions related to orders.
Pseudo random number generator.
void SaveRandomSeeds(SavedRandomSeeds *storage)
Saves the current seeds.
void RestoreRandomSeeds(const SavedRandomSeeds &storage)
Restores previously saved seeds.
void RoadVehUpdateCache(RoadVehicle *v, bool same_length=false)
Update the cache of a road vehicle.
CommandCost CmdBuildRoadVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
Build a road vehicle.
Command definitions related to road vehicles.
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
CommandCost CmdBuildShip(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
Build a ship.
Command definitions related to ships.
Definition of base types and functions in a cross-platform compatible way.
size_t Utf8StringLength(const char *s)
Get the length of an UTF-8 encoded string in number of characters and thus not the number of bytes th...
Functions related to low-level strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
uint8_t subtype
Type of aircraft.
Aircraft, helicopters, rotors and their shadows belong to this class.
uint8_t state
State of the airport.
uint8_t flags
Aircraft flags.
std::string name
Name of vehicle.
uint16_t service_interval
The interval for (automatic) servicing; either in days or %.
void ResetDepotUnbunching()
Resets all the data used for depot unbunching.
VehicleType type
Type of vehicle.
Class for storing amounts of cargo.
Specification of a cargo type.
CargoClasses classes
Classes of this cargo type.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
CompanySettings settings
settings specific for each company
VehicleDefaultSettings vehicle
default settings for vehicles
uint8_t misc_flags
Miscellaneous flags.
CargoID GetDefaultCargoType() const
Determines the default cargo type of an engine.
Money GetCost() const
Return how much a new engine costs.
const GRFFile * GetGRF() const
Retrieve the NewGRF the engine is tied to.
uint DetermineCapacity(const Vehicle *v, uint16_t *mail_capacity=nullptr) const
Determines capacity of a given vehicle from scratch.
VehicleType type
Vehicle type, ie VEH_ROAD, VEH_TRAIN, etc.
uint GetDisplayDefaultCapacity(uint16_t *mail_capacity=nullptr) const
Determines the default cargo capacity of an engine for display purposes.
bool CanCarryCargo() const
Determines whether an engine can carry something.
std::array< uint8_t, NUM_CARGO > cargo_map
Inverse cargo translation table (CargoID -> local ID)
VehicleSettings vehicle
options for vehicles
static void CountVehicle(const Vehicle *v, int delta)
Update num_vehicle when adding or removing a vehicle.
static void CountEngine(const Vehicle *v, int delta)
Update num_engines when adding/removing an engine.
static void UpdateAutoreplace(CompanyID company)
Update autoreplace_defined and autoreplace_finished of all statistics of a company.
static void Restore(Vehicle *v, uint32_t user)
Restore the data of this order to the given vehicle.
static void Backup(const Vehicle *v, uint32_t user)
Create an order backup for the given vehicle.
VehicleOrderID GetNumOrders() const
Get number of orders in the order list.
bool IsShared() const
Is this a shared order list?
bool IsType(OrderType type) const
Check whether this order is of the given type.
Tindex index
Index of this pool item.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
static Titem * Get(size_t index)
Returns Titem with given index.
Helper structure for RefitVehicle()
uint capacity
New capacity of vehicle.
Vehicle * v
Vehicle to refit.
uint mail_capacity
New mail capacity of aircraft.
uint8_t subtype
cargo subtype to refit to
Stores the state of all random number generators.
void UpdateCache()
Update the caches of this ship.
static T * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
bool servint_ispercent
service intervals are in percents
The information about a vehicle list.
VehicleType vtype
The vehicle type associated with this list.
uint8_t roadveh_acceleration_model
realistic acceleration for road vehicles
EngineID engine_type
The type of engine used for this vehicle.
const Engine * GetEngine() const
Retrieves the engine of the vehicle.
bool IsStoppedInDepot() const
Check whether the vehicle is in the depot and stopped.
virtual ExpensesType GetExpenseType(bool income) const
Sets the expense type associated to this vehicle type.
Vehicle * GetNextArticulatedPart() const
Get the next part of an articulated engine.
VehicleCargoList cargo
The cargo this vehicle is carrying.
uint16_t cargo_cap
total capacity
bool HasArticulatedPart() const
Check if an engine has an articulated part.
Vehicle * GetNextVehicle() const
Get the next real (non-articulated part) vehicle in the consist.
GroupID group_id
Index of group Pool array.
CommandCost SendToDepot(DoCommandFlag flags, DepotCommand command)
Send this vehicle to the depot using the given command(s).
bool IsArticulatedPart() const
Check if the vehicle is an articulated part of an engine.
debug_inline bool IsFrontEngine() const
Check if the vehicle is a front engine.
Vehicle * First() const
Get the first vehicle of this vehicle chain.
Order current_order
The current order (+ status, like: loading)
CargoID cargo_type
type of cargo this vehicle is carrying
Vehicle * Next() const
Get the next vehicle of this vehicle.
const GRFFile * GetGRF() const
Retrieve the NewGRF the vehicle is tied to.
OrderList * orders
Pointer to the order list for this vehicle.
Money value
Value of the vehicle.
uint16_t refit_cap
Capacity left over from before last refit.
uint32_t GetGRFID() const
Retrieve the GRF ID of the NewGRF the vehicle is tied to.
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
uint16_t cur_speed
current speed
uint8_t cargo_subtype
Used for livery refits (NewGRF variations)
debug_inline bool IsGroundVehicle() const
Check if the vehicle is a ground vehicle.
TileIndex tile
Current tile index.
void InvalidateNewGRFCacheOfChain()
Invalidates cached NewGRF variables of all vehicles in the chain (after the current vehicle)
Owner owner
Which company owns the vehicle?
UnitID unitnumber
unit number, for display purposes only
bool IsTileOwner(Tile tile, Owner owner)
Checks if a tile belongs to the given owner.
Base for the train class.
@ VRF_REVERSE_DIRECTION
Reverse the visible direction of the vehicle.
void NormalizeTrainVehInDepot(const Train *u)
Move all free vehicles in the depot to the train.
@ CCF_AUTOREFIT
Valid changes for autorefitting in stations.
@ CCF_REFIT
Valid changes for refitting in a depot.
CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
Build a railroad vehicle.
CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, bool sell_chain, bool backup_order, ClientID user)
Sell a (single) train wagon/engine.
Command definitions related to trains.
uint16_t UnitID
Type for the company global vehicle unit number.
void GetVehicleSet(VehicleSet &set, Vehicle *v, uint8_t num_vehicles)
Calculates the set of vehicles that will be affected by a given selection.
UnitID GetFreeUnitNumber(VehicleType type)
Get an unused unit number for a vehicle (if allowed).
@ VS_STOPPED
Vehicle is stopped by the player.
@ VS_CRASHED
Vehicle is crashed.
CommandCost CmdSendVehicleToDepot(DoCommandFlag flags, VehicleID veh_id, DepotCommand depot_cmd, const VehicleListIdentifier &vli)
Send a vehicle to the depot.
static void CloneVehicleName(const Vehicle *src, Vehicle *dst)
Clone the custom name of a vehicle, adding or incrementing a number.
static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID new_cid, uint8_t new_subtype, bool *auto_refit_allowed)
Helper to run the refit cost callback.
bool IsUniqueVehicleName(const std::string &name)
Test if a name is unique among vehicle names.
std::tuple< CommandCost, VehicleID > CmdCloneVehicle(DoCommandFlag flags, TileIndex tile, VehicleID veh_id, bool share_orders)
Clone a vehicle.
static std::tuple< CommandCost, uint, uint16_t, CargoArray > RefitVehicle(Vehicle *v, bool only_this, uint8_t num_vehicles, CargoID new_cid, uint8_t new_subtype, DoCommandFlag flags, bool auto_refit)
Refits a vehicle (chain).
CommandCost CmdSellVehicle(DoCommandFlag flags, VehicleID v_id, bool sell_chain, bool backup_order, ClientID client_id)
Sell a vehicle.
static CommandCost SendAllVehiclesToDepot(DoCommandFlag flags, bool service, const VehicleListIdentifier &vli)
Send all vehicles of type to depots.
CommandCost CmdRenameVehicle(DoCommandFlag flags, VehicleID veh_id, const std::string &text)
Give a custom name to your vehicle.
static CommandCost GetRefitCost(const Vehicle *v, EngineID engine_type, CargoID new_cid, uint8_t new_subtype, bool *auto_refit_allowed)
Learn the price of refitting a certain engine.
std::tuple< CommandCost, VehicleID, uint, uint16_t, CargoArray > CmdBuildVehicle(DoCommandFlag flags, TileIndex tile, EngineID eid, bool use_free_vehicles, CargoID cargo, ClientID client_id)
Build a vehicle.
CommandCost CmdStartStopVehicle(DoCommandFlag flags, VehicleID veh_id, bool evaluate_startstop_cb)
Start/Stop a vehicle.
std::tuple< CommandCost, uint, uint16_t, CargoArray > CmdRefitVehicle(DoCommandFlag flags, VehicleID veh_id, CargoID new_cid, uint8_t new_subtype, bool auto_refit, bool only_this, uint8_t num_vehicles)
Refits a vehicle to the specified cargo type.
CommandCost CmdDepotSellAllVehicles(DoCommandFlag flags, TileIndex tile, VehicleType vehicle_type)
Sells all vehicles in a depot.
CommandCost CmdDepotMassAutoReplace(DoCommandFlag flags, TileIndex tile, VehicleType vehicle_type)
Autoreplace all vehicles in the depot.
CommandCost CmdChangeServiceInt(DoCommandFlag flags, VehicleID veh_id, uint16_t serv_int, bool is_custom, bool is_percent)
Change the service interval of a vehicle.
CommandCost CmdMassStartStopVehicle(DoCommandFlag flags, TileIndex tile, bool do_start, bool vehicle_list_window, const VehicleListIdentifier &vli)
Starts or stops a lot of vehicles.
Command definitions for vehicles.
Functions related to vehicles.
uint8_t GetBestFittingSubType(Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_type)
Get the best fitting subtype when 'cloning'/'replacing' v_from with v_for.
bool IsCompanyBuildableVehicleType(VehicleType type)
Is the given vehicle type buildable by a company?
WindowClass GetWindowClassForVehicleType(VehicleType vt)
Get WindowClass for vehicle list of given vehicle type.
VehicleType
Available vehicle types.
@ VEH_ROAD
Road vehicle type.
@ VEH_AIRCRAFT
Aircraft vehicle type.
@ VEH_SHIP
Ship vehicle type.
@ VEH_TRAIN
Train vehicle type.
uint32_t VehicleID
The type all our vehicle IDs have.
static const uint MAX_LENGTH_VEHICLE_NAME_CHARS
The maximum length of a vehicle name in characters including '\0'.
static const VehicleID INVALID_VEHICLE
Constant representing a non-existing vehicle.
DepotCommand
Flags for goto depot commands.
@ MassSend
Tells that it's a mass send to depot command (type in VLW flag)
@ DontCancel
Don't cancel current goto depot command if any.
@ Service
The vehicle will leave the depot right after arrival (service only)
bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli)
Generate a list of vehicles based on window type.
void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engines, VehicleList *wagons, bool individual_wagons)
Generate a list of vehicles inside a depot.
Functions and type for generating vehicle lists.
std::vector< const Vehicle * > VehicleList
A list of vehicles.
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, WidgetID widget_index)
Mark a particular widget in a particular window as dirty (in need of repainting)
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
@ WC_VEHICLE_DEPOT
Depot view; Window numbers:
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
@ WC_COMPANY
Company view; Window numbers:
@ WC_VEHICLE_VIEW
Vehicle view; Window numbers: