|
OpenTTD Source
14.0-beta1
|
Go to the documentation of this file.
59 #include "table/strings.h"
80 static inline int32_t
BigMulS(const int32_t a, const int32_t b, const uint8_t shift)
82 return (int32_t)((int64_t)a * (int64_t)b >> shift);
85 typedef std::vector<Industry *> SmallIndustryList;
106 static PriceMultipliers _price_base_multiplier;
121 if (st->owner == owner) num +=
CountBits((
byte)st->facilities);
124 Money value = num * _price[PR_STATION_VALUE] * 25;
127 if (v->owner != owner)
continue;
133 value += v->value * 3 >> 1;
157 return std::max<Money>(value, 1);
186 for (
int quarter = 0; quarter < 4; quarter++) {
190 return std::max<Money>(value, 1);
206 memset(_score_part[owner], 0,
sizeof(_score_part[owner]));
210 Money min_profit = 0;
211 bool min_profit_first =
true;
215 if (v->owner != owner)
continue;
217 if (v->profit_last_year > 0) num++;
220 if (min_profit_first || min_profit > v->profit_last_year) {
221 min_profit = v->profit_last_year;
222 min_profit_first =
false;
230 _score_part[owner][SCORE_VEHICLES] = num;
232 if (min_profit > 0) {
233 _score_part[owner][SCORE_MIN_PROFIT] = min_profit;
242 if (st->owner == owner && (st->time_since_load <= 20 || st->time_since_unload <= 20)) num +=
CountBits((
byte)st->facilities);
244 _score_part[owner][SCORE_STATIONS] = num;
258 }
while (++cee, --numec);
260 if (min_income > 0) {
261 _score_part[owner][SCORE_MIN_INCOME] = min_income;
264 _score_part[owner][SCORE_MAX_INCOME] = max_income;
276 }
while (++cee, --numec);
278 _score_part[owner][SCORE_DELIVERED] = total_delivered;
290 _score_part[owner][SCORE_MONEY] = c->
money;
348 if (c->index != old_owner) {
357 assert(old_owner != new_owner);
367 if (s->awarded == old_owner) {
371 s->awarded = new_owner;
381 if (
HasBit(t->have_ratings, old_owner)) {
382 if (
HasBit(t->have_ratings, new_owner)) {
384 t->ratings[new_owner] = std::max(t->ratings[new_owner], t->ratings[old_owner]);
386 SetBit(t->have_ratings, new_owner);
387 t->ratings[new_owner] = t->ratings[old_owner];
394 ClrBit(t->have_ratings, old_owner);
397 if (t->exclusive_counter > 0 && t->exclusivity == old_owner) {
399 t->exclusivity = new_owner;
401 t->exclusive_counter = 0;
411 if (v->Previous() ==
nullptr)
delete v;
425 RemoveAllGroupsForCompany(old_owner);
428 if (g->owner == old_owner) g->owner = new_owner;
459 if (!v->ServiceIntervalIsCustom()) {
469 v->owner = new_owner;
472 v->colourmap = PAL_NONE;
473 v->InvalidateNewGRFCache();
475 if (v->IsEngineCountable()) {
478 if (v->IsPrimaryVehicle()) {
480 v->unitnumber = unitidgen[v->type].
NextID();
484 if (v->cargo_payment !=
nullptr) v->cargo_payment->owner =
nullptr;
527 if (st->owner == old_owner) {
536 if (wp->owner == old_owner) {
547 if (g->company == old_owner)
delete g;
554 if (sp->company == old_owner)
delete sp;
602 SetDParam(0, STR_NEWS_COMPANY_IN_TROUBLE_TITLE);
603 SetDParam(1, STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION);
605 AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
616 c->bankrupt_value = val;
621 assert(c->bankrupt_value > 0);
675 cur_company.
Change(c->index);
678 uint32_t rail_total = c->infrastructure.GetRailTotal();
683 uint32_t road_total = c->infrastructure.GetRoadTotal();
684 uint32_t tram_total = c->infrastructure.GetTramTotal();
686 if (c->infrastructure.road[rt] != 0) cost.
AddCost(
RoadMaintenanceCost(rt, c->infrastructure.road[rt], RoadTypeIsRoad(rt) ? road_total : tram_total));
703 c->old_economy[0] = c->cur_economy;
709 if (c->block_preview != 0) c->block_preview--;
742 if (check_year && (TimerGameCalendar::year < CalendarTime::ORIGINAL_BASE_YEAR || TimerGameCalendar::year >=
CalendarTime::ORIGINAL_MAX_YEAR))
return true;
769 for (
Price i = PR_BEGIN; i < PR_END; i++) {
774 switch (_price_base_specs[i].category) {
786 case 0: price *= 6;
break;
787 case 1: price *= 8;
break;
788 case 2: price *= 9;
break;
789 default: NOT_REACHED();
796 int shift = _price_base_multiplier[i] - 16 - 3;
809 price =
Clamp(_price_base_specs[i].start_price, -1, 1);
819 cs->current_payment = (cs->initial_payment * (int64_t)_economy.
inflation_payment) >> 16;
834 cur_company.
Change(c->index);
852 if (available_money < 0) {
853 yearly_fee += -available_money * _economy.
interest_rate / 100;
865 static void HandleEconomyFluctuations()
872 _economy.
fluct = -12;
878 if (_economy.
fluct == 0) {
879 _economy.
fluct = -(int)
GB(Random(), 0, 2);
881 }
else if (_economy.
fluct == -12) {
882 _economy.
fluct =
GB(Random(), 0, 8) + 312;
893 memset(_price_base_multiplier, 0,
sizeof(_price_base_multiplier));
905 assert(price < PR_END);
930 void StartupEconomy()
935 _economy.
fluct =
GB(Random(), 0, 8) + 168;
940 for (
int i = 0; i < months; i++) {
972 if (index >= PR_END)
return 0;
974 Money cost = _price[index] * cost_factor;
986 Money GetTransportedGoodsIncome(uint num_pieces, uint dist, uint16_t transit_periods,
CargoID cargo_type)
996 uint32_t var18 = ClampTo<uint16_t>(dist) | (ClampTo<uint8_t>(num_pieces) << 16) | (ClampTo<uint8_t>(transit_periods) << 24);
999 int result =
GB(callback, 0, 14);
1002 if (
HasBit(callback, 14)) result -= 0x4000;
1007 return result * num_pieces * cs->current_payment / 8192;
1011 static const int MIN_TIME_FACTOR = 31;
1012 static const int MAX_TIME_FACTOR = 255;
1013 static const int TIME_FACTOR_FRAC_BITS = 4;
1014 static const int TIME_FACTOR_FRAC = 1 << TIME_FACTOR_FRAC_BITS;
1016 const int periods1 = cs->transit_periods[0];
1017 const int periods2 = cs->transit_periods[1];
1018 const int periods_over_periods1 = std::max(transit_periods - periods1, 0);
1019 const int periods_over_periods2 = std::max(periods_over_periods1 - periods2, 0);
1020 int periods_over_max = MIN_TIME_FACTOR - MAX_TIME_FACTOR;
1021 if (periods2 > -periods_over_max) {
1022 periods_over_max += transit_periods - periods1;
1024 periods_over_max += 2 * (transit_periods - periods1) - periods2;
1038 if (periods_over_max > 0) {
1039 const int time_factor = std::max(2 * MIN_TIME_FACTOR * TIME_FACTOR_FRAC * TIME_FACTOR_FRAC / (periods_over_max + 2 * TIME_FACTOR_FRAC), 1);
1040 return BigMulS(dist * time_factor * num_pieces, cs->current_payment, 21 + TIME_FACTOR_FRAC_BITS);
1042 const int time_factor = std::max(MAX_TIME_FACTOR - periods_over_periods1 - periods_over_periods2, MIN_TIME_FACTOR);
1043 return BigMulS(dist * time_factor * num_pieces, cs->current_payment, 21);
1072 if (num_pieces == 0)
break;
1075 if (ind->
index == source)
continue;
1079 if (it == std::end(ind->
accepted))
continue;
1089 uint amount = std::min(num_pieces, 0xFFFFu - it->waiting);
1090 it->waiting += amount;
1092 num_pieces -= amount;
1117 assert(num_pieces > 0);
1128 if (accepted_total > 0) {
1142 Money profit = GetTransportedGoodsIncome(accepted_total, distance, periods_in_transit, cargo_type);
1150 case 0: profit += profit >> 1;
break;
1151 case 1: profit *= 2;
break;
1152 case 2: profit *= 3;
break;
1153 default: profit *= 4;
break;
1179 for (
auto ita = std::begin(i->
accepted); ita != std::end(i->
accepted); ++ita) {
1182 for (
auto itp = std::begin(i->
produced); itp != std::end(i->
produced); ++itp) {
1200 current_station(front->last_station_visited),
1205 CargoPayment::~CargoPayment()
1224 this->front->z_pos, this->visual_transfer, -this->visual_profit);
1227 this->front->z_pos, -this->visual_profit);
1230 cur_company.Restore();
1241 if (this->
owner ==
nullptr) {
1283 curr_station->loading_vehicles.push_back(front_v);
1301 for (
Vehicle *v = front_v; v !=
nullptr; v = v->
Next()) {
1303 if (v->cargo_cap > 0 && v->cargo.TotalCount() > 0) {
1325 uint load_amount = e->info.load_amount;
1329 if (air_mail) load_amount =
CeilDiv(load_amount, 4);
1333 if (e->
GetGRF() !=
nullptr && e->
GetGRF()->grf_version >= 8) {
1341 if (e->
GetGRF()->grf_version < 8) cb_load_amount =
GB(cb_load_amount, 0, 8);
1342 if (cb_load_amount >= 0x100) {
1344 }
else if (cb_load_amount != 0) {
1345 load_amount = cb_load_amount;
1354 return std::max(1u, load_amount);
1366 template<
class Taction>
1369 for (
Vehicle *w = v; w !=
nullptr;
1371 if (!action(w))
return false;
1374 if (train->
IsMultiheaded() && !action(train->other_multiheaded_part))
return false;
1422 this->refit_mask |= EngInfo(v->
engine_type)->refit_mask;
1482 if (this->do_reserve) {
1484 &v->
cargo, this->next_station, v->
tile);
1506 CargoTypes refit_mask = v->
GetEngine()->info.refit_mask;
1512 if (is_auto_refit) {
1526 if (refit_capacity > 0 && (consist_capleft[cid] < consist_capleft[new_cid] ||
1527 (consist_capleft[cid] == consist_capleft[new_cid] &&
1536 if (new_cid < NUM_CARGO && new_cid != v_start->cargo_type) {
1569 st(st), next_station(next_station) {}
1597 for (
Vehicle *v = u; v !=
nullptr; v = v->
Next()) {
1598 assert(v->cargo_cap >= v->cargo.RemainingCount());
1603 if (!v->IsArticulatedPart() &&
1609 if (consist_capleft ==
nullptr || v->cargo_cap == 0)
continue;
1610 (*consist_capleft)[v->cargo_type] += v->cargo_cap - v->cargo.RemainingCount();
1628 ticks += (overhang * ticks) / 8;
1667 int new_load_unload_ticks = 0;
1668 bool dirty_vehicle =
false;
1669 bool dirty_station =
false;
1671 bool completely_emptied =
true;
1672 bool anything_unloaded =
false;
1673 bool anything_loaded =
false;
1674 CargoTypes full_load_amount = 0;
1675 CargoTypes cargo_not_full = 0;
1676 CargoTypes cargo_full = 0;
1677 CargoTypes reservation_left = 0;
1683 uint artic_part = 0;
1684 for (
Vehicle *v = front; v !=
nullptr; v = v->
Next()) {
1686 if (v->cargo_cap == 0)
continue;
1692 uint cargo_count = v->
cargo.UnloadCount();
1694 bool remaining =
false;
1696 assert(payment !=
nullptr);
1707 if (v->cargo_cap < new_remaining) {
1709 v->cargo.Return(new_remaining - v->cargo_cap, &ge->
cargo, INVALID_STATION, v->tile);
1720 anything_unloaded =
true;
1726 dirty_station =
true;
1736 amount_unloaded = v->cargo.Unload(amount_unloaded, &ge->
cargo, payment, v->tile);
1737 remaining = v->cargo.UnloadCount() > 0;
1738 if (amount_unloaded > 0) {
1739 dirty_vehicle =
true;
1740 anything_unloaded =
true;
1741 new_load_unload_ticks += amount_unloaded;
1744 st->time_since_unload = 0;
1748 completely_emptied =
false;
1763 ge = &st->
goods[v->cargo_type];
1767 v->refit_cap = v->cargo_cap;
1771 switch (front->
type) {
1785 default: NOT_REACHED();
1792 assert(v->cargo_cap >= v->cargo.StoredCount());
1794 uint cap_left = v->cargo_cap - v->cargo.StoredCount();
1803 if (v->cargo.StoredCount() == 0) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO);
1806 uint loaded = ge->
cargo.
Load(cap_left, &v->cargo, next_station, v->tile);
1810 SetBit(reservation_left, v->cargo_type);
1814 if (loaded == cap_left) {
1815 SetBit(full_load_amount, v->cargo_type);
1817 ClrBit(full_load_amount, v->cargo_type);
1828 completely_emptied =
false;
1829 anything_loaded =
true;
1831 st->time_since_load = 0;
1832 st->last_vehicle_type = v->type;
1842 new_load_unload_ticks += loaded;
1844 dirty_vehicle = dirty_station =
true;
1849 if (v->cargo.StoredCount() >= v->cargo_cap) {
1850 SetBit(cargo_full, v->cargo_type);
1852 SetBit(cargo_not_full, v->cargo_type);
1856 if (anything_loaded || anything_unloaded) {
1867 completely_emptied &= anything_unloaded;
1869 if (!anything_unloaded)
delete payment;
1872 if (anything_loaded || anything_unloaded) {
1876 const uint gradual_loading_wait_time[] = { 40, 20, 10, 20 };
1878 new_load_unload_ticks = gradual_loading_wait_time[front->
type];
1890 bool finished_loading =
true;
1896 (cargo_not_full != 0 && (cargo_full & ~cargo_not_full) == 0)) {
1897 finished_loading =
false;
1899 }
else if (cargo_not_full != 0) {
1900 finished_loading =
false;
1921 StringID percent_up_down = STR_NULL;
1930 if (completely_emptied) {
1933 dirty_vehicle =
true;
1934 TriggerVehicle(front, VEHICLE_TRIGGER_EMPTY);
1937 if (dirty_vehicle) {
1942 if (dirty_station) {
1957 if (st->loading_vehicles.empty())
return;
1959 Vehicle *last_loading =
nullptr;
1962 for (
Vehicle *v : st->loading_vehicles) {
1976 if (last_loading ==
nullptr)
return;
1978 for (
Vehicle *v : st->loading_vehicles) {
1980 if (v == last_loading)
break;
2008 HandleEconomyFluctuations();
2011 static void DoAcquireCompany(
Company *c,
bool hostile_takeover)
2017 SetDParam(0, STR_NEWS_COMPANY_MERGER_TITLE);
2018 SetDParam(1, hostile_takeover ? STR_NEWS_MERGER_TAKEOVER_TITLE : STR_NEWS_COMPANY_MERGER_DESCRIPTION);
2022 AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
2079 DoAcquireCompany(c, hostile_takeover);
@ VEH_AIRCRAFT
Aircraft vehicle type.
GroundVehicleCache * GetGroundVehicleCache()
Access the ground vehicle cache of the vehicle.
void Change(const U &new_value)
Change the value of the variable.
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:
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.
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.
@ 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.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
bool IsType(OrderType type) const
Check whether this order is of the given type.
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
Money visual_profit
The visual profit to show.
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.
Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift)
Determine a certain price.
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 Titem * GetIfValid(size_t index)
Returns Titem with given index.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
bool station_length_loading_penalty
make trains longer than the station load more slowly
Vehicle * front
The front vehicle to do the payment of.
uint16_t cargo_cap
total capacity
StationID current_station
NOSAVE: The current station.
uint Load(uint max_move, VehicleCargoList *dest, StationIDStack next, TileIndex current_tile)
Loads cargo onto a vehicle.
void UpdateFillingPercent(TextEffectID te_id, uint8_t percent, StringID string)
Update vehicle loading indicators.
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.
static debug_inline uint LogX()
Logarithm of the map size along the X side.
Money CanalMaintenanceCost(uint32_t num)
Calculates the maintenance cost of a number of canal tiles.
CargoPayment()
Constructor for pool saveload.
Vehicle * Next() const
Get the next vehicle of this vehicle.
@ EXPENSES_OTHER
Other expenses.
uint8_t loading_indicators
show loading indicators
@ 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!
uint GetCount() const
Get the amount of cargos that have an amount.
byte interest_rate
Interest.
@ OLFB_FULL_LOAD
Full load all cargoes of the consist.
void ClearCargoDeliveryMonitoring(CompanyID company)
Clear all delivery cargo monitors.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Price
Enumeration of all base prices for use with Prices.
uint64_t inflation_payment
Cumulated inflation of cargo payment since game start; 16 bit fractional part.
bool _network_server
network-server is active
@ RSRT_CARGO_TAKEN
Trigger roadstop when cargo is completely taken.
@ WC_INDUSTRY_VIEW
Industry view; Window numbers:
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
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.
static Month month
Current month (0..11).
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 IntervalTimer< TimerGameEconomy > _economy_companies_monthly({ TimerGameEconomy::MONTH, TimerGameEconomy::Priority::COMPANY }, [](auto) { CompaniesGenStatistics();CompaniesPayInterest();HandleEconomyFluctuations();})
Every economy month update of company economic data, plus economy fluctuations.
@ 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.
DifficultySettings difficulty
settings related to the difficulty
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.
uint16_t vehicle_flags
Used for gradual loading and other miscellaneous things (.
OrderUnloadFlags GetUnloadType() const
How must the consist be unloaded?
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.
TimerGameTick::Ticks lateness_counter
How many ticks late (or early if negative) this vehicle is.
int16_t bankrupt_timeout
If bigger than 0, amount of time to wait for an answer on an offer to buy this company.
@ VF_LOADING_FINISHED
Vehicle has finished loading.
Money RoadMaintenanceCost(RoadType roadtype, uint32_t num, uint32_t total_num)
Calculates the maintenance cost of a number of road bits.
static const uint TILE_SIZE
Tile size in world coordinates.
bool IsLevelCrossingTile(Tile t)
Return whether a tile is a level crossing tile.
constexpr uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
Money max_loan
NOSAVE: Maximum possible loan.
ProducedCargoArray produced
INDUSTRY_NUM_OUTPUTS production cargo slots.
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.
Station * st
Station to reserve cargo from.
ClientSettings _settings_client
The current settings for this game.
Specification of a cargo type.
static const int MIN_PRICE_MODIFIER
Maximum NewGRF price modifiers.
TimerGameTick::Ticks current_order_time
How many ticks have passed since this order started.
@ 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_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.
uint Return(uint max_move, StationCargoList *dest, StationID next_station, TileIndex current_tile)
Returns reserved cargo to the station and removes it from the cache.
@ VEH_ROAD
Road vehicle type.
@ CC_PASSENGERS
Passengers.
Defines the internal data of a functional industry.
Owner owner
Which company owns the vehicle?
Owner
Enum for all companies/owners.
@ DC_EXEC
execute the given command
uint32_t GetGRFID() const
Retrieve the GRF ID of the NewGRF the engine is tied to.
static void CompanyCheckBankrupt(Company *c)
Check for bankruptcy of a company.
void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTrigger trigger, CargoID cargo_type=INVALID_CARGO)
Trigger road stop randomisation.
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.
int16_t fluct
Economy fluctuation status.
byte initial_interest
amount of interest (to pay over the loan)
byte status
Status of this cargo, see GoodsEntryStatus.
DoCommandFlag
List of flags for a command.
@ RSRT_VEH_LOADS
Trigger roadstop when road vehicle loads.
Money current_loan
Amount of money borrowed from the bank.
@ VSE_LOAD_UNLOAD
Whenever cargo payment is made for a vehicle.
uint8_t time_since_pickup
Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.
CargoID ct
NOSAVE: 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?
int32_t x_pos
x coordinate.
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.
bool include(Container &container, typename Container::const_reference &item)
Helper function to append an item to a container if it is not already contained.
void PayFinalDelivery(const CargoPacket *cp, uint count, TileIndex current_tile)
Handle payment for final delivery of the given cargo packet.
uint16_t cached_max_speed
Maximum speed of the consist (minimum of the max speed of all vehicles in the consist).
Money StationMaintenanceCost(uint32_t num)
Calculates the maintenance cost of a number of station tiles.
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...
void InitializeEconomy()
Resets economy to initial values.
byte infl_amount_pr
inflation rate for payment rates
@ OLF_FULL_LOAD_ANY
Full load a single cargo of the consist.
@ CBM_VEHICLE_LOAD_AMOUNT
Load amount.
Struct about subsidies, offered and awarded.
uint16_t callback_mask
Bitmask of vehicle callbacks that have to be called.
CargoID GetRefitCargo() const
Get the cargo to to refit to.
byte subsidy_multiplier
payment multiplier for subsidized deliveries
TextEffectID ShowFillingPercent(int x, int y, int z, uint8_t percent, StringID string)
Display vehicle loading indicators.
bool operator()(const Vehicle *v)
Checks if the vehicle has stored cargo.
RailType
Enumeration for all possible railtypes.
@ INDUSTRY_TRIGGER_RECEIVED_CARGO
Cargo has been delivered.
Common return value for all commands.
Iterable ensemble of each set bit in a value.
Track RemoveFirstTrack(TrackBits *tracks)
Removes first Track from TrackBits and returns it.
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.
Money SignalMaintenanceCost(uint32_t num)
Calculates the maintenance cost of a number of signals.
@ 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.
Money GetFeederShare() const
Gets the amount of money already paid to earlier vehicles in the feeder chain.
SourceType GetSourceType() const
Gets the type of the cargo's source.
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.
Money PayTransfer(const CargoPacket *cp, uint count, TileIndex current_tile)
Handle payment for transfer of the given cargo packet.
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.
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.
@ GES_ACCEPTED_BIGTICK
Set when cargo was delivered for final delivery during the current STATION_ACCEPTANCE_TICKS interval.
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...
bool HasSignalOnTrack(Tile tile, Track track)
Checks for the presence of signals (either way) on the given track on the given rail tile.
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.
Order current_order
The current order (+ status, like: loading)
@ WC_REPLACE_VEHICLE
Replace vehicle window; Window numbers:
virtual ExpensesType GetExpenseType([[maybe_unused]] bool income) const
Sets the expense type associated to this vehicle type.
uint16_t SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
Struct about stories, current and completed.
uint16_t cur_speed
current speed
Generates sequence of free UnitID numbers.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
bool IsCompanyBuildableVehicleType(VehicleType type)
Is the given vehicle type buildable by a company?
TimerGameCalendar::Year build_year
Year the vehicle has been built.
CompanySettings settings
settings specific for each company
AcceptedCargoArray accepted
INDUSTRY_NUM_INPUTS input cargo slots.
static IntervalTimer< TimerGameCalendar > _calendar_inflation_monthly({TimerGameCalendar::MONTH, TimerGameCalendar::Priority::COMPANY}, [](auto) { if(_settings_game.economy.inflation) { AddInflation();RecomputePrices();} })
Every calendar month update of inflation.
static constexpr TimerGame< struct Calendar >::Year ORIGINAL_MAX_YEAR
The maximum year of the original TTD.
uint GetDistance(TileIndex current_tile) const
Get the current distance the cargo has traveled.
@ 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.
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.
Money GetCost() const
The costs as made up to this moment.
@ WC_SHIPS_LIST
Ships list; Window numbers:
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,...
TileIndex location_of_HQ
Northern tile of HQ; INVALID_TILE when there is none.
@ MTA_TRANSFER
Transfer the cargo to the station.
uint16_t servint_aircraft
service interval for aircraft
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.
uint8_t callback_mask
Bitmask of cargo callbacks that have to be called.
@ CRR_BANKRUPT
The company went belly-up.
@ 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 const uint MAX_HISTORY_QUARTERS
The maximum number of quarters kept as performance's history.
Money GetMaxLoan() const
Calculate the max allowed loan for this company.
@ Industry
Source/destination is an industry.
@ WC_TRAINS_LIST
Trains list; Window numbers:
uint AvailableCount() const
Returns sum of cargo still available for loading at the sation.
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.
Money CalculateCompanyValue(const Company *c, bool including_loan)
Calculate the value of the company.
SourceID GetSourceID() const
Gets the ID of the cargo's source.
Defines the data structure for constructing industry.
constexpr uint CountBits(T value)
Counts the number of set bits in a variable.
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 MayLoadUnderExclusiveRights(const Station *st, const Vehicle *v)
Test whether a vehicle can load cargo at a station even if exclusive transport rights are present.
int32_t z_pos
z coordinate.
CargoArray delivered_cargo
The amount of delivered cargo.
TrackBits GetTrackBits(Tile tile)
Gets the track bits of the given tile.
uint16_t callback_mask
Bitmask of industry callbacks that have to be called.
@ WC_PAYMENT_RATES
Payment rates graph; Window numbers:
uint16_t GetPeriodsInTransit() const
Gets the number of cargo aging periods this cargo has been in transit.
void StartupIndustryDailyChanges(bool init_counter)
Initialize the variables that will maintain the daily industry change system.
Money RailMaintenanceCost(RailType railtype, uint32_t num, uint32_t total_num)
Calculates the maintenance cost of a number of track bits.
bool IndustryTemporarilyRefusesCargo(Industry *ind, CargoID cargo_type)
Check whether an industry temporarily refuses to accept a certain cargo.
static const CargoID CARGO_AUTO_REFIT
Automatically choose cargo type when doing auto refitting.
Money CalculateHostileTakeoverValue(const Company *c)
Calculate what you have to pay to take over a company.
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:
uint16_t load_unload_ticks
Ticks to wait before starting next cycle.
@ SRT_CARGO_TAKEN
Trigger station when cargo is completely taken.
uint32_t industry_daily_increment
The value which will increment industry_daily_change_counter. Computed value. NOSAVE.
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.
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.
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 Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
int32_t performance_history
Company score (scale 0-1000)
Base class for all pools.
Vehicle * First() const
Get the first vehicle of this vehicle chain.
CompanyEconomyEntry cur_economy
Economic data of the company of this quarter.
ReturnCargoAction(Station *st, StationID next_one)
Construct a cargo return action.
@ WC_PERFORMANCE_DETAIL
Performance detail window; Window numbers:
CommandCost CmdBuyCompany(DoCommandFlag flags, CompanyID target_company, bool hostile_takeover)
Buy up another company.
void RebuildSubsidisedSourceAndDestinationCache()
Perform a full rebuild of the subsidies cache.
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
uint64_t inflation_prices
Cumulated inflation of prices since game start; 16 bit fractional part.
bool infinite_money
whether spending money despite negative balance is allowed
void Restore()
Restore the variable.
static Aircraft * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
static debug_inline uint Size()
Get the size of the map.
@ SND_14_CASHTILL
18 == 0x12 Income from cargo delivery
Vehicle * GetFirstEnginePart()
Get the first part of an articulated engine.
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
@ COMPANY_SPECTATOR
The client is spectating.
@ RAILTYPE_END
Used for iterations.
StationID GetStationIndex(Tile t)
Get StationID from a tile.
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
@ 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.
AcceptedCargoArray::iterator GetCargoAccepted(CargoID cargo)
Get accepted cargo slot for a specific cargo type.
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
uint16_t GetTimetabledWait() const
Get the time in ticks a vehicle should wait at the destination or 0 if it's not timetabled.
bool IsNormalAircraft() const
Check if the aircraft type is a normal flying device; eg not a rotor or a shadow.
uint8_t last_age
Age in years (up to 255) of the last vehicle that tried to load this cargo.
CargoPayment * cargo_payment
The cargo payment we're currently in.
static bool CleaningPool()
Returns current state of pool cleaning - yes or no.
bool HasSignals(Tile t)
Checks if a rail tile has signals.
@ OWNER_NONE
The tile has no ownership.
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1=NR_NONE, uint32_t ref1=UINT32_MAX, NewsReferenceType reftype2=NR_NONE, uint32_t ref2=UINT32_MAX, const NewsAllocatedData *data=nullptr)
Add a new newsitem to be shown.
@ MTA_LOAD
Load the cargo from the station.
@ NT_ECONOMY
Economic changes (recession, industry up/dowm)
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:
uint32_t max_loan
the maximum initial loan
@ GES_ACCEPTANCE
Set when the station accepts the cargo currently for final deliveries.
bool HasArticulatedPart() const
Check if an engine has an articulated part.
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.
static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, uint distance, uint16_t periods_in_transit, Company *company, SourceType src_type, SourceID src)
Delivers goods to industries/towns and calculates the payment.
void SetDParamStr(size_t n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
void RecomputePrices()
Computes all prices, payments and maximum loan.
@ INVALID_CLIENT_ID
Client is not part of anything.
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_t servint_trains
service interval for trains
static Money CalculateCompanyAssetValue(const Company *c)
Calculate the value of the assets of a company.
void RemoveAllEngineReplacementForCompany(Company *c)
Remove all engine replacement settings for the given company.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
int32_t y_pos
y coordinate.
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).
void ErrorUnknownCallbackResult(uint32_t grfid, uint16_t cbid, uint16_t cb_res)
Record that a NewGRF returned an unknown/invalid callback result.
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
Allow incrementing of Track variables.
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...
uint16_t servint_ships
service interval for ships
bool servint_ispercent
service intervals are in percents
static void CompaniesGenStatistics()
Update the finances of all companies.
Money route_profit
The amount of money to add/remove from the bank account.
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.
static uint LogY()
Logarithm of the map size along the y side.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
static int32_t BigMulS(const int32_t a, const int32_t b, const uint8_t shift)
Multiply two integer values and shift the results to right.
@ MTA_KEEP
Keep the cargo in the vehicle.
static constexpr TimerGame< struct Calendar >::Year ORIGINAL_BASE_YEAR
The minimum starting year/base year of the original TTD.
byte CargoID
Cargo slots to indicate a cargo type within a game.
uint32_t industry_daily_change_counter
Bits 31-16 are number of industry to be performed, 15-0 are fractional collected daily.
StationID next_hop
Next hop the cargo should be assigned to.
TransportedCargoStat< uint16_t > received[NUM_TAE]
Cargo statistics about received cargotypes.
@ 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.
bool IsValidCargoID(CargoID t)
Test whether cargo type is not INVALID_CARGO.
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
bool inflation
disable inflation
void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32_t amount, SourceType src_type, SourceID src, const Station *st, IndustryID dest)
Cargo was delivered to its final destination, update the pickup and delivery maps.
void SetCargo(CargoID ct)
Sets the currently handled cargo type.
uint8_t CalcPercentVehicleFilled(const Vehicle *front, StringID *colour)
Calculates how full a vehicle is.
const IndustrySpec * GetIndustrySpec(IndustryType thistype)
Accessor for array _industry_specs.
uint Reserve(uint max_move, VehicleCargoList *dest, StationIDStack next, TileIndex current_tile)
Reserves cargo for loading onto the vehicle.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
@ VEH_TRAIN
Train vehicle type.
bool EconomyIsInRecession()
Is the economy in recession?
Money GetAvailableMoney(CompanyID company)
Get the amount of money that a company has available, or INT64_MAX if there is no such valid company.
VehicleType type
Type of vehicle.
void SubtractMoneyFromCompany(const CommandCost &cost)
Subtract money from the _current_company, if the company is valid.
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
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.
@ WC_OPERATING_PROFIT
Operating profit graph; Window numbers:
uint16_t GetVehicleCallback(CallbackID callback, uint32_t param1, uint32_t param2, EngineID engine, const Vehicle *v)
Evaluate a newgrf callback for vehicles.
@ CCA_DELETE
Delete a company.
Station * st
Station to give the returned cargo to.
@ VEH_SHIP
Ship vehicle type.
bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
bool IsLocalCompany()
Is the current company the local company?
CompanyID exclusivity
which company has exclusivity
constexpr T ClrBit(T &x, const uint8_t y)
Clears a bit in a variable.
bool IsTileOwner(Tile tile, Owner owner)
Checks if a tile belongs to the given owner.
OrderList * orders
Pointer to the order list for this vehicle.
static const uint64_t MAX_INFLATION
Maximum inflation (including fractional part) without causing overflows in int64_t price computations...
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
NOSAVE: The owner of the vehicle.
bool AddInflation(bool check_year)
Add monthly inflation.
uint16_t cached_total_length
Length of the whole vehicle (valid only for the first engine).
@ 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
uint16_t input_cargo_multiplier[INDUSTRY_NUM_INPUTS][INDUSTRY_NUM_OUTPUTS]
Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes)
void IndustryProductionCallback(Industry *ind, int reason)
Get the industry production callback and apply it to the industry.
uint16_t servint_roadveh
service interval for road vehicles
@ GES_RATING
This indicates whether a cargo has a rating at the station.
uint8_t exclusive_counter
months till the exclusivity expires
bool do_reserve
If the vehicle should reserve.
uint16_t multiplier
Capacity multiplier for vehicles. (8 fractional bits)
@ EXPENSES_LOAN_INTEREST
Interest payments over the loan.
CargoArray & consist_capleft
Capacities left in the consist.
bool gradual_loading
load vehicles gradually
uint8_t last_speed
Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
virtual void MarkDirty()
Marks the vehicles to be redrawn and updates cached variables.
Dynamic data of a loaded NewGRF.
GUISettings gui
settings related to the GUI
Money Prices[PR_END]
Prices of everything.
WindowClass GetWindowClassForVehicleType(VehicleType vt)
Get WindowClass for vehicle list of given vehicle type.
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.
const ScoreInfo _score_info[]
Score info, values used for computing the detailed performance rating.
OrderLoadFlags GetLoadType() const
How must the consist be loaded?
StationIDStack GetNextStoppingStation() const
Get the next station the vehicle will stop at.
uint8_t feeder_payment_share
percentage of leg payment to virtually pay in feeder systems
static Year year
Current year, starting at 0.
byte construction_cost
how expensive is building
static Date date
Current date in days (day counter).
@ RAILTYPE_BEGIN
Used for iterations.
TownAcceptanceEffect town_acceptance_effect
The effect that delivering this cargo type has on towns. Also affects destination of subsidies.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.