RouteLink Struct Reference

Holds information about a route service between two stations. More...

#include <cargodest_base.h>

Inheritance diagram for RouteLink:
Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_routelink_pool >

Public Member Functions

 RouteLink (StationID dest=INVALID_STATION, OrderID prev_order=INVALID_ORDER, OrderID next_order=INVALID_ORDER, Owner owner=INVALID_OWNER, uint32 travel_time=0, VehicleType vtype=VEH_INVALID)
 Constructor.
 ~RouteLink ()
 Invalidate some stuff on destruction.
StationID GetDestination () const
 Get the target station of this link.
OrderID GetOriginOrderId () const
 Get the order id that lead to the origin station.
OrderID GetDestOrderId () const
 Get the order id that lead to the destination station.
Owner GetOwner () const
 Get the owner of this link.
VehicleType GetVehicleType () const
 Get the type of the vehicles on this link.
uint32 GetTravelTime () const
 Get the travel time of this link.
uint16 GetWaitTime () const
 Get the wait time at the origin station.
void SetDestination (StationID dest_id, OrderID dest_order_id)
 Update the destination of the route link.
void UpdateTravelTime (uint32 new_time)
 Update the travel time with a new travel time.
void VehicleArrived ()
 A vehicle arrived at the origin of the link, reset waiting time.

Private Attributes

StationID dest
 Destination station id.
OrderID prev_order
 Id of the order the vehicle had when arriving at the origin.
OrderID next_order
 Id of the order the vehicle will leave the station with.
OwnerByte owner
 Owner of the vehicle of the link.
VehicleTypeByte vtype
 Vehicle type traveling this link.
uint32 travel_time
 Average travel duration of this link.
uint16 wait_time
 Days since the last vehicle traveled this link.

Friends

struct SaveLoadGetRouteLinkDescription ()
 Saving and loading of route links.
void ChangeOwnershipOfCompanyItems (Owner old_owner, Owner new_owner)
 Change the ownership of all the items of a company.
void AgeRouteLinks (Station *st)
 Age and expire route links of a station.

Detailed Description

Holds information about a route service between two stations.

Definition at line 101 of file cargodest_base.h.


Member Function Documentation

StationID RouteLink::GetDestination (  )  const [inline]

Get the target station of this link.

Definition at line 127 of file cargodest_base.h.

References dest.

Referenced by CFollowRouteLinkT::Follow(), and CYapfCostRouteLinkT< Types >::RouteLinkCost().

OrderID RouteLink::GetDestOrderId (  )  const [inline]

Get the order id that lead to the destination station.

Definition at line 133 of file cargodest_base.h.

References next_order.

Referenced by CYapfCostRouteLinkT< Types >::RouteLinkCost(), and CYapfCostRouteLinkT< Types >::ValidLink().

OrderID RouteLink::GetOriginOrderId (  )  const [inline]
Owner RouteLink::GetOwner (  )  const [inline]

Get the owner of this link.

Definition at line 136 of file cargodest_base.h.

References owner.

Referenced by CYapfCostRouteLinkT< Types >::ValidLink().

uint32 RouteLink::GetTravelTime (  )  const [inline]

Get the travel time of this link.

Definition at line 142 of file cargodest_base.h.

References travel_time.

Referenced by CYapfCostRouteLinkT< Types >::RouteLinkCost().

VehicleType RouteLink::GetVehicleType (  )  const [inline]

Get the type of the vehicles on this link.

Definition at line 139 of file cargodest_base.h.

References vtype.

Referenced by CYapfCostRouteLinkT< Types >::RouteLinkCost().

uint16 RouteLink::GetWaitTime (  )  const [inline]

Get the wait time at the origin station.

Definition at line 145 of file cargodest_base.h.

References wait_time.

Referenced by CYapfCostRouteLinkT< Types >::RouteLinkCost().

void RouteLink::SetDestination ( StationID  dest_id,
OrderID  dest_order_id 
) [inline]

Update the destination of the route link.

Definition at line 148 of file cargodest_base.h.

References dest, and next_order.

void RouteLink::UpdateTravelTime ( uint32  new_time  )  [inline]

Update the travel time with a new travel time.

Definition at line 155 of file cargodest_base.h.

References travel_time.

void RouteLink::VehicleArrived (  )  [inline]

A vehicle arrived at the origin of the link, reset waiting time.

Definition at line 162 of file cargodest_base.h.

References wait_time.


Friends And Related Function Documentation

void AgeRouteLinks ( Station st  )  [friend]

Age and expire route links of a station.

Definition at line 1174 of file cargodest.cpp.

void ChangeOwnershipOfCompanyItems ( Owner  old_owner,
Owner  new_owner 
) [friend]

Change the ownership of all the items of a company.

Parameters:
old_owner The company that gets removed.
new_owner The company to merge to, or INVALID_OWNER to remove the company.

Definition at line 290 of file economy.cpp.

struct SaveLoad* GetRouteLinkDescription (  )  [friend]

Saving and loading of route links.

Returns:
The SaveLoad description for RouteLinks.

Definition at line 131 of file cargodest_sl.cpp.


The documentation for this struct was generated from the following files:

Generated on Fri Jun 3 05:20:21 2011 for OpenTTD by  doxygen 1.6.1