Public Types | Public Member Functions | Data Fields

# GoodsEntry Struct Reference

Stores station stats for a single cargo. More...

`#include <station_base.h>`

## Public Types
enum | GoodsEntryStatus { GES_ACCEPTANCE, GES_PICKUP, GES_EVER_ACCEPTED, GES_LAST_MONTH, GES_CURRENT_MONTH, GES_ACCEPTED_BIGTICK }
| Status of this cargo for the station. More...
## Public Member Functions
bool | HasVehicleEverTriedLoading () const
| Reports whether a vehicle has ever tried to load the cargo at this station.
uint | GetSumFlowVia (StationID via) const
| Get the sum of flows via a specific station from this GoodsEntry.
StationID | GetVia (StationID source) const
| Get the best next hop for a cargo packet from station source, optionally excluding a specific next station.
StationID | GetVia (StationID source, StationID excluded, StationID excluded2=INVALID_STATION) const
| Get the best next hop for a cargo packet from station source, optionally excluding a specific next station.
## Data Fields
byte | acceptance_pickup
| Status of this cargo, see GoodsEntryStatus.
byte | time_since_pickup
| Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.
byte | rating
| Station rating for this cargo.
byte | last_speed
| Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
byte | last_age
| Age in years (up to 255) of the last vehicle that tried to load this cargo.
byte | amount_fract
| Fractional part of the amount in the cargo list.
StationCargoList | cargo
| The cargo packets of cargo waiting in this station.
LinkGraphID | link_graph
| Link graph this station belongs to.
NodeID | node
| ID of node in link graph referring to this goods entry.
FlowStatMap | flows
| Planned flows through this station.
uint | max_waiting_cargo
| Max cargo from this station waiting at any station.

## Detailed Description

Stores station stats for a single cargo.

Definition at line 98 of file station_base.h.

## Member Enumeration Documentation

enum GoodsEntry::GoodsEntryStatus

Status of this cargo for the station.

Enumerator:

  GES_ACCEPTANCE | Set when the station accepts the cargo currently for final deliveries. It is updated every STATION_ACCEPTANCE_TICKS ticks by checking surrounding tiles for acceptance >= 8/8.
  GES_PICKUP | Set when the cargo was ever waiting at the station. It is set when cargo supplied by surrounding tiles is moved to the station, or when arriving vehicles unload/transfer cargo without it being a final delivery. This also indicates, whether a cargo has a rating at the station. This flag is never cleared.
  GES_EVER_ACCEPTED | Set when a vehicle ever delivered cargo to the station for final delivery. This flag is never cleared.
  GES_LAST_MONTH | Set when cargo was delivered for final delivery last month. This flag is set to the value of GES_CURRENT_MONTH at the start of each month.
  GES_CURRENT_MONTH | Set when cargo was delivered for final delivery this month. This flag is reset on the beginning of every month.
  GES_ACCEPTED_BIGTICK | Set when cargo was delivered for final delivery during the current STATION_ACCEPTANCE_TICKS interval. This flag is reset every STATION_ACCEPTANCE_TICKS ticks.

Definition at line 100 of file station_base.h.

## Member Function Documentation

uint GoodsEntry::GetSumFlowVia | ( | StationID | via | ) | const

Get the sum of flows via a specific station from this GoodsEntry.

Parameters:

  | via | Remote station to look for.

Returns:
  a FlowStat with all flows for 'via' added up.

Definition at line 4190 of file station_cmd.cpp.

References flows.

Referenced by LinkGraphOverlay::AddLinks().

StationID GoodsEntry::GetVia | ( | StationID | source,
|  | StationID | excluded,
|  | StationID | excluded2 = `INVALID_STATION` |
| ) |  |  | const`[inline]`

Get the best next hop for a cargo packet from station source, optionally excluding a specific next station.

Parameters:

  | source | Source of the packet.
  | excluded | If this station would be chosen choose the second best one instead.
  | excluded2 | Second station to be excluded, if != INVALID_STATION.

Returns:
  The chosen next hop or INVALID_STATION if none was found.

Definition at line 216 of file station_base.h.

References flows.

StationID GoodsEntry::GetVia | ( | StationID | source | ) | const`[inline]`

Get the best next hop for a cargo packet from station source, optionally excluding a specific next station.

Parameters:

  | source | Source of the packet.

Returns:
  The chosen next hop or INVALID_STATION if none was found.

Definition at line 202 of file station_base.h.

References flows.

Referenced by CargoReroute::operator()(), and VehicleCargoList::Stage().

bool GoodsEntry::HasVehicleEverTriedLoading | ( |  | ) | const`[inline]`

Reports whether a vehicle has ever tried to load the cargo at this station.

This does not imply that there was cargo available for loading. Refer to GES_PICKUP for that.

Returns:
  true if vehicle tried to load.

Definition at line 193 of file station_base.h.

References last_speed.

## Field Documentation

byte GoodsEntry::last_age

Age in years (up to 255) of the last vehicle that tried to load this cargo.

This does not imply there was any cargo to load.

Definition at line 178 of file station_base.h.

Referenced by LoadUnloadVehicle().

byte GoodsEntry::last_speed

Maximum speed (up to 255) of the last vehicle that tried to load this cargo.

This does not imply there was any cargo to load. The unit used is a special vehicle-specific speed unit for station ratings.

- Trains: km-ish/h
- RV: km-ish/h
- Ships: 0.5 * km-ish/h
- Aircraft: 8 * mph

Definition at line 172 of file station_base.h.

Referenced by AfterLoadGame(), HasVehicleEverTriedLoading(), and LoadUnloadVehicle().

byte GoodsEntry::time_since_pickup

Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.

The unit used is STATION_RATING_TICKS. This does not imply there was any cargo to load.

Definition at line 159 of file station_base.h.

Referenced by LoadUnloadVehicle().

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

- src/station_base.h
- src/station_cmd.cpp