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,
107 bool refitting = cargo !=
CT_INVALID && cargo != default_cargo;
114 case VEH_SHIP: num_vehicles = 1;
break;
116 default: NOT_REACHED();
142 default: NOT_REACHED();
146 uint refitted_capacity = 0;
147 uint16 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.
Clear();
170 cargo_capacities[default_cargo] = refitted_capacity;
171 cargo_capacities[CT_MAIL] = refitted_mail_capacity;
196 if (flags != subflags) {
204 return { value, veh_id, refitted_capacity, refitted_mail_capacity, cargo_capacities };
224 if (ret.
Failed())
return ret;
232 front->
orders !=
nullptr &&
237 backup_order =
false;
269 if (e->
GetGRF() !=
nullptr) {
275 *auto_refit_allowed =
HasBit(cb_res, 14);
276 int factor =
GB(cb_res, 0, 14);
277 if (factor >= 0x2000) factor -= 0x4000;
282 *auto_refit_allowed = e->info.refit_cost == 0;
283 return (v ==
nullptr || v->
cargo_type != new_cid) ? e->info.refit_cost : 0;
300 int cost_factor =
GetRefitCostFactor(v, engine_type, new_cid, new_subtype, auto_refit_allowed);
303 base_price = PR_BUILD_VEHICLE_SHIP;
308 base_price = PR_BUILD_VEHICLE_ROAD;
313 base_price = PR_BUILD_VEHICLE_AIRCRAFT;
318 base_price = (e->u.rail.railveh_type ==
RAILVEH_WAGON) ? PR_BUILD_VEHICLE_WAGON : PR_BUILD_VEHICLE_TRAIN;
323 default: NOT_REACHED();
325 if (cost_factor < 0) {
355 uint total_capacity = 0;
356 uint total_mail_capacity = 0;
357 num_vehicles = num_vehicles == 0 ? UINT8_MAX : num_vehicles;
360 VehicleSet vehicles_to_refit;
367 std::vector<RefitResult> refit_result;
370 byte actual_subtype = new_subtype;
371 for (; v !=
nullptr; v = (only_this ? nullptr : v->
Next())) {
375 if (v->
type ==
VEH_TRAIN && std::find(vehicles_to_refit.begin(), vehicles_to_refit.end(), v->
index) == vehicles_to_refit.end() && !only_this)
continue;
383 if (!refittable && v->
cargo_type != new_cid) {
385 if (amount > 0) cargo_capacities[v->
cargo_type] += amount;
390 if (actual_subtype == 0xFF) {
402 uint16 mail_capacity = 0;
404 total_capacity += amount;
406 total_mail_capacity += mail_capacity;
408 cargo_capacities[new_cid] += amount;
409 cargo_capacities[CT_MAIL] += mail_capacity;
411 if (!refittable)
continue;
417 bool auto_refit_allowed;
419 if (auto_refit && (flags &
DC_QUERY_COST) == 0 && !auto_refit_allowed) {
423 total_capacity -= amount;
424 total_mail_capacity -= mail_capacity;
444 refit_result.push_back({v, amount, mail_capacity, actual_subtype});
465 refit_result.clear();
466 return { cost, total_capacity, total_mail_capacity, cargo_capacities };
484 if (v ==
nullptr)
return {
CMD_ERROR, 0, 0, {} };
493 if (ret.
Failed())
return { ret, 0, 0, {} };
505 return {
CommandCost(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT + front->
type), 0, 0, {} };
516 auto [cost, refit_capacity, mail_capacity, cargo_capacities] =
RefitVehicle(v, only_this, num_vehicles, new_cid, new_subtype, flags, auto_refit);
539 default: NOT_REACHED();
553 return { cost, refit_capacity, mail_capacity, cargo_capacities };
572 if (ret.
Failed())
return ret;
596 if (evaluate_startstop_cb) {
601 if (v->
GetGRF()->grf_version < 8) {
605 if (callback < 0x400) {
613 error = STR_ERROR_INCOMPATIBLE_RAIL_TYPES;
652 if (vehicle_list_window) {
660 for (uint i = 0; i < list.size(); i++) {
694 bool had_success =
false;
695 for (uint i = 0; i < list.size(); i++) {
705 return had_success ? cost : last_error;
726 for (uint i = 0; i < list.size(); i++) {
747 if (!v->name.empty() && v->name == name)
return false;
763 size_t number_position;
764 for (number_position = src->
name.length(); number_position > 0; number_position--) {
767 if (src->
name[number_position - 1] <
'0' || src->
name[number_position - 1] >
'9')
break;
773 if (number_position == src->
name.length()) {
777 number_position = buf.length();
781 buf = src->
name.substr(0, number_position);
783 auto num_str = src->
name.substr(number_position);
784 padding = (byte)num_str.length();
786 std::istringstream iss(num_str);
792 for (
int max_iterations = 1000; max_iterations > 0; max_iterations--, num++) {
793 std::ostringstream oss;
796 oss << buf << std::setw(padding) << std::setfill(
'0') << std::internal << num;
799 auto new_name = oss.str();
801 dst->
name = new_name;
846 }
while ((v = v->
Next()) !=
nullptr);
904 w->SetServiceIntervalIsCustom(v->ServiceIntervalIsCustom());
905 w->SetServiceIntervalIsPercent(v->ServiceIntervalIsPercent());
913 new_veh_id = w_front->
index;
935 assert(w !=
nullptr);
964 }
while (v !=
nullptr);
994 return { total_cost, new_veh_id };
1011 bool had_success =
false;
1012 for (uint i = 0; i < list.size(); i++) {
1023 if (!(flags &
DC_EXEC))
break;
1066 if (ret.
Failed())
return ret;
1068 bool reset = text.empty();
1104 if (ret.
Failed())
return ret;
1116 v->SetServiceInterval(serv_int);
1117 v->SetServiceIntervalIsCustom(is_custom);
1118 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.
uint GetDisplayDefaultCapacity(uint16 *mail_capacity=nullptr) const
Determines the default cargo capacity of an engine for display purposes.
static bool IsCompanyBuildableVehicleType(VehicleType type)
Is the given vehicle type buildable by a company?
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.
bool IsType(OrderType type) const
Check whether this order is of the given type.
std::vector< const Vehicle * > VehicleList
A list of vehicles.
static Titem * Get(size_t index)
Returns Titem with given index.
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
@ INVALID_CLIENT_ID
Client is not part of anything.
uint16 GetServiceIntervalClamped(uint interval, bool ispercent)
Clamp the service interval to the correct min/max.
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.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
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.
Vehicle * GetNextVehicle() const
Get the next real (non-articulated part) vehicle in the consist.
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 UnitID
Type for the company global vehicle unit number.
CommandCost CmdMassStartStopVehicle(DoCommandFlag flags, TileIndex tile, bool do_start, bool vehicle_list_window, const VehicleListIdentifier &vli)
Starts or stops a lot of vehicles.
Price
Enumeration of all base prices for use with Prices.
CargoArray GetCapacityOfArticulatedParts(EngineID engine)
Get the capacity of the parts of a given engine.
void GetVehicleSet(VehicleSet &set, Vehicle *v, uint8 num_vehicles)
Calculates the set of vehicles that will be affected by a given selection.
std::string name
Name of vehicle.
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.
uint16 crash_anim_pos
Crash animation counter.
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 bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static void CountVehicle(const Vehicle *v, int delta)
Update num_vehicle when adding or removing a vehicle.
static void SaveRandomSeeds(SavedRandomSeeds *storage)
Saves the current seeds.
VehicleDefaultSettings vehicle
default settings for vehicles
CommandCost CmdBuildShip(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
Build a ship.
std::tuple< CommandCost, uint, uint16, CargoArray > CmdRefitVehicle(DoCommandFlag flags, VehicleID veh_id, CargoID new_cid, byte new_subtype, bool auto_refit, bool only_this, uint8 num_vehicles)
Refits a vehicle to the specified cargo type.
const GRFFile * GetGRF() const
Retrieve the NewGRF the vehicle is tied to.
@ EXPENSES_AIRCRAFT_RUN
Running costs aircraft.
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.
uint16 cur_speed
current speed
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
bool IsGroundVehicle() const
Check if the vehicle is a ground vehicle.
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?
uint16 GetVehicleCallback(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v)
Evaluate a newgrf callback for vehicles.
@ DC_EXEC
execute the given command
static bool IsLocalCompany()
Is the current company the local company?
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.
static void RestoreRandomSeeds(const SavedRandomSeeds &storage)
Restores previously saved seeds.
void Clear()
Reset all entries.
static bool IsDepotTile(TileIndex tile)
Is the given tile a tile with a depot on it?
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.
void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_index)
Mark a particular widget in a particular window as dirty (in need of repainting)
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.
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.
uint16 EngineID
Unique identification number of an engine.
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 CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, bool free_cars, Vehicle **ret)
Build a railroad vehicle.
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.
std::tuple< CommandCost, VehicleID, uint, uint16, CargoArray > CmdBuildVehicle(DoCommandFlag flags, TileIndex tile, EngineID eid, bool use_free_vehicles, CargoID cargo, ClientID client_id)
Build 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
ClientID
'Unique' identifier to be given to clients
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?
virtual ExpensesType GetExpenseType(bool income) const
Sets the expense type associated to this vehicle type.
Order current_order
The current order (+ status, like: loading)
GroundVehicleCache gcache
Cache of often calculated values.
bool IsFrontEngine() const
Check if the vehicle is a front engine.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
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.
uint32 GetGRFID() const
Retrieve the GRF ID of the NewGRF the vehicle is tied to.
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.
static void Restore(Vehicle *v, uint32 user)
Restore the data of this order to the given vehicle.
Money GetCost() const
The costs as made up to this moment.
StringID GetGRFStringID(uint32 grfid, StringID stringid)
Returns the index for this stringid associated with its grfID.
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
@ VRF_REVERSE_DIRECTION
Reverse the visible direction of the vehicle.
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).
VehicleType
Available vehicle types.
bool CheckCompanyHasMoney(CommandCost &cost)
Verify whether the company can pay the bill.
byte misc_flags
Miscellaneous flags.
@ RAILVEH_WAGON
simple wagon, not motorized
void UpdateAircraftCache(Aircraft *v, bool update_range=false)
Update cached values of an aircraft.
CommandCost CmdChangeServiceInt(DoCommandFlag flags, VehicleID veh_id, uint16 serv_int, bool is_custom, bool is_percent)
Change the service interval of a vehicle.
static WindowClass GetWindowClassForVehicleType(VehicleType vt)
Get WindowClass for vehicle list of given vehicle type.
Helper structure for RefitVehicle()
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
@ 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.
uint16 cargo_cap
total capacity
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'.
uint32 cached_power
Total power of the consist (valid only for the first engine).
static Train * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
uint8 roadveh_acceleration_model
realistic acceleration for road vehicles
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
static std::tuple< CommandCost, uint, uint16, CargoArray > RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles, CargoID new_cid, byte new_subtype, DoCommandFlag flags, bool auto_refit)
Refits a vehicle (chain).
@ WC_VEHICLE_DEPOT
Depot view; Window numbers:
uint16 classes
Classes of this cargo type.
@ NUM_CARGO
Maximal number of cargo types in a game.
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.
uint8 cargo_map[NUM_CARGO]
Inverse cargo translation table (CargoID -> local ID)
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
@ DontCancel
Don't cancel current goto depot command if any.
UnitID unitnumber
unit number, for display purposes only
CommandCost CmdStartStopVehicle(DoCommandFlag flags, VehicleID veh_id, bool evaluate_startstop_cb)
Start/Stop a vehicle.
static bool IsUniqueVehicleName(const std::string &name)
Test if a name is unique among vehicle names.
@ EXPENSES_NEW_VEHICLES
New vehicles.
uint32 VehicleID
The type all our vehicle IDs have.
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
Rebuild the left autoreplace list if an engine is removed or added.
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
@ AIR_CTOL
Conventional Take Off and Landing, i.e. planes.
uint16 service_interval
The interval for (automatic) servicing; either in days or %.
bool servint_ispercent
service intervals are in percents
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
static void Backup(const Vehicle *v, uint32 user)
Create an order backup for the given vehicle.
@ EXPENSES_TRAIN_RUN
Running costs trains.
@ STARTTAKEOFF
Airplane has arrived at a runway for take-off.
uint DetermineCapacity(const Vehicle *v, uint16 *mail_capacity=nullptr) const
Determines capacity of a given vehicle from scratch.
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
byte state
State of the airport.
VehicleSettings vehicle
options for vehicles
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.
byte subtype
cargo subtype to refit to
ExpensesType
Types of expenses.
@ CT_INVALID
Invalid cargo type.
@ VEH_SHIP
Ship vehicle type.
std::tuple< CommandCost, VehicleID > CmdCloneVehicle(DoCommandFlag flags, TileIndex tile, VehicleID veh_id, bool share_orders)
Clone a vehicle.
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)
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.
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.
uint16 refit_cap
Capacity left over from before last refit.
static VehicleType GetDepotVehicleType(TileIndex t)
Get the type of vehicles that can use a depot.