29 cargo_monitor_map.clear();
33 for (
auto it = cargo_monitor_map.begin(); it != cargo_monitor_map.end(); ) {
35 it = cargo_monitor_map.erase(it);
71 CargoMonitorMap::iterator iter = monitor_map.find(monitor);
72 if (iter == monitor_map.end()) {
73 if (keep_monitoring) {
74 monitor_map.emplace(monitor, 0);
78 int32_t result = iter->second;
80 if (!keep_monitoring) monitor_map.erase(iter);
120 if (amount == 0)
return;
151 if (i.industry->index != dest)
continue;
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
uint16_t SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
static const SourceID INVALID_SOURCE
Invalid/unknown index of source.
SourceType
Types of cargo source and destination.
@ Industry
Source/destination is an industry.
@ Town
Source/destination is a town.
void ClearCargoDeliveryMonitoring(CompanyID company)
Clear all delivery cargo monitors.
static void ClearCargoMonitoring(CargoMonitorMap &cargo_monitor_map, CompanyID company=INVALID_OWNER)
Helper method for ClearCargoPickupMonitoring and ClearCargoDeliveryMonitoring.
CargoMonitorMap _cargo_deliveries
Map of monitored deliveries to the amount since last query/activation.
int32_t GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
Get the amount of cargo picked up for the given cargo monitor since activation or last query.
int32_t GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
Get the amount of cargo delivered for the given cargo monitor since activation or last query.
CargoMonitorMap _cargo_pickups
Map of monitored pick-ups to the amount since last query/activation.
void ClearCargoPickupMonitoring(CompanyID company)
Clear all pick-up cargo monitors.
static int32_t GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
Get and reset the amount associated with a cargo monitor.
void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32_t amount, SourceType src_type, SourceID src, const Station *st, IndustryID dest)
Cargo was delivered to its final destination, update the pickup and delivery maps.
Cargo transport monitoring declarations.
CargoMonitorID EncodeCargoTownMonitor(CompanyID company, CargoID ctype, TownID town)
Encode a cargo monitoring number for pickup or delivery at a town.
uint32_t CargoMonitorID
Unique number for a company / cargo type / (town or industry).
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.
CompanyID DecodeMonitorCompany(CargoMonitorID num)
Extract the company from the cargo monitor.
Owner
Enum for all companies/owners.
@ INVALID_OWNER
An invalid owner.
A number of safeguards to prevent using unsafe methods.
Base classes/functions for stations.
Definition of base types and functions in a cross-platform compatible way.
Town * town
The town this station is associated with.
Tindex index
Index of this pool item.
IndustryList industries_near
Cached list of industries near the station that can accept cargo,.