Go to the documentation of this file.
55 #include "table/strings.h"
76 static inline int32
BigMulS(const int32 a, const int32 b, const uint8 shift)
78 return (int32)((int64)a * (int64)b >> shift);
81 typedef std::vector<Industry *> SmallIndustryList;
102 static PriceMultipliers _price_base_multiplier;
104 extern int GetAmountOwnedBy(
const Company *c,
Owner owner);
117 Money owned_shares_value = 0;
120 int shares_owned = GetAmountOwnedBy(co, c->
index);
122 if (shares_owned > 0) owned_shares_value += (CalculateCompanyValueExcludingShares(co) / 4) * shares_owned;
125 return owned_shares_value + CalculateCompanyValueExcludingShares(c);
128 Money CalculateCompanyValueExcludingShares(
const Company *c,
bool including_loan)
135 if (st->owner == owner) num +=
CountBits((
byte)st->facilities);
138 Money value = num * _price[PR_STATION_VALUE] * 25;
141 if (v->owner != owner)
continue;
147 value += v->value * 3 >> 1;
155 return std::max<Money>(value, 1);
171 memset(_score_part[owner], 0,
sizeof(_score_part[owner]));
175 Money min_profit = 0;
176 bool min_profit_first =
true;
180 if (v->owner != owner)
continue;
182 if (v->profit_last_year > 0) num++;
185 if (min_profit_first || min_profit > v->profit_last_year) {
186 min_profit = v->profit_last_year;
187 min_profit_first =
false;
195 _score_part[owner][SCORE_VEHICLES] = num;
197 if (min_profit > 0) {
198 _score_part[owner][SCORE_MIN_PROFIT] = min_profit;
207 if (st->owner == owner && (st->time_since_load <= 20 || st->time_since_unload <= 20)) num +=
CountBits((
byte)st->facilities);
209 _score_part[owner][SCORE_STATIONS] = num;
223 }
while (++cee, --numec);
225 if (min_income > 0) {
226 _score_part[owner][SCORE_MIN_INCOME] = min_income;
229 _score_part[owner][SCORE_MAX_INCOME] = max_income;
241 }
while (++cee, --numec);
243 _score_part[owner][SCORE_DELIVERED] = total_delivered;
255 _score_part[owner][SCORE_MONEY] = c->
money;
313 if (c->
index != old_owner) {
322 assert(old_owner != new_owner);
327 if (share_owner == old_owner) {
343 if (c->bankrupt_value == 0 && share_owner == new_owner) {
347 cur_company2.
Change(share_owner);
365 if (s->awarded == old_owner) {
369 s->awarded = new_owner;
379 if (
HasBit(t->have_ratings, old_owner)) {
380 if (
HasBit(t->have_ratings, new_owner)) {
382 t->ratings[new_owner] = std::max(t->ratings[new_owner], t->ratings[old_owner]);
384 SetBit(t->have_ratings, new_owner);
385 t->ratings[new_owner] = t->ratings[old_owner];
392 ClrBit(t->have_ratings, old_owner);
395 if (t->exclusive_counter > 0 && t->exclusivity == old_owner) {
397 t->exclusivity = new_owner;
399 t->exclusive_counter = 0;
409 if (v->Previous() ==
nullptr)
delete v;
423 RemoveAllGroupsForCompany(old_owner);
426 if (g->owner == old_owner) g->owner = new_owner;
457 if (!v->ServiceIntervalIsCustom()) {
467 v->owner = new_owner;
470 v->colourmap = PAL_NONE;
471 v->InvalidateNewGRFCache();
473 if (v->IsEngineCountable()) {
476 if (v->IsPrimaryVehicle()) {
478 v->unitnumber = unitidgen[v->type].
NextID();
482 if (v->cargo_payment !=
nullptr) v->cargo_payment->owner =
nullptr;
525 if (st->owner == old_owner) {
534 if (wp->owner == old_owner) {
545 if (g->company == old_owner)
delete g;
552 if (sp->company == old_owner)
delete sp;
597 SetDParam(0, STR_NEWS_COMPANY_IN_TROUBLE_TITLE);
598 SetDParam(1, STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION);
600 AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
611 c->bankrupt_value = val;
616 assert(c->bankrupt_value > 0);
737 if (check_year && (_cur_year < ORIGINAL_BASE_YEAR || _cur_year >=
ORIGINAL_MAX_YEAR))
return true;
764 for (
Price i = PR_BEGIN; i < PR_END; i++) {
769 switch (_price_base_specs[i].category) {
781 case 0: price *= 6;
break;
782 case 1: price *= 8;
break;
783 case 2: price *= 9;
break;
784 default: NOT_REACHED();
791 int shift = _price_base_multiplier[i] - 16 - 3;
804 price =
Clamp(_price_base_specs[i].start_price, -1, 1);
814 cs->current_payment = (cs->initial_payment * (int64)_economy.
inflation_payment) >> 16;
856 static void HandleEconomyFluctuations()
863 _economy.
fluct = -12;
869 if (_economy.
fluct == 0) {
870 _economy.
fluct = -(int)
GB(Random(), 0, 2);
872 }
else if (_economy.
fluct == -12) {
873 _economy.
fluct =
GB(Random(), 0, 8) + 312;
884 memset(_price_base_multiplier, 0,
sizeof(_price_base_multiplier));
896 assert(price < PR_END);
921 void StartupEconomy()
926 _economy.
fluct =
GB(Random(), 0, 8) + 168;
931 for (
int i = 0; i < months; i++) {
963 if (index >= PR_END)
return 0;
965 Money cost = _price[index] * cost_factor;
977 Money GetTransportedGoodsIncome(uint num_pieces, uint dist,
byte transit_days,
CargoID cargo_type)
987 uint32 var18 = std::min(dist, 0xFFFFu) | (std::min(num_pieces, 0xFFu) << 16) | (transit_days << 24);
990 int result =
GB(callback, 0, 14);
993 if (
HasBit(callback, 14)) result -= 0x4000;
998 return result * num_pieces * cs->current_payment / 8192;
1002 static const int MIN_TIME_FACTOR = 31;
1003 static const int MAX_TIME_FACTOR = 255;
1005 const int days1 = cs->transit_days[0];
1006 const int days2 = cs->transit_days[1];
1007 const int days_over_days1 = std::max( transit_days - days1, 0);
1008 const int days_over_days2 = std::max(days_over_days1 - days2, 0);
1020 const int time_factor = std::max(MAX_TIME_FACTOR - days_over_days1 - days_over_days2, MIN_TIME_FACTOR);
1022 return BigMulS(dist * time_factor * num_pieces, cs->current_payment, 21);
1050 if (num_pieces == 0)
break;
1053 if (ind->
index == source)
continue;
1073 num_pieces -= amount;
1098 assert(num_pieces > 0);
1109 if (accepted_total > 0) {
1123 Money profit = GetTransportedGoodsIncome(accepted_total,
DistanceManhattan(source_tile, st->
xy), days_in_transit, cargo_type);
1131 case 0: profit += profit >> 1;
break;
1132 case 1: profit *= 2;
break;
1133 case 2: profit *= 3;
break;
1134 default: profit *= 4;
break;
1162 if (cargo_waiting == 0)
continue;
1182 current_station(front->last_station_visited)
1186 CargoPayment::~CargoPayment()
1205 this->front->z_pos, this->visual_transfer, -this->visual_profit);
1208 this->front->z_pos, -this->visual_profit);
1211 cur_company.Restore();
1221 if (this->owner ==
nullptr) {
1262 curr_station->loading_vehicles.push_back(front_v);
1280 for (
Vehicle *v = front_v; v !=
nullptr; v = v->
Next()) {
1282 if (v->cargo_cap > 0 && v->cargo.TotalCount() > 0) {
1303 uint load_amount = e->info.load_amount;
1307 if (air_mail) load_amount =
CeilDiv(load_amount, 4);
1311 if (e->
GetGRF() !=
nullptr && e->
GetGRF()->grf_version >= 8) {
1319 if (e->
GetGRF()->grf_version < 8) cb_load_amount =
GB(cb_load_amount, 0, 8);
1320 if (cb_load_amount >= 0x100) {
1322 }
else if (cb_load_amount != 0) {
1323 load_amount = cb_load_amount;
1332 return std::max(1u, load_amount);
1344 template<
class Taction>
1347 for (
Vehicle *w = v; w !=
nullptr;
1349 if (!action(w))
return false;
1352 if (train->
IsMultiheaded() && !action(train->other_multiheaded_part))
return false;
1400 this->refit_mask |= EngInfo(v->
engine_type)->refit_mask;
1460 if (this->do_reserve) {
1484 CargoTypes refit_mask = v->
GetEngine()->info.refit_mask;
1490 if (is_auto_refit) {
1504 if (refit_capacity > 0 && (consist_capleft[cid] < consist_capleft[new_cid] ||
1505 (consist_capleft[cid] == consist_capleft[new_cid] &&
1514 if (new_cid < NUM_CARGO && new_cid != v_start->cargo_type) {
1547 st(st), next_station(next_station) {}
1553 &v->
cargo, st->
xy, *next_station);
1575 for (
Vehicle *v = u; v !=
nullptr; v = v->
Next()) {
1576 assert(v->cargo_cap >= v->cargo.RemainingCount());
1581 if (!v->IsArticulatedPart() &&
1587 if (consist_capleft ==
nullptr || v->cargo_cap == 0)
continue;
1588 (*consist_capleft)[v->cargo_type] += v->cargo_cap - v->cargo.RemainingCount();
1606 ticks += (overhang * ticks) / 8;
1645 int new_load_unload_ticks = 0;
1646 bool dirty_vehicle =
false;
1647 bool dirty_station =
false;
1649 bool completely_emptied =
true;
1650 bool anything_unloaded =
false;
1651 bool anything_loaded =
false;
1652 CargoTypes full_load_amount = 0;
1653 CargoTypes cargo_not_full = 0;
1654 CargoTypes cargo_full = 0;
1655 CargoTypes reservation_left = 0;
1661 uint artic_part = 0;
1662 for (
Vehicle *v = front; v !=
nullptr; v = v->
Next()) {
1664 if (v->cargo_cap == 0)
continue;
1670 uint cargo_count = v->
cargo.UnloadCount();
1672 bool remaining =
false;
1674 assert(payment !=
nullptr);
1685 if (v->cargo_cap < new_remaining) {
1687 v->cargo.Return(new_remaining - v->cargo_cap, &ge->
cargo, INVALID_STATION);
1698 anything_unloaded =
true;
1704 dirty_station =
true;
1714 amount_unloaded = v->cargo.Unload(amount_unloaded, &ge->
cargo, payment);
1715 remaining = v->cargo.UnloadCount() > 0;
1716 if (amount_unloaded > 0) {
1717 dirty_vehicle =
true;
1718 anything_unloaded =
true;
1719 new_load_unload_ticks += amount_unloaded;
1722 st->time_since_unload = 0;
1726 completely_emptied =
false;
1741 ge = &st->
goods[v->cargo_type];
1745 v->refit_cap = v->cargo_cap;
1749 switch (front->
type) {
1763 default: NOT_REACHED();
1770 assert(v->cargo_cap >= v->cargo.StoredCount());
1772 uint cap_left = v->cargo_cap - v->cargo.StoredCount();
1781 if (v->cargo.StoredCount() == 0) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO);
1784 uint loaded = ge->
cargo.
Load(cap_left, &v->cargo, st->
xy, next_station);
1788 SetBit(reservation_left, v->cargo_type);
1792 if (loaded == cap_left) {
1793 SetBit(full_load_amount, v->cargo_type);
1795 ClrBit(full_load_amount, v->cargo_type);
1806 completely_emptied =
false;
1807 anything_loaded =
true;
1809 st->time_since_load = 0;
1810 st->last_vehicle_type = v->type;
1818 new_load_unload_ticks += loaded;
1820 dirty_vehicle = dirty_station =
true;
1825 if (v->cargo.StoredCount() >= v->cargo_cap) {
1826 SetBit(cargo_full, v->cargo_type);
1828 SetBit(cargo_not_full, v->cargo_type);
1832 if (anything_loaded || anything_unloaded) {
1840 completely_emptied &= anything_unloaded;
1842 if (!anything_unloaded)
delete payment;
1845 if (anything_loaded || anything_unloaded) {
1849 const uint gradual_loading_wait_time[] = { 40, 20, 10, 20 };
1851 new_load_unload_ticks = gradual_loading_wait_time[front->
type];
1863 bool finished_loading =
true;
1869 (cargo_not_full != 0 && (cargo_full & ~cargo_not_full) == 0)) {
1870 finished_loading =
false;
1872 }
else if (cargo_not_full != 0) {
1873 finished_loading =
false;
1894 StringID percent_up_down = STR_NULL;
1903 if (completely_emptied) {
1906 dirty_vehicle =
true;
1907 TriggerVehicle(front, VEHICLE_TRIGGER_EMPTY);
1910 if (dirty_vehicle) {
1915 if (dirty_station) {
1930 if (st->loading_vehicles.empty())
return;
1932 Vehicle *last_loading =
nullptr;
1933 std::list<Vehicle *>::iterator iter;
1936 for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
1952 if (last_loading ==
nullptr)
return;
1954 for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
1957 if (v == last_loading)
break;
1978 HandleEconomyFluctuations();
1981 static void DoAcquireCompany(
Company *c)
1987 SetDParam(0, STR_NEWS_COMPANY_MERGER_TITLE);
1988 SetDParam(1, c->bankrupt_value == 0 ? STR_NEWS_MERGER_TAKEOVER_TITLE : STR_NEWS_COMPANY_MERGER_DESCRIPTION);
1992 AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
1998 if (c->bankrupt_value == 0) {
2039 if (!c->
is_ai)
return cost;
2051 auto current_company_owns_share = [](
auto share_owner) {
return share_owner ==
_current_company; };
2053 c->bankrupt_value = 0;
2054 DoAcquireCompany(c);
2084 cost = -(cost - (cost >> 7));
2126 DoAcquireCompany(c);
@ VEH_AIRCRAFT
Aircraft vehicle type.
static uint MapLogX()
Logarithm of the map size along the X side.
GroundVehicleCache * GetGroundVehicleCache()
Access the ground vehicle cache of the vehicle.
void Change(const U &new_value)
Change the value of the variable.
static bool IsCompanyBuildableVehicleType(VehicleType type)
Is the given vehicle type buildable by a company?
bool is_ai
If true, the company is (also) controlled by the computer (a NoAI program).
bool improved_load
improved loading algorithm
bool IsRefit() const
Is this order a refit order.
CargoTypes & refit_mask
Bitmask of possible refit cargoes.
@ WC_ROADVEH_LIST
Road vehicle list; Window numbers:
uint32 GetGRFID() const
Retrieve the GRF ID of the NewGRF the engine is tied to.
uint StoredCount() const
Returns sum of cargo on board the vehicle (ie not only reserved).
bool IterateVehicleParts(Vehicle *v, Taction action)
Iterate the articulated parts of a vehicle, also considering the special cases of "normal" aircraft a...
const T GetSum() const
Get the sum of all cargo amounts.
uint64 inflation_prices
Cumulated inflation of prices since game start; 16 bit fractional part.
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-...
Struct about goals, current and completed.
Minimal stack that uses a pool to avoid pointers.
uint8 callback_mask
Bitmask of cargo callbacks that have to be called.
@ CBM_IND_PRODUCTION_CARGO_ARRIVAL
call production callback when cargo arrives at the industry
GoodsEntry goods[NUM_CARGO]
Goods at this station.
Money company_value
The value of the company.
@ TRACK_BIT_NONE
No track.
@ ROADTYPE_END
Used for iterations.
@ OUFB_UNLOAD
Force unloading all cargo onto the platform, possibly not getting paid.
bool IsType(OrderType type) const
Check whether this order is of the given type.
static Titem * Get(size_t index)
Returns Titem with given index.
void PrepareUnload(Vehicle *front_v)
Prepare the vehicle to be unloaded.
@ CBM_CARGO_PROFIT_CALC
custom profit calculation
static Money SignalMaintenanceCost(uint32 num)
Calculates the maintenance cost of a number of signals.
Money visual_profit
The visual profit to show.
uint16 GetTimetabledWait() const
Get the time in ticks a vehicle should wait at the destination or 0 if it's not timetabled.
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
uint GetPlatformLength(TileIndex tile, DiagDirection dir) const override
Determines the REMAINING length of a platform, starting at (and including) the given tile.
Action for finalizing a refit.
@ INVALID_CLIENT_ID
Client is not part of anything.
static void CountEngine(const Vehicle *v, int delta)
Update num_engines when adding/removing an engine.
bool allow_shares
allow the buying/selling of shares
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.
uint64 inflation_payment
Cumulated inflation of cargo payment since game start; 16 bit fractional part.
void CompanyAdminUpdate(const Company *company)
Called whenever company related information changes in order to notify admins.
static SigSegState UpdateSignalsInBuffer(Owner owner)
Updates blocks in _globset buffer.
static bool HasSignalOnTrack(TileIndex tile, Track track)
Checks for the presence of signals (either way) on the given track on the given rail tile.
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.
Vehicle * front
The front vehicle to do the payment of.
StationID current_station
The current station.
Vehicle * Previous() const
Get the previous vehicle of this vehicle.
@ SCORE_TOTAL
This must always be the last entry.
Money visual_transfer
The transfer credits to be shown.
Class to backup a specific variable and restore it later.
PriceMultipliers price_base_multipliers
Price base multipliers as set by the grf.
CargoPayment()
Constructor for pool saveload.
Vehicle * Next() const
Get the next vehicle of this vehicle.
Year _cur_year
Current year, starting at 0.
@ CCA_DELETE
Delete a company.
@ EXPENSES_OTHER
Other expenses.
@ OUFB_TRANSFER
Transfer all cargo onto the platform.
CargoArray & consist_capleft
Capacities left in the consist.
Town * town
The town this station is associated with.
static const int LOAN_INTERVAL
The "steps" in loan size, in British Pounds!
byte interest_rate
Interest.
Year inaugurated_year
Year of starting the company.
@ OLFB_FULL_LOAD
Full load all cargoes of the consist.
TownEffect town_effect
The effect that delivering this cargo type has on towns. Also affects destination of subsidies.
void ClearCargoDeliveryMonitoring(CompanyID company)
Clear all delivery cargo monitors.
uint32 industry_daily_change_counter
Bits 31-16 are number of industry to be performed, 15-0 are fractional collected daily.
uint16 load_unload_ticks
Ticks to wait before starting next cycle.
Price
Enumeration of all base prices for use with Prices.
bool _network_server
network-server is active
uint32 max_loan
the maximum initial loan
@ WC_INDUSTRY_VIEW
Industry view; Window numbers:
CommandCost CmdSellShareInCompany(DoCommandFlag flags, CompanyID target_company)
Sell shares in an opposing company.
uint32 water
Count of company owned track bits for canals.
Tindex index
Index of this pool item.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
static void LoadUnloadVehicle(Vehicle *front)
Loads/unload the vehicle if possible.
Class for storing amounts of cargo.
byte was_cargo_delivered
flag that indicate this has been the closest industry chosen for cargo delivery by a station....
static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, TileIndex source_tile, byte days_in_transit, Company *company, SourceType src_type, SourceID src)
Delivers goods to industries/towns and calculates the payment.
@ WC_PERFORMANCE_HISTORY
Performance history graph; Window numbers:
uint ReservedCount() const
Returns sum of reserved cargo.
static void HandleStationRefit(Vehicle *v, CargoArray &consist_capleft, Station *st, StationIDStack next_station, CargoID new_cid)
Refit a vehicle in a station.
@ SAT_CARGO_TAKEN
Trigger station when cargo is completely taken.
uint16 produced_cargo_waiting[INDUSTRY_NUM_OUTPUTS]
amount of cargo produced per cargo
DifficultySettings difficulty
settings related to the difficulty
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.
@ AAT_STATION_CARGO_TAKEN
Triggered when a cargo type is completely removed from the station (for all tiles at the same time).
void ResetPriceBaseMultipliers()
Reset changes to the price base multipliers.
uint32 station
Count of company owned station tiles.
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1=NR_NONE, uint32 ref1=UINT32_MAX, NewsReferenceType reftype2=NR_NONE, uint32 ref2=UINT32_MAX, const NewsAllocatedData *data=nullptr)
Add a new newsitem to be shown.
OrderUnloadFlags GetUnloadType() const
How must the consist be unloaded?
bool include(std::vector< T > &vec, const T &item)
Helper function to append an item to a vector if it is not already contained Consider using std::set,...
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
void CompaniesMonthlyLoop()
Monthly update of the economic data (of the companies as well as economic fluctuations).
VehicleDefaultSettings vehicle
default settings for vehicles
void SetLocalCompany(CompanyID new_company)
Sets the local company and updates the settings that are set on a per-company basis to reflect the co...
byte vehicle_costs
amount of money spent on vehicle running cost
Representation of a waypoint.
@ VF_LOADING_FINISHED
Vehicle has finished loading.
static const uint TILE_SIZE
Tile size in world coordinates.
CommandCost CmdBuyShareInCompany(DoCommandFlag flags, CompanyID target_company)
Acquire shares in an opposing company.
byte DaysInTransit() const
Gets the number of days this cargo has been in transit.
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
void UpdateFillingPercent(TextEffectID te_id, uint8 percent, StringID string)
Update vehicle loading indicators.
Money max_loan
NOSAVE: Maximum possible loan.
static IterateWrapper Iterate(size_t from=0)
Returns an iterable ensemble of all valid CargoSpec.
static Station * Get(size_t index)
Gets station with given index.
uint8 feeder_payment_share
percentage of leg payment to virtually pay in feeder systems
Station * st
Station to reserve cargo from.
ClientSettings _settings_client
The current settings for this game.
static bool HasSignals(TileIndex t)
Checks if a rail tile has signals.
Specification of a cargo type.
static const int MIN_PRICE_MODIFIER
Maximum NewGRF price modifiers.
static const Year ORIGINAL_BASE_YEAR
The minimum starting year/base year of the original TTD.
@ CBM_IND_PRODUCTION_256_TICKS
call production callback every 256 ticks
void CloseCompanyWindows(CompanyID company)
Close all windows of a company.
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
bool IsRearDualheaded() const
Tell if we are dealing with the rear end of a multiheaded engine.
StationIDStack & next_station
Next hops to reserve cargo for.
@ WC_COMPANY
Company view; Window numbers:
@ WC_STATION_VIEW
Station view; Window numbers:
static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint num_pieces, IndustryID source, CompanyID company)
Transfer goods from station to industry.
@ VEH_ROAD
Road vehicle type.
@ CC_PASSENGERS
Passengers.
uint16 cur_speed
current speed
byte GetCount() const
Get the amount of cargos that have an amount.
Defines the internal data of a functional industry.
@ CRR_BANKRUPT
The company went belly-up.
uint16 servint_ships
service interval for ships
Owner owner
Which company owns the vehicle?
uint Reserve(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next)
Reserves cargo for loading onto the vehicle.
byte block_preview
Number of quarters that the company is not allowed to get new exclusive engine previews (see Companie...
Owner
Enum for all companies/owners.
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 void CompanyCheckBankrupt(Company *c)
Check for bankruptcy of a company.
Owner owner
The owner of this station.
@ WC_COMPANY_LEAGUE
Company league window; Window numbers:
void UpdateCompanyHQ(TileIndex tile, uint score)
Update the CompanyHQ to the state associated with the given score.
void TriggerIndustry(Industry *ind, IndustryTileTrigger trigger)
Trigger a random trigger for all industry tiles.
static bool IsLocalCompany()
Is the current company the local company?
byte initial_interest
amount of interest (to pay over the loan)
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
byte status
Status of this cargo, see GoodsEntryStatus.
DoCommandFlag
List of flags for a command.
Money current_loan
Amount of money borrowed from the bank.
@ VSE_LOAD_UNLOAD
Whenever cargo payment is made for a vehicle.
static Track RemoveFirstTrack(TrackBits *tracks)
Removes first Track from TrackBits and returns it.
CargoID ct
The currently handled cargo type.
Statistics about the economy.
uint TotalCount() const
Returns total count of cargo at the station, including cargo which is already reserved for loading.
bool Succeeded() const
Did this command succeed?
bool MayCompanyTakeOver(CompanyID cbig, CompanyID csmall)
May company cbig buy company csmall?
uint32 GetRoadTotal() const
Get total sum of all owned road bits.
static uint CountBits(T value)
Counts the number of set bits in a variable.
FinalizeRefitAction(CargoArray &consist_capleft, Station *st, StationIDStack &next_station, bool do_reserve)
Create a finalizing action.
static Pool::IterateWrapper< Station > Iterate(size_t from=0)
Returns an iterable ensemble of all valid stations of type T.
@ RATING_INITIAL
initial rating
@ WC_DELIVERED_CARGO
Delivered cargo graph; Window numbers:
@ IAT_INDUSTRY_RECEIVED_CARGO
Trigger when cargo is received .
int score
How much score it will give.
@ VF_STOP_LOADING
Don't load anymore during the next load cycle.
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner)
Change the owner of a tile.
const GRFFile * GetGRF() const
Retrieve the NewGRF the engine is tied to.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
static constexpr size_t MAX_SIZE
Make template parameter accessible from outside.
Refit preparation action.
OrderSettings order
settings related to orders
bool operator()(Vehicle *v)
Reserve cargo from the station and update the remaining consist capacities with the vehicle's remaini...
uint32 industry_daily_increment
The value which will increment industry_daily_change_counter. Computed value. NOSAVE.
uint DistanceManhattan(TileIndex t0, TileIndex t1)
Gets the Manhattan distance between the two given tiles.
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent, StringID string)
Display vehicle loading indicators.
void InitializeEconomy()
Resets economy to initial values.
int16 fluct
Economy fluctuation status.
byte infl_amount_pr
inflation rate for payment rates
uint32 GetTramTotal() const
Get total sum of all owned tram bits.
uint16 cached_total_length
Length of the whole vehicle (valid only for the first engine).
@ OLF_FULL_LOAD_ANY
Full load a single cargo of the consist.
@ CBM_VEHICLE_LOAD_AMOUNT
Load amount.
Struct about subsidies, offered and awarded.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
static uint MapSize()
Get the size of the map.
CargoID GetRefitCargo() const
Get the cargo to to refit to.
byte subsidy_multiplier
payment multiplier for subsidized deliveries
bool operator()(const Vehicle *v)
Checks if the vehicle has stored cargo.
RailType
Enumeration for all possible railtypes.
uint8 CalcPercentVehicleFilled(const Vehicle *front, StringID *colour)
Calculates how full a vehicle is.
@ INDUSTRY_TRIGGER_RECEIVED_CARGO
Cargo has been delivered.
Common return value for all commands.
int32 performance_history
Company score (scale 0-1000)
Iterable ensemble of each set bit in a value.
Date _date
Current date in days (day counter)
uint16 SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
UnitID NextID()
Returns next free UnitID.
byte num_valid_stat_ent
Number of valid statistical entries in old_economy.
PrepareRefitAction(CargoArray &consist_capleft, CargoTypes &refit_mask)
Create a refit preparation action.
CargoPaymentPool _cargo_payment_pool("CargoPayment")
The actual pool to store cargo payments in.
@ GES_EVER_ACCEPTED
Set when a vehicle ever delivered cargo to the station for final delivery.
static void CompaniesPayInterest()
Let all companies pay the monthly interest on their loan.
void SetPriceBaseMultiplier(Price price, int factor)
Change a price base by the given factor.
Owner exclusive_supplier
Which company has exclusive rights to deliver cargo (INVALID_OWNER = anyone)
@ SCORE_END
How many scores are there..
IndustryType type
type of industry.
@ VF_CARGO_UNLOADING
Vehicle is unloading cargo.
bool HasRating() const
Does this cargo have a rating at this station?
TileIndex tile
Current tile index.
bool IsValid() const
Tests for validity of this cargospec.
bool HasCargoFor(StationIDStack next) const
Check for cargo headed for a specific station.
void MarkTilesDirty(bool cargo_change) const
Marks the tiles of the station as dirty.
EngineID engine_type
The type of engine used for this vehicle.
uint8 loading_indicators
show loading indicators
bool operator()(const Vehicle *v)
Prepares for refitting of a vehicle, subtracting its free capacity from consist_capleft and adding th...
byte months_of_bankruptcy
Number of months that the company is unable to pay its debts.
@ VS_CRASHED
Vehicle is crashed.
byte last_speed
Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
@ GES_ACCEPTED_BIGTICK
Set when cargo was delivered for final delivery during the current STATION_ACCEPTANCE_TICKS interval.
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
StationID last_station_visited
The last station we stopped at.
@ INVALID_OWNER
An invalid owner.
Money money
Money owned by the company.
Helper class to perform the cargo payment.
static void ReserveConsist(Station *st, Vehicle *u, CargoArray *consist_capleft, StationIDStack *next_station)
Reserves cargo if the full load order and improved_load is set or if the current order allows autoref...
VehicleCargoList cargo
The cargo this vehicle is carrying.
void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
Change the ownership of all the items of a company.
uint16 incoming_cargo_waiting[INDUSTRY_NUM_INPUTS]
incoming cargo waiting to be processed
virtual ExpensesType GetExpenseType(bool income) const
Sets the expense type associated to this vehicle type.
Order current_order
The current order (+ status, like: loading)
@ WC_REPLACE_VEHICLE
Replace vehicle window; Window numbers:
uint16 input_cargo_multiplier[INDUSTRY_NUM_INPUTS][INDUSTRY_NUM_OUTPUTS]
Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes)
@ ST_INDUSTRY
Source/destination is an industry.
void PayFinalDelivery(const CargoPacket *cp, uint count)
Handle payment for final delivery of the given cargo packet.
Struct about stories, current and completed.
SourceID SourceSubsidyID() const
Gets the ID of the cargo's source.
Generates sequence of free UnitID numbers.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
CompanySettings settings
settings specific for each company
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
static void NewEvent(class ScriptEvent *event)
Queue a new event for a Game Script.
void NetworkClientsToSpectators(CompanyID cid)
Move the clients of a company to the spectators.
EconomySettings economy
settings to change the economy
@ VS_STOPPED
Vehicle is stopped by the player.
@ MAX_COMPANIES
Maximum number of companies.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
const Engine * GetEngine() const
Retrieves the engine of the vehicle.
static void BroadcastNewEvent(ScriptEvent *event, CompanyID skip_company=MAX_COMPANIES)
Broadcast a new event to all active AIs.
static void RemoveAllEngineReplacementForCompany(Company *c)
Remove all engine replacement settings for the given company.
Action to check if a vehicle has no stored cargo.
static void UpdateAutoreplace(CompanyID company)
Update autoreplace_defined and autoreplace_finished of all statistics of a company.
'Train' is either a loco or a wagon.
static Money RoadMaintenanceCost(RoadType roadtype, uint32 num, uint32 total_num)
Calculates the maintenance cost of a number of road bits.
Money GetCost() const
The costs as made up to this moment.
@ WC_SHIPS_LIST
Ships list; Window numbers:
SourceType SourceSubsidyType() const
Gets the type of the cargo's source.
Money profit_this_year
Profit this year << 8, low 8 bits are fract.
int UpdateCompanyRatingAndValue(Company *c, bool update)
if update is set to true, the economy is updated with this score (also the house is updated,...
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
TileIndex location_of_HQ
Northern tile of HQ; INVALID_TILE when there is none.
@ MTA_TRANSFER
Transfer the cargo to the station.
uint16 callback_mask
Bitmask of vehicle callbacks that have to be called.
bool _networking
are we in networking mode?
static uint GetLoadAmount(Vehicle *v)
Gets the amount of cargo the given vehicle can load in the current tick.
@ SAT_TRAIN_LOADS
Trigger platform when train loads/unloads.
Money AirportMaintenanceCost(Owner owner)
Calculates the maintenance cost of all airports of a company.
@ PCAT_CONSTRUCTION
Price is affected by "construction cost" difficulty setting.
static Money RailMaintenanceCost(RailType railtype, uint32 num, uint32 total_num)
Calculates the maintenance cost of a number of track bits.
static const uint MAX_HISTORY_QUARTERS
The maximum number of quarters kept as performance's history.
uint32 road[ROADTYPE_END]
Count of company owned track bits for each road type.
uint32 signal
Count of company owned signals.
@ WC_TRAINS_LIST
Trains list; Window numbers:
uint AvailableCount() const
Returns sum of cargo still available for loading at the sation.
static Money StationMaintenanceCost(uint32 num)
Calculates the maintenance cost of a number of station tiles.
CommandCost CmdBuyCompany(DoCommandFlag flags, CompanyID target_company)
Buy up another company.
CargoTypes always_accepted
Bitmask of always accepted cargo types (by houses, HQs, industry tiles when industry doesn't accept c...
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
@ WC_INCOME_GRAPH
Income graph; Window numbers:
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
Display animated income or costs on the map.
uint16 vehicle_flags
Used for gradual loading and other miscellaneous things (.
Money CalculateCompanyValue(const Company *c, bool including_loan)
Calculate the value of the company.
Defines the data structure for constructing industry.
Money start_price
Default value at game start, before adding multipliers.
@ DC_BANKRUPT
company bankrupts, skip money check, skip vehicle on tile check in some cases
byte misc_flags
Miscellaneous flags.
@ NF_NORMAL
Normal news item. (Newspaper with text only)
@ SCORE_MAX
The max score that can be in the performance history.
CompanyMask bankrupt_asked
which companies were asked about buying it?
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
static bool MayLoadUnderExclusiveRights(const Station *st, const Vehicle *v)
Test whether a vehicle can load cargo at a station even if exclusive transport rights are present.
CargoArray delivered_cargo
The amount of delivered cargo.
@ WC_PAYMENT_RATES
Payment rates graph; Window numbers:
void StartupIndustryDailyChanges(bool init_counter)
Initialize the variables that will maintain the daily industry change system.
bool IndustryTemporarilyRefusesCargo(Industry *ind, CargoID cargo_type)
Check whether an industry temporarily refuses to accept a certain cargo.
static WindowClass GetWindowClassForVehicleType(VehicleType vt)
Get WindowClass for vehicle list of given vehicle type.
bool economy
how volatile is the economy
bool infrastructure_maintenance
enable monthly maintenance fee for owner infrastructure
@ WC_COMPANY_VALUE
Company value graph; Window numbers:
static bool EconomyIsInRecession()
Is the economy in recession?
@ SRT_CARGO_TAKEN
Trigger station when cargo is completely taken.
Action for returning reserved cargo.
@ GES_CURRENT_MONTH
Set when cargo was delivered for final delivery this month.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
Money expenses
The amount of expenses.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
IndustryList industries_near
Cached list of industries near the station that can accept cargo,.
VehicleCache vcache
Cache of often used vehicle values.
Stores station stats for a single cargo.
void LoadUnloadStation(Station *st)
Load/unload the vehicles in this station according to the order they entered.
CompanyID _current_company
Company currently doing an action.
static const Year ORIGINAL_MAX_YEAR
The maximum year of the original TTD.
Tstorage new_act
Actually transported this month.
@ PROP_VEHICLE_LOAD_AMOUNT
Loading speed.
std::array< Owner, MAX_COMPANY_SHARE_OWNERS > share_owners
Owners of the shares of the company. INVALID_OWNER if nobody has bought them yet.
SourceType
Types of cargo source and destination.
void ShowFeederIncomeAnimation(int x, int y, int z, Money transfer, Money income)
Display animated feeder income.
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Base class for all pools.
Vehicle * First() const
Get the first vehicle of this vehicle chain.
int32 lateness_counter
How many ticks late (or early if negative) this vehicle is.
uint16 cargo_cap
total capacity
CompanyEconomyEntry cur_economy
Economic data of the company of this quarter.
ReturnCargoAction(Station *st, StationID next_one)
Construct a cargo return action.
byte last_age
Age in years (up to 255) of the last vehicle that tried to load this cargo.
@ WC_PERFORMANCE_DETAIL
Performance detail window; Window numbers:
uint16 servint_trains
service interval for trains
void RebuildSubsidisedSourceAndDestinationCache()
Perform a full rebuild of the subsidies cache.
static const uint64 MAX_INFLATION
Maximum inflation (including fractional part) without causing overflows in int64 price computations.
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
void Restore()
Restore the variable.
static Aircraft * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, SourceType src_type, SourceID src, const Station *st, IndustryID dest)
Cargo was delivered to its final destination, update the pickup and delivery maps.
@ SND_14_CASHTILL
18 == 0x12 Income from cargo delivery
Vehicle * GetFirstEnginePart()
Get the first part of an articulated engine.
@ COMPANY_SPECTATOR
The client is spectating.
@ RAILTYPE_END
Used for iterations.
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
uint8 min_years_for_shares
minimum age of a company for it to trade shares
@ EF_NO_DEFAULT_CARGO_MULTIPLIER
Use the new capacity algorithm. The default cargotype of the vehicle does not affect capacity multipl...
@ OUFB_NO_UNLOAD
Totally no unloading will be done.
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...
static Money CanalMaintenanceCost(uint32 num)
Calculates the maintenance cost of a number of canal tiles.
bool IsNormalAircraft() const
Check if the aircraft type is a normal flying device; eg not a rotor or a shadow.
CargoPayment * cargo_payment
The cargo payment we're currently in.
static bool CleaningPool()
Returns current state of pool cleaning - yes or no.
Money PayTransfer(const CargoPacket *cp, uint count)
Handle payment for transfer of the given cargo packet.
uint32 current_order_time
How many ticks have passed since this order started.
@ OWNER_NONE
The tile has no ownership.
@ MTA_LOAD
Load the cargo from the station.
uint32 rail[RAILTYPE_END]
Count of company owned track bits for each rail type.
@ NT_ECONOMY
Economic changes (recession, industry up/dowm)
Date last_cargo_accepted_at[INDUSTRY_NUM_INPUTS]
Last day each cargo type was accepted by this industry.
@ CT_AUTO_REFIT
Automatically choose cargo type when doing auto refitting.
uint RemainingCount() const
Returns the sum of cargo to be kept in the vehicle at the current station.
@ MP_STATION
A tile of a station.
@ PCAT_RUNNING
Price is affected by "vehicle running cost" difficulty setting.
@ WC_COMPANY_INFRASTRUCTURE
Company infrastructure overview; Window numbers:
@ GES_ACCEPTANCE
Set when the station accepts the cargo currently for final deliveries.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
uint16 servint_aircraft
service interval for aircraft
byte time_since_pickup
Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.
bool HasArticulatedPart() const
Check if an engine has an articulated part.
Year build_year
Year the vehicle has been built.
byte infl_amount
inflation amount
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
void ClearCargoPickupMonitoring(CompanyID company)
Clear all pick-up cargo monitors.
int needed
How much you need to get the perfect score.
#define MAX_UVALUE(type)
The largest value that can be entered in a variable.
static SmallIndustryList _cargo_delivery_destinations
The industries we've currently brought cargo to.
RoadType
The different roadtypes we support.
void RecomputePrices()
Computes all prices, payments and maximum loan.
TileIndex xy
Base tile of the station.
void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner)
Add track to signal update buffer.
@ EXPENSES_PROPERTY
Property costs.
uint16 cached_max_speed
Maximum speed of the consist (minimum of the max speed of all vehicles in the consist).
uint16 callback_mask
Bitmask of industry callbacks that have to be called.
static bool IsLevelCrossingTile(TileIndex t)
Return whether a tile is a level crossing tile.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
static void UpdateLoadUnloadTicks(Vehicle *front, const Station *st, int ticks)
Update the vehicle's load_unload_ticks, the time it will wait until it tries to load or unload again.
bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event, bool force)
Checks whether a NewGRF wants to play a different vehicle sound effect.
void UpdateLevelCrossing(TileIndex tile, bool sound=true, bool force_bar=false)
Update a level crossing to barred or open (crossing may include multiple adjacent tiles).
uint16 multiplier
Capacity multiplier for vehicles. (8 fractional bits)
void TriggerStationRandomisation(Station *st, TileIndex trigger_tile, StationRandomTrigger trigger, CargoID cargo_type)
Trigger station randomisation.
ScoreID
Score categories in the detailed performance rating.
bool operator()(Vehicle *v)
Return all reserved cargo from a vehicle.
Money income
The amount of income.
static void TriggerIndustryProduction(Industry *i)
Inform the industry about just delivered cargo DeliverGoodsToIndustry() silently incremented incoming...
TrackBits
Bitfield corresponding to Track.
void ChangeWindowOwner(Owner old_owner, Owner new_owner)
Change the owner of all the windows one company can take over from another company in the case of a c...
bool servint_ispercent
service intervals are in percents
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
static void CompaniesGenStatistics()
Update the finances of all companies.
Money route_profit
The amount of money to add/remove from the bank account.
#define lengthof(x)
Return the length of an fixed size array.
static void Run(Vehicle *v, bool allow_merge=true, bool is_full_loading=false)
Refresh all links the given vehicle will visit.
Container for cargo from the same location and time.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
@ MTA_KEEP
Keep the cargo in the vehicle.
byte CargoID
Cargo slots to indicate a cargo type within a game.
StationID next_hop
Next hop the cargo should be assigned to.
uint16 servint_roadveh
service interval for road vehicles
@ INVALID_COMPANY
An invalid company.
@ MTA_DELIVER
Deliver the cargo to some town or industry.
CargoID cargo_type
type of cargo this vehicle is carrying
@ CBID_VEHICLE_LOAD_AMOUNT
Determine the amount of cargo to load per unit of time when using gradual loading.
static uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
bool inflation
disable inflation
void SetCargo(CargoID ct)
Sets the currently handled cargo type.
void ErrorUnknownCallbackResult(uint32 grfid, uint16 cbid, uint16 cb_res)
Record that a NewGRF returned an unknown/invalid callback result.
const IndustrySpec * GetIndustrySpec(IndustryType thistype)
Accessor for array _industry_specs.
@ VEH_TRAIN
Train vehicle type.
CargoID accepts_cargo[INDUSTRY_NUM_INPUTS]
16 input cargo slots
VehicleType type
Type of vehicle.
void SubtractMoneyFromCompany(const CommandCost &cost)
Subtract money from the _current_company, if the company is valid.
static void Stop(CompanyID company)
Stop a company to be controlled by an AI.
@ DC_QUERY_COST
query cost only, don't build.
@ CBID_CARGO_PROFIT_CALC
Called to calculate the income of delivered cargo.
bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type, SourceID src, const Station *st)
Tests whether given delivery is subsidised and possibly awards the subsidy to delivering company.
Track
These are used to specify a single track.
Money FeederShare() const
Gets the amount of money already paid to earlier vehicles in the feeder chain.
@ WC_OPERATING_PROFIT
Operating profit graph; Window numbers:
static bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
Station * st
Station to give the returned cargo to.
uint Return(uint max_move, StationCargoList *dest, StationID next_station)
Returns reserved cargo to the station and removes it from the cache.
@ VEH_SHIP
Ship vehicle type.
Month _cur_month
Current month (0..11)
CompanyID exclusivity
which company has exclusivity
static int32 BigMulS(const int32 a, const int32 b, const uint8 shift)
Multiply two integer values and shift the results to right.
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)
@ WC_AIRCRAFT_LIST
Aircraft list; Window numbers:
CompanyEconomyEntry old_economy[MAX_HISTORY_QUARTERS]
Economic data of the company of the last MAX_HISTORY_QUARTERS quarters.
bool AddInflation(bool check_year)
Add monthly inflation.
int16 bankrupt_timeout
If bigger than 0, amount of time to wait for an answer on an offer to buy this company.
uint8 exclusive_counter
months till the exclusivity expires
@ WC_STATION_LIST
Station list; Window numbers:
@ ROADTYPE_BEGIN
Used for iterations.
TextEffectID fill_percent_te_id
a text-effect id to a loading indicator object
void IndustryProductionCallback(Industry *ind, int reason)
Get the industry production callback and apply it to the industry.
@ GES_RATING
This indicates whether a cargo has a rating at the station.
static uint MapLogY()
Logarithm of the map size along the y side.
bool do_reserve
If the vehicle should reserve.
@ EXPENSES_LOAN_INTEREST
Interest payments over the loan.
uint32 GetRailTotal() const
Get total sum of all owned track bits.
CargoArray & consist_capleft
Capacities left in the consist.
void SetDParamStr(uint n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
bool gradual_loading
load vehicles gradually
virtual void MarkDirty()
Marks the vehicles to be redrawn and updates cached variables.
uint Load(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next)
Loads cargo onto a vehicle.
Dynamic data of a loaded NewGRF.
GUISettings gui
settings related to the GUI
Money Prices[PR_END]
Prices of everything.
Data structure for storing how the score is computed for a single score id.
@ SRT_TRAIN_LOADS
Trigger platform when train loads/unloads.
bool IsMultiheaded() const
Check if the vehicle is a multiheaded engine.
@ OLFB_NO_LOAD
Do not load anything.
TransportedCargoStat< uint16 > received[NUM_TE]
Cargo statistics about received cargotypes.
const ScoreInfo _score_info[]
Score info, values used for computing the detailed performance rating.
TileIndex SourceStationXY() const
Gets the coordinates of the cargo's source station.
OrderLoadFlags GetLoadType() const
How must the consist be loaded?
StationIDStack GetNextStoppingStation() const
Get the next station the vehicle will stop at.
byte construction_cost
how expensive is building
@ RAILTYPE_BEGIN
Used for iterations.