|
OpenTTD Source
14.0-beta1
|
Go to the documentation of this file.
43 #include "table/strings.h"
48 const 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,
55 const 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,
62 const 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,
69 const 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 cargo_capacities[CT_MAIL] = refitted_mail_capacity;
200 if (flags != subflags) {
208 return { value, veh_id, refitted_capacity, refitted_mail_capacity, cargo_capacities };
228 if (ret.
Failed())
return ret;
236 front->
orders !=
nullptr &&
241 backup_order =
false;
273 if (e->
GetGRF() !=
nullptr) {
279 *auto_refit_allowed =
HasBit(cb_res, 14);
280 int factor =
GB(cb_res, 0, 14);
281 if (factor >= 0x2000) factor -= 0x4000;
286 *auto_refit_allowed = e->info.refit_cost == 0;
287 return (v ==
nullptr || v->
cargo_type != new_cid) ? e->info.refit_cost : 0;
304 int cost_factor =
GetRefitCostFactor(v, engine_type, new_cid, new_subtype, auto_refit_allowed);
307 base_price = PR_BUILD_VEHICLE_SHIP;
312 base_price = PR_BUILD_VEHICLE_ROAD;
317 base_price = PR_BUILD_VEHICLE_AIRCRAFT;
322 base_price = (e->u.rail.railveh_type ==
RAILVEH_WAGON) ? PR_BUILD_VEHICLE_WAGON : PR_BUILD_VEHICLE_TRAIN;
327 default: NOT_REACHED();
329 if (cost_factor < 0) {
359 uint total_capacity = 0;
360 uint total_mail_capacity = 0;
361 num_vehicles = num_vehicles == 0 ? UINT8_MAX : num_vehicles;
364 VehicleSet vehicles_to_refit;
371 std::vector<RefitResult> refit_result;
374 byte actual_subtype = new_subtype;
375 for (; v !=
nullptr; v = (only_this ? nullptr : v->
Next())) {
379 if (v->
type ==
VEH_TRAIN && std::find(vehicles_to_refit.begin(), vehicles_to_refit.end(), v->
index) == vehicles_to_refit.end() && !only_this)
continue;
387 if (!refittable && v->
cargo_type != new_cid) {
389 if (amount > 0) cargo_capacities[v->
cargo_type] += amount;
394 if (actual_subtype == 0xFF) {
406 uint16_t mail_capacity = 0;
408 total_capacity += amount;
410 total_mail_capacity += mail_capacity;
412 cargo_capacities[new_cid] += amount;
413 cargo_capacities[CT_MAIL] += mail_capacity;
415 if (!refittable)
continue;
421 bool auto_refit_allowed;
423 if (auto_refit && (flags &
DC_QUERY_COST) == 0 && !auto_refit_allowed) {
427 total_capacity -= amount;
428 total_mail_capacity -= mail_capacity;
448 refit_result.push_back({v, amount, mail_capacity, actual_subtype});
462 assert(w !=
nullptr);
470 refit_result.clear();
471 return { cost, total_capacity, total_mail_capacity, cargo_capacities };
489 if (v ==
nullptr)
return {
CMD_ERROR, 0, 0, {} };
498 if (ret.
Failed())
return { ret, 0, 0, {} };
510 return {
CommandCost(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT + front->
type), 0, 0, {} };
521 auto [cost, refit_capacity, mail_capacity, cargo_capacities] =
RefitVehicle(v, only_this, num_vehicles, new_cid, new_subtype, flags, auto_refit);
544 default: NOT_REACHED();
558 return { cost, refit_capacity, mail_capacity, cargo_capacities };
577 if (ret.
Failed())
return ret;
601 if (evaluate_startstop_cb) {
606 if (v->
GetGRF()->grf_version < 8) {
610 if (callback < 0x400) {
618 error = STR_ERROR_INCOMPATIBLE_RAIL_TYPES;
661 if (vehicle_list_window) {
669 for (uint i = 0; i < list.size(); i++) {
703 bool had_success =
false;
704 for (uint i = 0; i < list.size(); i++) {
714 return had_success ? cost : last_error;
735 for (uint i = 0; i < list.size(); i++) {
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 = (byte)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);
@ VEH_AIRCRAFT
Aircraft vehicle type.
uint TotalCount() const
Returns sum of cargo, including reserved cargo.
virtual bool IsChainInDepot() const
Check whether the whole vehicle chain is in the depot.
debug_inline bool IsFrontEngine() const
Check if the vehicle is a front engine.
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-...
@ EXPENSES_ROADVEH_RUN
Running costs road vehicles.
uint mail_capacity
New mail capacity of aircraft.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
bool IsType(OrderType type) const
Check whether this order is of the given type.
uint16_t UnitID
Type for the company global vehicle unit number.
std::vector< const Vehicle * > VehicleList
A list of vehicles.
static Titem * Get(size_t index)
Returns Titem with given index.
uint16_t crash_anim_pos
Crash animation counter.
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
static void CountEngine(const Vehicle *v, int delta)
Update num_engines when adding/removing an engine.
Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift)
Determine a certain price.
Money value
Value of the vehicle.
byte subtype
Type of aircraft.
@ CBID_VEHICLE_START_STOP_CHECK
Called when the company (or AI) tries to start or stop a vehicle.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
The information about a vehicle list.
uint16_t cargo_cap
total capacity
Vehicle * GetNextVehicle() const
Get the next real (non-articulated part) vehicle in the consist.
uint GetDisplayDefaultCapacity(uint16_t *mail_capacity=nullptr) const
Determines the default cargo capacity of an engine for display purposes.
CommandCost CmdRenameVehicle(DoCommandFlag flags, VehicleID veh_id, const std::string &text)
Give a custom name to your vehicle.
Vehicle * Next() const
Get the next vehicle of this vehicle.
static CommandCost SendAllVehiclesToDepot(DoCommandFlag flags, bool service, const VehicleListIdentifier &vli)
Send all vehicles of type to depots.
uint16_t service_interval
The interval for (automatic) servicing; either in days or %.
CommandCost CmdMassStartStopVehicle(DoCommandFlag flags, TileIndex tile, bool do_start, bool vehicle_list_window, const VehicleListIdentifier &vli)
Starts or stops a lot of vehicles.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Price
Enumeration of all base prices for use with Prices.
CargoArray GetCapacityOfArticulatedParts(EngineID engine)
Get the capacity of the parts of a given engine.
std::string name
Name of vehicle.
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
Stores the state of all random number generators.
Tindex index
Index of this pool item.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
uint32_t GetGRFID() const
Retrieve the GRF ID of the NewGRF the vehicle is tied to.
Class for storing amounts of cargo.
GroupID group_id
Index of group Pool array.
void DeleteVehicleNews(VehicleID vid, StringID news)
Delete a news item type about a vehicle.
static void CountVehicle(const Vehicle *v, int delta)
Update num_vehicle when adding or removing a vehicle.
VehicleDefaultSettings vehicle
default settings for vehicles
CommandCost CmdBuildShip(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
Build a ship.
const GRFFile * GetGRF() const
Retrieve the NewGRF the vehicle is tied to.
@ EXPENSES_AIRCRAFT_RUN
Running costs aircraft.
void SaveRandomSeeds(SavedRandomSeeds *storage)
Saves the current seeds.
static std::tuple< CommandCost, uint, uint16_t, CargoArray > RefitVehicle(Vehicle *v, bool only_this, uint8_t num_vehicles, CargoID new_cid, byte new_subtype, DoCommandFlag flags, bool auto_refit)
Refits a vehicle (chain).
CommandCost CmdDepotMassAutoReplace(DoCommandFlag flags, TileIndex tile, VehicleType vehicle_type)
Autoreplace all vehicles in the depot.
Specification of a cargo type.
bool IsRearDualheaded() const
Tell if we are dealing with the rear end of a multiheaded engine.
@ CCF_REFIT
Valid changes for refitting in a depot.
@ WC_COMPANY
Company view; Window numbers:
Vehicle * GetNextArticulatedPart() const
Get the next part of an articulated engine.
@ VEH_ROAD
Road vehicle type.
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
bool IsShared() const
Is this a shared order list?
CargoID GetDefaultCargoType() const
Determines the default cargo type of an engine.
Owner owner
Which company owns the vehicle?
void GetVehicleSet(VehicleSet &set, Vehicle *v, uint8_t num_vehicles)
Calculates the set of vehicles that will be affected by a given selection.
@ DC_EXEC
execute the given command
debug_inline bool IsGroundVehicle() const
Check if the vehicle is a ground vehicle.
DoCommandFlag
List of flags for a command.
uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
Count the number of articulated parts of an engine.
bool Succeeded() const
Did this command succeed?
@ TERM7
Heading for terminal 7.
bool IsArticulatedPart() const
Check if the vehicle is an articulated part of an engine.
@ Service
The vehicle will leave the depot right after arrival (service only)
Aircraft, helicopters, rotors and their shadows belong to this class.
void UpdateCache()
Update the caches of this ship.
const GRFFile * GetGRF() const
Retrieve the NewGRF the engine is tied to.
static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID new_cid, byte new_subtype, bool *auto_refit_allowed)
Helper to run the refit cost callback.
uint16_t GetServiceIntervalClamped(int interval, bool ispercent)
Clamp the service interval to the correct min/max.
uint DetermineCapacity(const Vehicle *v, uint16_t *mail_capacity=nullptr) const
Determines capacity of a given vehicle from scratch.
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...
@ CBID_VEHICLE_REFIT_COST
Called to determine the cost factor for refitting a vehicle.
DepotCommand
Flags for goto depot commands.
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
@ EF_AUTO_REFIT
Automatic refitting is allowed.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
Common return value for all commands.
@ VAF_HELI_DIRECT_DESCENT
The helicopter is descending directly at its destination (helipad or in front of hangar)
CommandCost CmdDepotSellAllVehicles(DoCommandFlag flags, TileIndex tile, VehicleType vehicle_type)
Sells all vehicles in a depot.
uint Truncate(uint max_move=UINT_MAX)
Truncates the cargo in this list to the given amount.
@ WC_VEHICLE_VIEW
Vehicle view; Window numbers:
static CommandCost GetRefitCost(const Vehicle *v, EngineID engine_type, CargoID new_cid, byte new_subtype, bool *auto_refit_allowed)
Learn the price of refitting a certain engine.
CommandCost CmdChangeServiceInt(DoCommandFlag flags, VehicleID veh_id, uint16_t serv_int, bool is_custom, bool is_percent)
Change the service interval of a vehicle.
TileIndex tile
Current tile index.
static const VehicleID INVALID_VEHICLE
Constant representing a non-existing vehicle.
@ MassSend
Tells that it's a mass send to depot command (type in VLW flag)
EngineID engine_type
The type of engine used for this vehicle.
@ VS_CRASHED
Vehicle is crashed.
bool do_start
flag for starting playback of next_file at next opportunity
UnitID GetFreeUnitNumber(VehicleType type)
Get an unused unit number for a vehicle (if allowed).
VehicleCargoList cargo
The cargo this vehicle is carrying.
bool Failed() const
Did this command fail?
Order current_order
The current order (+ status, like: loading)
GroundVehicleCache gcache
Cache of often calculated values.
virtual ExpensesType GetExpenseType([[maybe_unused]] bool income) const
Sets the expense type associated to this vehicle type.
uint16_t cur_speed
current speed
GameSettings _settings_game
Game settings of a running game or the scenario editor.
bool IsCompanyBuildableVehicleType(VehicleType type)
Is the given vehicle type buildable by a company?
CompanySettings settings
settings specific for each company
@ DC_AUTOREPLACE
autoreplace/autorenew is in progress, this shall disable vehicle limits when building,...
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
@ VS_STOPPED
Vehicle is stopped by the player.
static void CloneVehicleName(const Vehicle *src, Vehicle *dst)
Clone the custom name of a vehicle, adding or incrementing a number.
const Engine * GetEngine() const
Retrieves the engine of the vehicle.
void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engines, VehicleList *wagons, bool individual_wagons)
Generate a list of vehicles inside a depot.
bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli)
Generate a list of vehicles based on window type.
static void UpdateAutoreplace(CompanyID company)
Update autoreplace_defined and autoreplace_finished of all statistics of a company.
Vehicle * v
Vehicle to refit.
Money GetCost() const
The costs as made up to this moment.
@ VRF_REVERSE_DIRECTION
Reverse the visible direction of the vehicle.
uint32_t VehicleID
The type all our vehicle IDs have.
bool IsDepotTile(Tile tile)
Is the given tile a tile with a depot on it?
StringID GetGRFStringID(uint32_t grfid, StringID stringid)
Returns the index for this stringid associated with its grfID.
Money GetCost() const
Return how much a new engine costs.
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
CommandCost SendToDepot(DoCommandFlag flags, DepotCommand command)
Send this vehicle to the depot using the given command(s).
std::tuple< CommandCost, uint, uint16_t, CargoArray > CmdRefitVehicle(DoCommandFlag flags, VehicleID veh_id, CargoID new_cid, byte new_subtype, bool auto_refit, bool only_this, uint8_t num_vehicles)
Refits a vehicle to the specified cargo type.
VehicleType
Available vehicle types.
bool CheckCompanyHasMoney(CommandCost &cost)
Verify whether the company can pay the bill.
byte misc_flags
Miscellaneous flags.
VehicleType GetDepotVehicleType(Tile t)
Get the type of vehicles that can use a depot.
@ RAILVEH_WAGON
simple wagon, not motorized
void ResetDepotUnbunching()
Resets all the data used for depot unbunching.
void UpdateAircraftCache(Aircraft *v, bool update_range=false)
Update cached values of an aircraft.
uint8_t roadveh_acceleration_model
realistic acceleration for road vehicles
Helper structure for RefitVehicle()
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
@ CCF_AUTOREFIT
Valid changes for autorefitting in stations.
CompanyID _current_company
Company currently doing an action.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Vehicle * First() const
Get the first vehicle of this vehicle chain.
bool CanCarryCargo() const
Determines whether an engine can carry something.
void RoadVehUpdateCache(RoadVehicle *v, bool same_length=false)
Update the cache of a road vehicle.
static const uint MAX_LENGTH_VEHICLE_NAME_CHARS
The maximum length of a vehicle name in characters including '\0'.
ClientID
'Unique' identifier to be given to clients
static Train * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
void ConsistChanged(ConsistChangeFlags allowed_changes)
Recalculates the cached stuff of a train.
VehicleType vtype
The vehicle type associated with this list.
void InvalidateNewGRFCacheOfChain()
Invalidates cached NewGRF variables of all vehicles in the chain (after the current vehicle)
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
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...
CommandCost CmdSendVehicleToDepot(DoCommandFlag flags, VehicleID veh_id, DepotCommand depot_cmd, const VehicleListIdentifier &vli)
Send a vehicle to the depot.
@ RAILVEH_MULTIHEAD
indicates a combination of two locomotives
@ WC_VEHICLE_DEPOT
Depot view; Window numbers:
bool HasArticulatedPart() const
Check if an engine has an articulated part.
CommandCost CmdSellVehicle(DoCommandFlag flags, VehicleID v_id, bool sell_chain, bool backup_order, ClientID client_id)
Sell a vehicle.
static void Restore(Vehicle *v, uint32_t user)
Restore the data of this order to the given vehicle.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
Build a railroad vehicle.
@ DontCancel
Don't cancel current goto depot command if any.
@ INVALID_CLIENT_ID
Client is not part of anything.
UnitID unitnumber
unit number, for display purposes only
CommandCost CmdStartStopVehicle(DoCommandFlag flags, VehicleID veh_id, bool evaluate_startstop_cb)
Start/Stop a vehicle.
void RestoreRandomSeeds(const SavedRandomSeeds &storage)
Restores previously saved seeds.
@ EXPENSES_NEW_VEHICLES
New vehicles.
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
Rebuild the left autoreplace list if an engine is removed or added.
uint32_t cached_power
Total power of the consist (valid only for the first engine).
@ AIR_CTOL
Conventional Take Off and Landing, i.e. planes.
bool servint_ispercent
service intervals are in percents
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
@ EXPENSES_TRAIN_RUN
Running costs trains.
@ STARTTAKEOFF
Airplane has arrived at a runway for take-off.
byte CargoID
Cargo slots to indicate a cargo type within a game.
bool IsStoppedInDepot() const
Check whether the vehicle is in the depot and stopped.
CommandCost CmdBuildRoadVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
Build a road vehicle.
void CargoChanged()
Recalculates the cached weight of a vehicle and its parts.
CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, bool sell_chain, bool backup_order, ClientID user)
Sell a (single) train wagon/engine.
CargoID cargo_type
type of cargo this vehicle is carrying
bool IsValidCargoID(CargoID t)
Test whether cargo type is not INVALID_CARGO.
static void Backup(const Vehicle *v, uint32_t user)
Create an order backup for the given vehicle.
byte state
State of the airport.
VehicleSettings vehicle
options for vehicles
uint16_t EngineID
Unique identification number of an engine.
bool IsUniqueVehicleName(const std::string &name)
Test if a name is unique among vehicle names.
byte cargo_subtype
Used for livery refits (NewGRF variations)
bool IsFreeWagon() const
Check if the vehicle is a free wagon (got no engine in front of it).
@ VEH_TRAIN
Train vehicle type.
uint capacity
New capacity of vehicle.
VehicleType type
Type of vehicle.
@ DC_QUERY_COST
query cost only, don't build.
static const CargoID NUM_CARGO
Maximum number of cargo types in a game.
byte subtype
cargo subtype to refit to
ExpensesType
Types of expenses.
uint16_t GetVehicleCallback(CallbackID callback, uint32_t param1, uint32_t param2, EngineID engine, const Vehicle *v)
Evaluate a newgrf callback for vehicles.
@ VEH_SHIP
Ship vehicle type.
std::tuple< CommandCost, VehicleID > CmdCloneVehicle(DoCommandFlag flags, TileIndex tile, VehicleID veh_id, bool share_orders)
Clone a vehicle.
bool IsLocalCompany()
Is the current company the local company?
bool IsTileOwner(Tile tile, Owner owner)
Checks if a tile belongs to the given owner.
OrderList * orders
Pointer to the order list for this vehicle.
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, WidgetID widget_index)
Mark a particular widget in a particular window as dirty (in need of repainting)
std::array< uint8_t, NUM_CARGO > cargo_map
Inverse cargo translation table (CargoID -> local ID)
byte flags
Aircraft flags.
bool IsEngineBuildable(EngineID engine, VehicleType type, CompanyID company)
Check if an engine is buildable.
byte GetBestFittingSubType(Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_type)
Get the best fitting subtype when 'cloning'/'replacing' v_from with v_for.
VehicleOrderID GetNumOrders() const
Get number of orders in the order list.
@ EXPENSES_SHIP_RUN
Running costs ships.
void NormalizeTrainVehInDepot(const Train *u)
Move all free vehicles in the depot to the train.
CommandCost CmdBuildAircraft(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
Build an aircraft.
virtual void MarkDirty()
Marks the vehicles to be redrawn and updates cached variables.
VehicleType type
Vehicle type, ie VEH_ROAD, VEH_TRAIN, etc.
WindowClass GetWindowClassForVehicleType(VehicleType vt)
Get WindowClass for vehicle list of given vehicle type.
uint16_t refit_cap
Capacity left over from before last refit.
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.
uint16_t classes
Classes of this cargo type.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.