Functions related to cargo destinations. More...
#include "cargodest_type.h"
#include "cargo_type.h"
#include "vehicle_type.h"
#include "station_type.h"
#include "order_type.h"
Go to the source code of this file.
Functions | |
bool | CargoHasDestinations (CargoID cid) |
Are cargo destinations for this cargo type enabled? | |
RouteLink * | FindRouteLinkForCargo (Station *st, CargoID cid, const struct CargoPacket *cp, StationID *next_unload, OrderID order=INVALID_ORDER, bool *found=NULL) |
bool | MoveCargoWithDestinationToStation (CargoID cid, uint *amount, SourceType source_type, SourceID source_id, const StationList *all_stations, TileIndex src_tile) |
Move cargo to a station with destination information. | |
void | UpdateVehicleRouteLinks (const Vehicle *v, StationID arrived_at) |
Update route links after a vehicle has arrived at a station. | |
void | PrefillRouteLinks (const Vehicle *v) |
Pre-fill the route links from the orders of a vehicle. | |
void | InvalidateStationRouteLinks (Station *station) |
Remove all route links to and from a station. | |
void | InvalidateOrderRouteLinks (OrderID order) |
Remove all route links referencing an order. | |
void | AgeRouteLinks (Station *st) |
Age and expire route links of a station. | |
void | RebuildCargoLinkCounts () |
Rebuild the cached count of incoming cargo links. | |
void | UpdateCargoLinks () |
Update the demand links of all towns and industries. |
Functions related to cargo destinations.
Definition in file cargodest_func.h.
void AgeRouteLinks | ( | Station * | st | ) |
Age and expire route links of a station.
Definition at line 1174 of file cargodest.cpp.
References _settings_game, EconomySettings::cargodest, GameSettings::economy, Station::goods, CargodestSettings::max_route_age, and GoodsEntry::routes.
void InvalidateOrderRouteLinks | ( | OrderID | order | ) |
Remove all route links referencing an order.
order | The order being removed. |
Definition at line 1155 of file cargodest.cpp.
References Station::goods, and GoodsEntry::routes.
Referenced by CmdModifyOrder(), and Order::PostDestructor().
void InvalidateStationRouteLinks | ( | Station * | station | ) |
Remove all route links to and from a station.
station | Station being removed. |
Definition at line 1123 of file cargodest.cpp.
References Station::goods, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and GoodsEntry::routes.
Referenced by Station::~Station().
bool MoveCargoWithDestinationToStation | ( | CargoID | cid, | |
uint * | amount, | |||
SourceType | source_type, | |||
SourceID | source_id, | |||
const StationList * | all_stations, | |||
TileIndex | src_tile | |||
) |
Move cargo to a station with destination information.
cid | Cargo type. | |
amount[in,out] | Cargo amount, return is actually moved cargo. | |
source_type | Type of the cargo source. | |
source_id | ID of the cargo source. | |
all_stations | List of possible target stations. | |
src_tile | Source tile. |
Definition at line 925 of file cargodest.cpp.
References CargoHasDestinations(), MoveCargoWithDestinationToStationWorker(), and ST_INDUSTRY.
void PrefillRouteLinks | ( | const Vehicle * | v | ) |
Pre-fill the route links from the orders of a vehicle.
v | The vehicle to get the orders from. |
Definition at line 1068 of file cargodest.cpp.
References _settings_game, CargoDestinationsDisabled(), DistanceManhattan(), Vehicle::FirstShared(), SpecializedStation< Station, false >::Get(), Order::GetDestination(), Vehicle::GetDisplayMaxSpeed(), OrderList::GetFirstOrder(), Order::GetNonStopType(), OrderList::GetNumOrders(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Order::IsRefit(), Order::IsType(), Vehicle::list, Order::next, Vehicle::NextShared(), ONSF_NO_STOP_AT_DESTINATION_STATION, Vehicle::orders, VehicleSettings::plane_speed, TILE_SIZE, BaseVehicle::type, UpdateVehicleRouteLinks(), VEH_AIRCRAFT, GameSettings::vehicle, and BaseStation::xy.
Referenced by AfterLoadGame(), CmdBuildVehicle(), CmdCloneOrder(), CmdModifyOrder(), CmdMoveRailVehicle(), CmdRefitVehicle(), DeleteOrder(), InsertOrder(), and NormaliseTrainHead().
void RebuildCargoLinkCounts | ( | ) |
Rebuild the cached count of incoming cargo links.
Definition at line 691 of file cargodest.cpp.
References SmallVector< T, S >::Begin(), CargoSourceSink::cargo_links, SmallVector< T, S >::End(), lengthof, MemSetT(), and CargoSourceSink::num_incoming_links.
Referenced by InitializeWindowsAndCaches().
void UpdateCargoLinks | ( | ) |
Update the demand links of all towns and industries.
Definition at line 716 of file cargodest.cpp.
References AddMissingIndustryLinks(), CargoDestinationsDisabled(), InvalidateWindowClassesData(), RemoveInvalidLinks(), UpdateCargoLinks(), UpdateExpectedLinks(), and UpdateLinkWeights().
Update route links after a vehicle has arrived at a station.
v | The vehicle. | |
arrived_at | The station the vehicle arrived at. |
Definition at line 1036 of file cargodest.cpp.
References VehicleCache::cached_cargo_mask, CargoHasDestinations(), Vehicle::current_order, SpecializedStation< Station, false >::Get(), Station::goods, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_ORDER, Vehicle::last_order_id, Vehicle::last_station_loaded, GoodsEntry::routes, Vehicle::travel_time, UpdateVehicleRouteLinks(), and Vehicle::vcache.