Handling of the economy. More...
#include "stdafx.h"
#include "company_func.h"
#include "command_func.h"
#include "industry.h"
#include "town.h"
#include "news_func.h"
#include "network/network.h"
#include "network/network_func.h"
#include "vehicle_gui.h"
#include "ai/ai.hpp"
#include "aircraft.h"
#include "newgrf_engine.h"
#include "engine_base.h"
#include "ground_vehicle.hpp"
#include "newgrf_cargo.h"
#include "newgrf_sound.h"
#include "newgrf_industrytiles.h"
#include "newgrf_station.h"
#include "newgrf_airporttiles.h"
#include "object.h"
#include "group.h"
#include "strings_func.h"
#include "window_func.h"
#include "date_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
#include "autoreplace_func.h"
#include "company_gui.h"
#include "signs_base.h"
#include "subsidy_base.h"
#include "subsidy_func.h"
#include "station_base.h"
#include "waypoint_base.h"
#include "economy_base.h"
#include "core/pool_func.hpp"
#include "newgrf.h"
#include "core/backup_type.hpp"
#include "cargo_type.h"
#include "water.h"
#include "table/strings.h"
#include "table/pricebase.h"
Go to the source code of this file.
Typedefs | |
typedef SmallVector< Industry *, 16 > | SmallIndustryList |
Functions | |
static int32 | BigMulS (const int32 a, const int32 b, const uint8 shift) |
Multiply two integer values and shift the results to right. | |
Money | CalculateCompanyValue (const Company *c, bool including_loan) |
Calculate the value of the company. | |
int | UpdateCompanyRatingAndValue (Company *c, bool update) |
if update is set to true, the economy is updated with this score (also the house is updated, should only be true in the on-tick event) | |
void | ChangeOwnershipOfCompanyItems (Owner old_owner, Owner new_owner) |
Change the ownership of all the items of a company. | |
static void | CompanyCheckBankrupt (Company *c) |
Check for bankruptcy of a company. | |
static void | CompaniesGenStatistics () |
Update the finances of all companies. | |
void | AddInflation (bool check_year) |
Add monthly inflation. | |
void | RecomputePrices () |
Computes all prices, payments and maximum loan. | |
static void | CompaniesPayInterest () |
Let all companies pay the monthly interest on their loan. | |
static void | HandleEconomyFluctuations () |
void | ResetPriceBaseMultipliers () |
Reset changes to the price base multipliers. | |
void | SetPriceBaseMultiplier (Price price, int factor) |
Change a price base by the given factor. | |
void | StartupIndustryDailyChanges (bool init_counter) |
Initialize the variables that will maintain the daily industry change system. | |
void | StartupEconomy () |
void | InitializeEconomy () |
Resets economy to initial values. | |
Money | GetPrice (Price index, uint cost_factor, const GRFFile *grf_file, int shift) |
Determine a certain price. | |
Money | GetTransportedGoodsIncome (uint num_pieces, uint dist, byte transit_days, CargoID cargo_type) |
static uint | DeliverGoodsToIndustry (const Station *st, CargoID cargo_type, uint num_pieces, IndustryID source) |
Transfer goods from station to industry. | |
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. | |
static void | TriggerIndustryProduction (Industry *i) |
Inform the industry about just delivered cargo DeliverGoodsToIndustry() silently incremented incoming_cargo_waiting, now it is time to do something with the new cargo. | |
void | PrepareUnload (Vehicle *front_v) |
Prepare the vehicle to be unloaded. | |
uint32 | ReserveConsist (Station *st, Vehicle *u, StationID next_station) |
Reserves cargo if the full load order and improved_load is set. | |
static uint32 | LoadUnloadVehicle (Vehicle *front, uint32 cargos_reserved) |
Loads/unload the vehicle if possible. | |
void | LoadUnloadStation (Station *st) |
Load/unload the vehicles in this station according to the order they entered. | |
void | CompaniesMonthlyLoop () |
Monthly update of the economic data (of the companies as well as economic fluctuations). | |
static void | DoAcquireCompany (Company *c) |
int | GetAmountOwnedBy (const Company *c, Owner owner) |
CommandCost | CmdBuyShareInCompany (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Acquire shares in an opposing company. | |
CommandCost | CmdSellShareInCompany (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Sell shares in an opposing company. | |
CommandCost | CmdBuyCompany (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Buy up another company. | |
Variables | |
CargoPaymentPool | _cargo_payment_pool ("CargoPayment") |
The actual pool to store cargo payments in. | |
const ScoreInfo | _score_info [] |
Score info, values used for computing the detailed performance rating. | |
int | _score_part [MAX_COMPANIES][SCORE_END] |
Economy | _economy |
Prices | _price |
Money | _additional_cash_required |
static PriceMultipliers | _price_base_multiplier |
static SmallIndustryList | _cargo_delivery_destinations |
The industries we've currently brought cargo to. |
Handling of the economy.
Definition in file economy.cpp.
void AddInflation | ( | bool | check_year | ) |
Add monthly inflation.
check_year | Shall the inflation get stopped after 170 years? |
Definition at line 646 of file economy.cpp.
References _cur_year, _settings_game, GameSettings::game_creation, Economy::infl_amount, Economy::infl_amount_pr, Economy::inflation_payment, Economy::inflation_prices, MAX_INFLATION, min(), ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR, and GameCreationSettings::starting_year.
Referenced by AfterLoadGame(), and CompaniesMonthlyLoop().
static int32 BigMulS | ( | const int32 | a, | |
const int32 | b, | |||
const uint8 | shift | |||
) | [inline, static] |
Multiply two integer values and shift the results to right.
This function multiplies two integer values. The result is shifted by the amount of shift to right.
a | The first integer | |
b | The second integer | |
shift | The amount to shift the value to right. |
Definition at line 71 of file economy.cpp.
Calculate the value of the company.
That is the value of all assets (vehicles, stations, etc) and money minus the loan, except when including_loan is false
which is useful when we want to calculate the value for bankruptcy.
c | the company to get the value of. | |
including_loan | include the loan in the company value. |
Definition at line 109 of file economy.cpp.
References CountBits(), CompanyProperties::current_loan, BaseStation::facilities, FOR_ALL_VEHICLES, SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Aircraft::IsNormalAircraft(), max(), CompanyProperties::money, Vehicle::owner, BaseStation::owner, BaseVehicle::type, Vehicle::value, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by CmdBuyShareInCompany(), CmdSellShareInCompany(), CompanyCheckBankrupt(), ScriptCompany::GetQuarterlyCompanyValue(), CompanyWindow::SetStringParameters(), and UpdateCompanyRatingAndValue().
Change the ownership of all the items of a company.
old_owner | The company that gets removed. | |
new_owner | The company to merge to, or INVALID_OWNER to remove the company. |
Definition at line 291 of file economy.cpp.
References _current_company, _local_company, _networking, AddTrackToSignalBuffer(), Subsidy::awarded, Vehicle::cargo_payment, Backup< T >::Change(), ChangeTileOwner(), ChangeWindowOwner(), ClrBit(), CMD_SELL_SHARE_IN_COMPANY, Vehicle::colourmap, GroupStatistics::CountEngine(), GroupStatistics::CountVehicle(), DC_BANKRUPT, DC_EXEC, DoCommand(), FOR_ALL_VEHICLES, FOR_ALL_WAYPOINTS, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetTrackBits(), HasBit(), HasSignalOnTrack(), HasSignals(), Town::have_ratings, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_OWNER, IsCompanyBuildableVehicleType(), Vehicle::IsEngineCountable(), IsLevelCrossingTile(), Vehicle::IsPrimaryVehicle(), IsTileOwner(), IsTileType(), MapSize(), MarkWholeScreenDirty(), max(), MP_RAILWAY, NetworkClientsToSpectators(), FreeUnitIDGenerator::NextID(), BaseStation::owner, CargoPayment::owner, Group::owner, Vehicle::owner, OWNER_NONE, Vehicle::Previous(), Town::ratings, RemoveAllEngineReplacementForCompany(), RemoveFirstTrack(), Backup< T >::Restore(), SetBit(), SetLocalCompany(), CompanyProperties::share_owners, SubtractMoneyFromCompany(), TRACK_BIT_NONE, BaseVehicle::type, Vehicle::unitnumber, GroupStatistics::UpdateAutoreplace(), UpdateLevelCrossing(), UpdateSignalsInBuffer(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by CmdCompanyCtrl(), and ResetLandscapeConfirmationCallback().
CommandCost CmdBuyCompany | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Buy up another company.
When a competing company is gone bankrupt you get the chance to purchase that company.
tile | unused | |
flags | type of operation | |
p1 | company to buy up | |
p2 | unused | |
text | unused |
Definition at line 1777 of file economy.cpp.
References _current_company, _local_company, _networking, CompanyProperties::bankrupt_asked, CMD_ERROR, DC_EXEC, EXPENSES_OTHER, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and MayCompanyTakeOver().
CommandCost CmdBuyShareInCompany | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Acquire shares in an opposing company.
tile | unused | |
flags | type of operation | |
p1 | company to buy the shares from | |
p2 | unused | |
text | unused |
Definition at line 1684 of file economy.cpp.
References _cur_year, _current_company, _settings_game, CommandCost::AddCost(), EconomySettings::allow_shares, CalculateCompanyValue(), CMD_ERROR, COMPANY_SPECTATOR, CompanyAdminUpdate(), DC_EXEC, GameSettings::economy, EXPENSES_OTHER, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), CompanyProperties::inaugurated_year, CompanyProperties::is_ai, MayCompanyTakeOver(), return_cmd_error, SetWindowDirty(), and CompanyProperties::share_owners.
CommandCost CmdSellShareInCompany | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Sell shares in an opposing company.
tile | unused | |
flags | type of operation | |
p1 | company to sell the shares from | |
p2 | unused | |
text | unused |
Definition at line 1736 of file economy.cpp.
References _current_company, _settings_game, EconomySettings::allow_shares, CalculateCompanyValue(), CMD_ERROR, CompanyAdminUpdate(), DC_BANKRUPT, DC_EXEC, GameSettings::economy, EXPENSES_OTHER, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), SetWindowDirty(), and CompanyProperties::share_owners.
static void CompaniesGenStatistics | ( | ) | [static] |
Update the finances of all companies.
Pay for the stations, update the history graph, update ratings and company values, and deal with bankruptcy.
Definition at line 584 of file economy.cpp.
References _cur_month, _current_company, _settings_game, CommandCost::AddCost(), AirportMaintenanceCost(), CompanyProperties::block_preview, CanalMaintenanceCost(), Backup< T >::Change(), CompanyCheckBankrupt(), CompanyProperties::cur_economy, GameSettings::economy, EXPENSES_PROPERTY, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::infrastructure, EconomySettings::infrastructure_maintenance, MAX_HISTORY_QUARTERS, CompanyProperties::num_valid_stat_ent, CompanyProperties::old_economy, BaseStation::owner, CompanyInfrastructure::rail, RailMaintenanceCost(), RAILTYPE_BEGIN, Backup< T >::Restore(), CompanyInfrastructure::road, RoadMaintenanceCost(), ROADTYPE_BEGIN, SetWindowDirty(), CompanyInfrastructure::signal, SignalMaintenanceCost(), CompanyInfrastructure::station, StationMaintenanceCost(), SubtractMoneyFromCompany(), UpdateCompanyRatingAndValue(), and CompanyInfrastructure::water.
Referenced by CompaniesMonthlyLoop().
static void CompaniesPayInterest | ( | ) | [static] |
Let all companies pay the monthly interest on their loan.
Definition at line 745 of file economy.cpp.
References _cur_month, _current_company, Backup< T >::Change(), CompanyProperties::current_loan, EXPENSES_LOAN_INT, EXPENSES_OTHER, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Economy::interest_rate, Backup< T >::Restore(), and SubtractMoneyFromCompany().
Referenced by CompaniesMonthlyLoop().
static void CompanyCheckBankrupt | ( | Company * | c | ) | [static] |
Check for bankruptcy of a company.
Called every three months.
c | Company to check. |
Definition at line 516 of file economy.cpp.
References _local_company, _network_server, _networking, CompanyProperties::bankrupt_asked, CompanyProperties::bankrupt_timeout, AI::BroadcastNewEvent(), CalculateCompanyValue(), CMD_COMPANY_CTRL, CompanyNewsInformation::company_name, CRR_BANKRUPT, DoCommandP(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, MAX_UVALUE, CompanyProperties::money, NS_COMPANY_TROUBLE, CompanyProperties::quarters_of_bankruptcy, SetDParam(), and SetDParamStr().
Referenced by CompaniesGenStatistics().
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 | |||
) | [static] |
Delivers goods to industries/towns and calculates the payment.
num_pieces | amount of cargo delivered | |
cargo_type | the type of cargo that is delivered | |
dest | Station the cargo has been unloaded | |
source_tile | The origin of the cargo for distance calculation | |
days_in_transit | Travel time | |
company | The company delivering the cargo | |
src_type | Type of source of cargo (industry, town, headquarters) | |
src | Index of source of cargo |
Definition at line 993 of file economy.cpp.
References _settings_game, GoodsEntry::acceptance_pickup, Station::always_accepted, CompanyProperties::cargo_types, CheckSubsidised(), CompanyProperties::cur_economy, DeliverGoodsToIndustry(), GameSettings::difficulty, DistanceManhattan(), GoodsEntry::GES_ACCEPTED_BIGTICK, GoodsEntry::GES_CURRENT_MONTH, GoodsEntry::GES_EVER_ACCEPTED, CargoSpec::Get(), SpecializedStation< Station, false >::Get(), Station::goods, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, TransportedCargoStat< Tstorage >::new_act, Town::received, SetBit(), ST_INDUSTRY, DifficultySettings::subsidy_multiplier, BaseStation::town, CargoSpec::town_effect, and BaseStation::xy.
Referenced by CargoPayment::PayFinalDelivery().
static uint DeliverGoodsToIndustry | ( | const Station * | st, | |
CargoID | cargo_type, | |||
uint | num_pieces, | |||
IndustryID | source | |||
) | [static] |
Transfer goods from station to industry.
All cargo is delivered to the nearest (Manhattan) industry to the station sign, which is inside the acceptance rectangle and actually accepts the cargo.
st | The station that accepted the cargo | |
cargo_type | Type of cargo delivered | |
num_pieces | Amount of cargo delivered | |
source | The source of the cargo |
Definition at line 943 of file economy.cpp.
References Industry::accepts_cargo, SmallVector< T, S >::Include(), Industry::incoming_cargo_waiting, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Station::industries_near, IndustryTemporarilyRefusesCargo(), SmallVector< T, S >::Length(), lengthof, and min().
Referenced by DeliverGoods().
Determine a certain price.
index | Price base | |
cost_factor | Price factor | |
grf_file | NewGRF to use local price multipliers from. | |
shift | Extra bit shifting after the computation |
Definition at line 867 of file economy.cpp.
References GRFFile::price_base_multipliers.
Referenced by ScriptTile::GetBuildCost(), ScriptRoad::GetBuildCost(), ScriptRail::GetBuildCost(), ScriptMarine::GetBuildCost(), ObjectSpec::GetBuildCost(), ObjectSpec::GetClearCost(), Engine::GetCost(), GetRefitCost(), Train::GetRunningCost(), Ship::GetRunningCost(), RoadVehicle::GetRunningCost(), Engine::GetRunningCost(), and Aircraft::GetRunningCost().
void LoadUnloadStation | ( | Station * | st | ) |
Load/unload the vehicles in this station according to the order they entered.
st | the station to do the loading/unloading for |
Definition at line 1583 of file economy.cpp.
References SmallVector< T, S >::Begin(), SmallVector< T, S >::Clear(), SmallVector< T, S >::End(), Vehicle::load_unload_ticks, LoadUnloadVehicle(), TriggerIndustryProduction(), Vehicle::vehstatus, VS_CRASHED, and VS_STOPPED.
static uint32 LoadUnloadVehicle | ( | Vehicle * | front, | |
uint32 | cargos_reserved | |||
) | [static] |
Loads/unload the vehicle if possible.
front | the vehicle to be (un)loaded | |
cargos_reserved | bit field: the cargo classes for which cargo has been reserved in this loading cycle |
Definition at line 1250 of file economy.cpp.
References _cur_year, _current_company, _local_company, _returned_refit_capacity, _settings_client, _settings_game, AAT_STATION_CARGO_TAKEN, GoodsEntry::acceptance_pickup, Vehicle::build_year, VehicleCache::cached_max_speed, GroundVehicleCache::cached_total_length, CalcPercentVehicleFilled(), CALLBACK_FAILED, EngineInfo::callback_mask, Vehicle::cargo, GoodsEntry::cargo, Vehicle::cargo_cap, Vehicle::cargo_payment, Vehicle::cargo_type, CBID_VEHICLE_LOAD_AMOUNT, CBM_VEHICLE_LOAD_AMOUNT, CC_PASSENGERS, CeilDiv(), ClrBit(), COMPANY_SPECTATOR, CargoList< Tinst, Tcont >::Count(), CT_AUTO_REFIT, CT_NO_REFIT, Vehicle::cur_speed, Vehicle::current_order, Vehicle::current_order_time, GoodsEntry::days_since_pickup, DC_EXEC, DC_QUERY_COST, DoCommand(), CargoList< Tinst, Tcont >::Empty(), Vehicle::engine_type, ErrorUnknownCallbackResult(), Vehicle::fill_percent_te_id, SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::From(), GB(), GoodsEntry::GES_PICKUP, SpecializedStation< Station, false >::Get(), GetBestFittingSubType(), CommandCost::GetCost(), Engine::GetGRF(), Engine::GetGRFID(), Vehicle::GetGroundVehicleCache(), Order::GetLoadType(), Vehicle::GetNextArticulatedPart(), Vehicle::GetNextStoppingStation(), Station::GetPlatformLength(), Order::GetRefitCargo(), Order::GetRefitSubtype(), GetStationIndex(), Order::GetUnloadType(), GetVehicleCallback(), GetWindowClassForVehicleType(), Station::goods, OrderSettings::gradual_loading, ClientSettings::gui, Vehicle::HasArticulatedPart(), HasBit(), OrderSettings::improved_load, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, InvalidateWindowData(), IsCargoInClass(), Aircraft::IsNormalAircraft(), Order::IsRefit(), IsTileType(), Order::IsType(), GoodsEntry::last_age, Vehicle::last_loading_station, GoodsEntry::last_speed, Vehicle::last_station_visited, Vehicle::lateness_counter, Vehicle::load_unload_ticks, GUISettings::loading_indicators, Vehicle::MarkDirty(), Station::MarkTilesDirty(), max(), min(), StationCargoList::MoveTo(), MP_STATION, Vehicle::Next(), NUM_CARGO, OLFB_NO_LOAD, VehicleCargoList::OnboardCount(), GameSettings::order, Vehicle::owner, Vehicle::profit_this_year, PROP_VEHICLE_LOAD_AMOUNT, Vehicle::RefreshNextHopsStats(), ReserveConsist(), Backup< T >::Restore(), SAT_CARGO_TAKEN, SAT_TRAIN_LOADS, SB(), SetBit(), CargoPayment::SetCargo(), SetWindowDirty(), ShowFillingPercent(), CommandCost::Succeeded(), StationCargoList::TakeFrom(), Vehicle::tile, TILE_SIZE, BaseVehicle::type, UpdateFillingPercent(), Vehicle::vcache, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, Vehicle::vehicle_flags, VF_CARGO_UNLOADING, VF_LOADING_FINISHED, VF_STOP_LOADING, Order::wait_time, Vehicle::x_pos, BaseStation::xy, Vehicle::y_pos, and Vehicle::z_pos.
Referenced by LoadUnloadStation().
void PrepareUnload | ( | Vehicle * | front_v | ) |
Prepare the vehicle to be unloaded.
curr_station | the station where the consist is at the moment | |
front_v | the vehicle to be unloaded |
Definition at line 1154 of file economy.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_cargo_payment_pool >::CanAllocateItem(), Vehicle::cargo_payment, ClrBit(), Vehicle::current_order, SpecializedStation< Station, false >::Get(), Vehicle::GetNextStoppingStation(), Order::GetUnloadType(), Station::goods, Vehicle::last_station_visited, Vehicle::list, Vehicle::load_unload_ticks, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::MAX_SIZE, Vehicle::Next(), Vehicle::orders, SetBit(), GoodsEntry::UpdateFlowStats(), Vehicle::vehicle_flags, VF_CARGO_UNLOADING, and VF_LOADING_FINISHED.
Referenced by Vehicle::BeginLoading().
Reserves cargo if the full load order and improved_load is set.
st | The station where the consist is loading at the moment. | |
u | The front of the loading vehicle consist. | |
next_station | Station the vehicle will stop at next. |
Definition at line 1204 of file economy.cpp.
References _settings_game, GoodsEntry::cargo, Vehicle::current_order, Order::GetLoadType(), Station::goods, HasBit(), OrderSettings::improved_load, StationCargoList::MoveTo(), Vehicle::Next(), GameSettings::order, SetBit(), and VF_CARGO_UNLOADING.
Referenced by LoadUnloadVehicle().
void SetPriceBaseMultiplier | ( | Price | price, | |
int | factor | |||
) |
Change a price base by the given factor.
The price base is altered by factors of two. NewBaseCost = OldBaseCost * 2^n
price | Index of price base to change. | |
factor | Amount to change by. |
Definition at line 810 of file economy.cpp.
References Clamp(), and MIN_PRICE_MODIFIER.
Referenced by FinalisePriceBaseMultipliers().
void StartupIndustryDailyChanges | ( | bool | init_counter | ) |
Initialize the variables that will maintain the daily industry change system.
init_counter | specifies if the counter is required to be initialized |
Definition at line 820 of file economy.cpp.
References Economy::industry_daily_change_counter, Economy::industry_daily_increment, MapLogX(), and MapLogY().
Referenced by Load_ECMY().
static void TriggerIndustryProduction | ( | Industry * | i | ) | [static] |
Inform the industry about just delivered cargo DeliverGoodsToIndustry() silently incremented incoming_cargo_waiting, now it is time to do something with the new cargo.
i | The industry to process |
Definition at line 1041 of file economy.cpp.
References _date, IndustrySpec::callback_mask, CBM_IND_PRODUCTION_256_TICKS, CBM_IND_PRODUCTION_CARGO_ARRIVAL, GetIndustrySpec(), HasBit(), IAT_INDUSTRY_RECEIVED_CARGO, Industry::incoming_cargo_waiting, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INDUSTRY_TRIGGER_RECEIVED_CARGO, IndustryProductionCallback(), IndustrySpec::input_cargo_multiplier, Industry::last_cargo_accepted_at, lengthof, min(), Industry::produced_cargo_waiting, SetWindowDirty(), TriggerIndustry(), Industry::type, and Industry::was_cargo_delivered.
Referenced by LoadUnloadStation().
int UpdateCompanyRatingAndValue | ( | Company * | c, | |
bool | update | |||
) |
if update is set to true, the economy is updated with this score (also the house is updated, should only be true in the on-tick event)
update | the economy with calculated score | |
c | company been evaluated |
Definition at line 149 of file economy.cpp.
References Vehicle::age, CalculateCompanyValue(), CompanyProperties::cargo_types, Clamp(), ClampToI32(), CountBits(), CompanyProperties::current_loan, BaseStation::facilities, FOR_ALL_VEHICLES, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsCompanyBuildableVehicleType(), Vehicle::IsPrimaryVehicle(), CompanyProperties::location_of_HQ, max(), min(), CompanyProperties::money, ScoreInfo::needed, CompanyProperties::num_valid_stat_ent, CompanyProperties::old_economy, BaseStation::owner, Vehicle::owner, CompanyEconomyEntry::performance_history, Vehicle::profit_last_year, ScoreInfo::score, SCORE_MAX, SCORE_TOTAL, SetWindowDirty(), BaseVehicle::type, and UpdateCompanyHQ().
Referenced by CmdBuildObject(), and CompaniesGenStatistics().
The industries we've currently brought cargo to.
Definition at line 932 of file economy.cpp.
CargoPaymentPool _cargo_payment_pool("CargoPayment") |
The actual pool to store cargo payments in.
const ScoreInfo _score_info[] |
{ { 120, 100}, { 80, 100}, { 10000, 100}, { 50000, 50}, { 100000, 100}, { 40000, 400}, { 8, 50}, {10000000, 50}, { 250000, 50}, { 0, 0} }
Score info, values used for computing the detailed performance rating.
Definition at line 81 of file economy.cpp.
Referenced by PerformanceRatingDetailWindow::DrawWidget().