Go to the documentation of this file.
29 cargo_monitor_map.clear();
33 CargoMonitorMap::iterator next;
34 for (CargoMonitorMap::iterator it = cargo_monitor_map.begin(); it != cargo_monitor_map.end(); it = next) {
38 cargo_monitor_map.erase(it);
72 CargoMonitorMap::iterator iter = monitor_map.find(monitor);
73 if (iter == monitor_map.end()) {
74 if (keep_monitoring) {
75 std::pair<CargoMonitorID, uint32> p(monitor, 0);
76 monitor_map.insert(p);
80 int32 result = iter->second;
82 if (!keep_monitoring) monitor_map.erase(iter);
122 if (amount == 0)
return;
153 if (ind->
index != dest)
continue;
static CargoMonitorID EncodeCargoTownMonitor(CompanyID company, CargoID ctype, TownID town)
Encode a cargo monitoring number for pickup or delivery at a town.
static CargoMonitorID EncodeCargoIndustryMonitor(CompanyID company, CargoID ctype, IndustryID ind)
Encode a cargo monitor for pickup or delivery at an industry.
std::map< CargoMonitorID, OverflowSafeInt32 > CargoMonitorMap
Map type for storing and updating active cargo monitor numbers and their amounts.
Town * town
The town this station is associated with.
void ClearCargoDeliveryMonitoring(CompanyID company)
Clear all delivery cargo monitors.
Tindex index
Index of this pool item.
Defines the internal data of a functional industry.
uint32 CargoMonitorID
Unique number for a company / cargo type / (town or industry).
Owner
Enum for all companies/owners.
@ ST_TOWN
Source/destination is a town.
uint16 SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
Get the amount of cargo picked up for the given cargo monitor since activation or last query.
@ INVALID_OWNER
An invalid owner.
static CompanyID DecodeMonitorCompany(CargoMonitorID num)
Extract the company from the cargo monitor.
@ ST_INDUSTRY
Source/destination is an industry.
CargoMonitorMap _cargo_pickups
Map of monitored pick-ups to the amount since last query/activation.
CargoMonitorMap _cargo_deliveries
Map of monitored deliveries to the amount since last query/activation.
IndustryList industries_near
Cached list of industries near the station that can accept cargo,.
SourceType
Types of cargo source and destination.
void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, SourceType src_type, SourceID src, const Station *st, IndustryID dest)
Cargo was delivered to its final destination, update the pickup and delivery maps.
static void ClearCargoMonitoring(CargoMonitorMap &cargo_monitor_map, CompanyID company=INVALID_OWNER)
Helper method for ClearCargoPickupMonitoring and ClearCargoDeliveryMonitoring.
void ClearCargoPickupMonitoring(CompanyID company)
Clear all pick-up cargo monitors.
static const SourceID INVALID_SOURCE
Invalid/unknown index of source.
byte CargoID
Cargo slots to indicate a cargo type within a game.
static int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
Get and reset the amount associated with a cargo monitor.
int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
Get the amount of cargo delivered for the given cargo monitor since activation or last query.