31 cargo_monitor_map.clear();
35 CargoMonitorMap::iterator next;
36 for (CargoMonitorMap::iterator it = cargo_monitor_map.begin(); it != cargo_monitor_map.end(); it = next) {
40 cargo_monitor_map.erase(it);
74 CargoMonitorMap::iterator iter = monitor_map.find(monitor);
75 if (iter == monitor_map.end()) {
76 if (keep_monitoring) {
77 std::pair<CargoMonitorID, uint32> p(monitor, 0);
78 monitor_map.insert(p);
82 int32 result = iter->second;
84 if (!keep_monitoring) monitor_map.erase(iter);
124 if (amount == 0)
return;
155 if ((*ip)->index != dest)
continue;
Source/destination is a town.
IndustryVector industries_near
Cached list of industries near the station that can accept cargo,.
static void ClearCargoMonitoring(CargoMonitorMap &cargo_monitor_map, CompanyID company=INVALID_OWNER)
Helper method for ClearCargoPickupMonitoring and ClearCargoDeliveryMonitoring.
Defines the internal data of a functional industry.
const T * Begin() const
Get the pointer to the first item (const)
Tindex index
Index of this pool item.
Town * town
The town this station is associated with.
const T * End() const
Get the pointer behind the last valid item (const)
static const SourceID INVALID_SOURCE
Invalid/unknown index of source.
CargoMonitorMap _cargo_deliveries
Map of monitored deliveries to the amount since last query/activation.
static int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
Get and reset the amount associated with a cargo monitor.
std::map< CargoMonitorID, OverflowSafeInt32 > CargoMonitorMap
Map type for storing and updating active cargo monitor numbers and their amounts. ...
Definition of base types and functions in a cross-platform compatible way.
A number of safeguards to prevent using unsafe methods.
static CargoMonitorID EncodeCargoIndustryMonitor(CompanyID company, CargoID ctype, IndustryID ind)
Encode a cargo monitor for pickup or delivery at an industry.
void ClearCargoPickupMonitoring(CompanyID company)
Clear all pick-up cargo monitors.
void ClearCargoDeliveryMonitoring(CompanyID company)
Clear all delivery cargo monitors.
uint32 CargoMonitorID
Unique number for a company / cargo type / (town or industry).
SourceType
Types of cargo source and destination.
static CargoMonitorID EncodeCargoTownMonitor(CompanyID company, CargoID ctype, TownID town)
Encode a cargo monitoring number for pickup or delivery at a town.
CargoMonitorMap _cargo_pickups
Map of monitored pick-ups to the amount since last query/activation.
Source/destination is an industry.
uint16 SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
Cargo transport monitoring declarations.
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 CompanyID DecodeMonitorCompany(CargoMonitorID num)
Extract the company from the cargo monitor.
byte CargoID
Cargo slots to indicate a cargo type within a game.
Owner
Enum for all companies/owners.
Base classes/functions for stations.
int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
Get the amount of cargo picked up for the given cargo monitor since activation or last query...
int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
Get the amount of cargo delivered for the given cargo monitor since activation or last query...