cargodest_func.h File Reference

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?
RouteLinkFindRouteLinkForCargo (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.

Detailed Description

Functions related to cargo destinations.

Definition in file cargodest_func.h.


Function Documentation

void AgeRouteLinks ( Station st  ) 

Age and expire route links of a station.

Definition at line 1176 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.

Parameters:
order The order being removed.

Definition at line 1157 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.

Parameters:
station Station being removed.

Definition at line 1125 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.

Parameters:
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.
Returns:
True if the cargo was handled has having destinations.

Definition at line 927 of file cargodest.cpp.

References CargoHasDestinations(), MoveCargoWithDestinationToStationWorker(), and ST_INDUSTRY.

void PrefillRouteLinks ( const Vehicle v  ) 
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 (  ) 
void UpdateVehicleRouteLinks ( const Vehicle v,
StationID  arrived_at 
)

Generated on Mon May 9 05:19:05 2011 for OpenTTD by  doxygen 1.6.1