OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
52 #include "table/strings.h"
73 static inline int32
BigMulS(const int32 a, const int32 b, const uint8 shift)
75 return (int32)((int64)a * (int64)b >> shift);
78 typedef std::vector<Industry *> SmallIndustryList;
99 Money _additional_cash_required;
100 static PriceMultipliers _price_base_multiplier;
118 if (st->owner == owner) num +=
CountBits((
byte)st->facilities);
121 Money value = num * _price[PR_STATION_VALUE] * 25;
124 if (v->owner != owner)
continue;
130 value += v->value * 3 >> 1;
138 return std::max<Money>(value, 1);
154 memset(_score_part[owner], 0,
sizeof(_score_part[owner]));
158 Money min_profit = 0;
159 bool min_profit_first =
true;
163 if (v->owner != owner)
continue;
165 if (v->profit_last_year > 0) num++;
168 if (min_profit_first || min_profit > v->profit_last_year) {
169 min_profit = v->profit_last_year;
170 min_profit_first =
false;
178 _score_part[owner][SCORE_VEHICLES] = num;
180 if (min_profit > 0) {
181 _score_part[owner][SCORE_MIN_PROFIT] = min_profit;
190 if (st->owner == owner && (st->time_since_load <= 20 || st->time_since_unload <= 20)) num +=
CountBits((
byte)st->facilities);
192 _score_part[owner][SCORE_STATIONS] = num;
206 }
while (++cee, --numec);
208 if (min_income > 0) {
209 _score_part[owner][SCORE_MIN_INCOME] = min_income;
212 _score_part[owner][SCORE_MAX_INCOME] = max_income;
224 }
while (++cee, --numec);
226 _score_part[owner][SCORE_DELIVERED] = total_delivered;
238 _score_part[owner][SCORE_MONEY] = c->
money;
296 if (c->index != old_owner) {
305 assert(old_owner != new_owner);
312 for (i = 0; i < 4; i++) {
313 if (c->share_owners[i] == old_owner) {
326 for (i = 0; i < 4; i++) {
329 if (c->bankrupt_value == 0 && c->
share_owners[i] == new_owner) {
352 if (s->awarded == old_owner) {
356 s->awarded = new_owner;
366 if (
HasBit(t->have_ratings, old_owner)) {
367 if (
HasBit(t->have_ratings, new_owner)) {
369 t->ratings[new_owner] = std::max(t->ratings[new_owner], t->ratings[old_owner]);
371 SetBit(t->have_ratings, new_owner);
372 t->ratings[new_owner] = t->ratings[old_owner];
379 ClrBit(t->have_ratings, old_owner);
382 if (t->exclusive_counter > 0 && t->exclusivity == old_owner) {
384 t->exclusivity = new_owner;
386 t->exclusive_counter = 0;
396 if (v->Previous() ==
nullptr)
delete v;
410 RemoveAllGroupsForCompany(old_owner);
413 if (g->owner == old_owner) g->owner = new_owner;
444 if (!v->ServiceIntervalIsCustom()) {
454 v->owner = new_owner;
457 v->colourmap = PAL_NONE;
458 v->InvalidateNewGRFCache();
460 if (v->IsEngineCountable()) {
463 if (v->IsPrimaryVehicle()) {
465 v->unitnumber = unitidgen[v->type].
NextID();
469 if (v->cargo_payment !=
nullptr) v->cargo_payment->owner =
nullptr;
512 if (st->owner == old_owner) {
521 if (wp->owner == old_owner) {
532 if (g->company == old_owner)
delete g;
539 if (sp->company == old_owner)
delete sp;
584 SetDParam(0, STR_NEWS_COMPANY_IN_TROUBLE_TITLE);
585 SetDParam(1, STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION);
587 AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
598 c->bankrupt_value = val;
603 assert(c->bankrupt_value > 0);
655 cur_company.
Change(st->owner);
662 cur_company.
Change(c->index);
665 uint32 rail_total = c->infrastructure.GetRailTotal();
670 uint32 road_total = c->infrastructure.GetRoadTotal();
671 uint32 tram_total = c->infrastructure.GetTramTotal();
673 if (c->infrastructure.road[rt] != 0) cost.
AddCost(
RoadMaintenanceCost(rt, c->infrastructure.road[rt], RoadTypeIsRoad(rt) ? road_total : tram_total));
690 c->old_economy[0] = c->cur_economy;
696 if (c->block_preview != 0) c->block_preview--;
729 if (check_year && (_cur_year < ORIGINAL_BASE_YEAR || _cur_year >=
ORIGINAL_MAX_YEAR))
return true;
756 for (
Price i = PR_BEGIN; i < PR_END; i++) {
761 switch (_price_base_specs[i].category) {
773 case 0: price *= 6;
break;
774 case 1: price *= 8;
break;
775 case 2: price *= 9;
break;
776 default: NOT_REACHED();
783 int shift = _price_base_multiplier[i] - 16 - 3;
796 price =
Clamp(_price_base_specs[i].start_price, -1, 1);
806 cs->current_payment = (cs->initial_payment * (int64)_economy.
inflation_payment) >> 16;
821 cur_company.
Change(c->index);
848 static void HandleEconomyFluctuations()
855 _economy.
fluct = -12;
861 if (_economy.
fluct == 0) {
862 _economy.
fluct = -(int)
GB(Random(), 0, 2);
864 }
else if (_economy.
fluct == -12) {
865 _economy.
fluct =
GB(Random(), 0, 8) + 312;
876 memset(_price_base_multiplier, 0,
sizeof(_price_base_multiplier));
888 assert(price < PR_END);
913 void StartupEconomy()
918 _economy.
fluct =
GB(Random(), 0, 8) + 168;
923 for (
int i = 0; i < months; i++) {
955 if (index >= PR_END)
return 0;
957 Money cost = _price[index] * cost_factor;
969 Money GetTransportedGoodsIncome(uint num_pieces, uint dist,
byte transit_days,
CargoID cargo_type)
979 uint32 var18 = std::min(dist, 0xFFFFu) | (std::min(num_pieces, 0xFFu) << 16) | (transit_days << 24);
982 int result =
GB(callback, 0, 14);
985 if (
HasBit(callback, 14)) result -= 0x4000;
990 return result * num_pieces * cs->current_payment / 8192;
994 static const int MIN_TIME_FACTOR = 31;
995 static const int MAX_TIME_FACTOR = 255;
997 const int days1 = cs->transit_days[0];
998 const int days2 = cs->transit_days[1];
999 const int days_over_days1 = std::max( transit_days - days1, 0);
1000 const int days_over_days2 = std::max(days_over_days1 - days2, 0);
1012 const int time_factor = std::max(MAX_TIME_FACTOR - days_over_days1 - days_over_days2, MIN_TIME_FACTOR);
1014 return BigMulS(dist * time_factor * num_pieces, cs->current_payment, 21);
1042 if (num_pieces == 0)
break;
1044 if (ind->
index == source)
continue;
1064 num_pieces -= amount;
1089 assert(num_pieces > 0);
1100 if (accepted_total > 0) {
1114 Money profit = GetTransportedGoodsIncome(accepted_total,
DistanceManhattan(source_tile, st->
xy), days_in_transit, cargo_type);
1122 case 0: profit += profit >> 1;
break;
1123 case 1: profit *= 2;
break;
1124 case 2: profit *= 3;
break;
1125 default: profit *= 4;
break;
1153 if (cargo_waiting == 0)
continue;
1173 current_station(front->last_station_visited)
1177 CargoPayment::~CargoPayment()
1196 this->front->z_pos, this->visual_transfer, -this->visual_profit);
1199 this->front->z_pos, -this->visual_profit);
1202 cur_company.Restore();
1212 if (this->
owner ==
nullptr) {
1253 curr_station->loading_vehicles.push_back(front_v);
1271 for (
Vehicle *v = front_v; v !=
nullptr; v = v->
Next()) {
1273 if (v->cargo_cap > 0 && v->cargo.TotalCount() > 0) {
1294 uint load_amount = e->info.load_amount;
1298 if (air_mail) load_amount =
CeilDiv(load_amount, 4);
1302 if (e->
GetGRF() !=
nullptr && e->
GetGRF()->grf_version >= 8) {
1310 if (e->
GetGRF()->grf_version < 8) cb_load_amount =
GB(cb_load_amount, 0, 8);
1311 if (cb_load_amount >= 0x100) {
1313 }
else if (cb_load_amount != 0) {
1314 load_amount = cb_load_amount;
1323 return std::max(1u, load_amount);
1335 template<
class Taction>
1338 for (
Vehicle *w = v; w !=
nullptr;
1340 if (!action(w))
return false;
1343 if (train->
IsMultiheaded() && !action(train->other_multiheaded_part))
return false;
1391 this->refit_mask |= EngInfo(v->
engine_type)->refit_mask;
1451 if (this->do_reserve) {
1475 CargoTypes refit_mask = v->
GetEngine()->info.refit_mask;
1481 if (is_auto_refit) {
1496 (consist_capleft[cid] == consist_capleft[new_cid] &&
1505 if (new_cid < NUM_CARGO && new_cid != v_start->cargo_type) {
1538 st(st), next_station(next_station) {}
1544 &v->
cargo, st->
xy, *next_station);
1566 for (
Vehicle *v = u; v !=
nullptr; v = v->
Next()) {
1567 assert(v->cargo_cap >= v->cargo.RemainingCount());
1572 if (!v->IsArticulatedPart() &&
1578 if (consist_capleft ==
nullptr || v->cargo_cap == 0)
continue;
1579 (*consist_capleft)[v->cargo_type] += v->cargo_cap - v->cargo.RemainingCount();
1597 ticks += (overhang * ticks) / 8;
1636 int new_load_unload_ticks = 0;
1637 bool dirty_vehicle =
false;
1638 bool dirty_station =
false;
1640 bool completely_emptied =
true;
1641 bool anything_unloaded =
false;
1642 bool anything_loaded =
false;
1643 CargoTypes full_load_amount = 0;
1644 CargoTypes cargo_not_full = 0;
1645 CargoTypes cargo_full = 0;
1646 CargoTypes reservation_left = 0;
1652 uint artic_part = 0;
1653 for (
Vehicle *v = front; v !=
nullptr; v = v->
Next()) {
1655 if (v->cargo_cap == 0)
continue;
1661 uint cargo_count = v->
cargo.UnloadCount();
1663 bool remaining =
false;
1665 assert(payment !=
nullptr);
1676 if (v->cargo_cap < new_remaining) {
1678 v->cargo.Return(new_remaining - v->cargo_cap, &ge->
cargo, INVALID_STATION);
1689 anything_unloaded =
true;
1695 dirty_station =
true;
1705 amount_unloaded = v->cargo.Unload(amount_unloaded, &ge->
cargo, payment);
1706 remaining = v->cargo.UnloadCount() > 0;
1707 if (amount_unloaded > 0) {
1708 dirty_vehicle =
true;
1709 anything_unloaded =
true;
1710 new_load_unload_ticks += amount_unloaded;
1713 st->time_since_unload = 0;
1717 completely_emptied =
false;
1732 ge = &st->
goods[v->cargo_type];
1736 v->refit_cap = v->cargo_cap;
1740 switch (front->
type) {
1754 default: NOT_REACHED();
1761 assert(v->cargo_cap >= v->cargo.StoredCount());
1763 uint cap_left = v->cargo_cap - v->cargo.StoredCount();
1772 if (v->cargo.StoredCount() == 0) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO);
1775 uint loaded = ge->
cargo.
Load(cap_left, &v->cargo, st->
xy, next_station);
1779 SetBit(reservation_left, v->cargo_type);
1783 if (loaded == cap_left) {
1784 SetBit(full_load_amount, v->cargo_type);
1786 ClrBit(full_load_amount, v->cargo_type);
1797 completely_emptied =
false;
1798 anything_loaded =
true;
1800 st->time_since_load = 0;
1801 st->last_vehicle_type = v->type;
1809 new_load_unload_ticks += loaded;
1811 dirty_vehicle = dirty_station =
true;
1816 if (v->cargo.StoredCount() >= v->cargo_cap) {
1817 SetBit(cargo_full, v->cargo_type);
1819 SetBit(cargo_not_full, v->cargo_type);
1823 if (anything_loaded || anything_unloaded) {
1831 completely_emptied &= anything_unloaded;
1833 if (!anything_unloaded)
delete payment;
1836 if (anything_loaded || anything_unloaded) {
1840 const uint gradual_loading_wait_time[] = { 40, 20, 10, 20 };
1842 new_load_unload_ticks = gradual_loading_wait_time[front->
type];
1854 bool finished_loading =
true;
1860 (cargo_not_full != 0 && (cargo_full & ~cargo_not_full) == 0)) {
1861 finished_loading =
false;
1863 }
else if (cargo_not_full != 0) {
1864 finished_loading =
false;
1885 StringID percent_up_down = STR_NULL;
1894 if (completely_emptied) {
1897 dirty_vehicle =
true;
1898 TriggerVehicle(front, VEHICLE_TRIGGER_EMPTY);
1901 if (dirty_vehicle) {
1906 if (dirty_station) {
1921 if (st->loading_vehicles.empty())
return;
1923 Vehicle *last_loading =
nullptr;
1924 std::list<Vehicle *>::iterator iter;
1927 for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
1943 if (last_loading ==
nullptr)
return;
1945 for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
1948 if (v == last_loading)
break;
1969 HandleEconomyFluctuations();
1972 static void DoAcquireCompany(
Company *c)
1978 SetDParam(0, STR_NEWS_COMPANY_MERGER_TITLE);
1979 SetDParam(1, c->bankrupt_value == 0 ? STR_NEWS_MERGER_TAKEOVER_TITLE : STR_NEWS_COMPANY_MERGER_DESCRIPTION);
1983 AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
1989 if (c->bankrupt_value == 0) {
2008 extern int GetAmountOwnedBy(
const Company *c,
Owner owner);
2036 if (!c->
is_ai)
return cost;
2051 c->bankrupt_value = 0;
2052 DoAcquireCompany(c);
2088 cost = -(cost - (cost >> 7));
2134 DoAcquireCompany(c);
@ VEH_AIRCRAFT
Aircraft vehicle type.
static uint MapLogX()
Logarithm of the map size along the X side.
CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Sell shares in an opposing company.
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 PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event)
Checks whether a NewGRF wants to play a different vehicle sound effect.
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.
uint32 TileIndex
The index/ID of a Tile.
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.
@ OUFB_UNLOAD
Force unloading all cargo onto the platform, possibly not getting paid.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
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.
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.
@ 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.
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:
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.
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.
@ ROADTYPE_END
Used for iterations.
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.
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.
union Vehicle::@49 orders
The orders currently assigned to the vehicle.
@ 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.
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.
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?
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 .
CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Acquire shares in an opposing company.
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
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.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
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)
byte callback_mask
Bitmask of vehicle callbacks that have to be called.
@ 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.
@ CMD_CHANGE_SERVICE_INT
change the server interval of a vehicle
@ 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.
@ CMD_SELL_SHARE_IN_COMPANY
sell a share from a company
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.
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.
void UpdateLevelCrossing(TileIndex tile, bool sound=true)
Sets correct crossing state.
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.
@ 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.
Owner share_owners[4]
Owners of the 4 shares of the company. INVALID_OWNER if nobody has bought them yet.
@ ROADTYPE_BEGIN
Used for iterations.
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.
RoadType
The different roadtypes we support.
Defines the data structure for constructing industry.
@ EXPENSES_LOAN_INT
Interest payments over the loan.
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.
uint _returned_refit_capacity
Stores the capacity after a refit operation.
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.
OrderList * list
Pointer to the order list for this vehicle.
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.
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.
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.
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.
@ CMD_COMPANY_CTRL
used in multiplayer to create a new companies etc.
#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.
CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Buy up another company.
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.
@ NT_ECONOMY
Economic changes (recession, industry up/dowm)
@ 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.
@ CCA_DELETE
Delete a company.
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.
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.
Company * owner
The owner of the vehicle.
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:
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.
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.
@ CRR_BANKRUPT
The company went belly-up.
@ 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.