|
OpenTTD Source
14.0-beta3
|
Go to the documentation of this file.
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 std::pair<CargoMonitorID, uint32_t> p(monitor, 0);
75 monitor_map.insert(p);
79 int32_t result = iter->second;
81 if (!keep_monitoring) monitor_map.erase(iter);
121 if (amount == 0)
return;
152 if (i.industry->index != dest)
continue;
static int32_t 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.
Town * town
The town this station is associated with.
void ClearCargoDeliveryMonitoring(CompanyID company)
Clear all delivery cargo monitors.
CargoMonitorID EncodeCargoTownMonitor(CompanyID company, CargoID ctype, TownID town)
Encode a cargo monitoring number for pickup or delivery at a town.
Tindex index
Index of this pool item.
Owner
Enum for all companies/owners.
CargoMonitorID EncodeCargoIndustryMonitor(CompanyID company, CargoID ctype, IndustryID ind)
Encode a cargo monitor for pickup or delivery at an industry.
@ INVALID_OWNER
An invalid owner.
CargoMonitorMap _cargo_pickups
Map of monitored pick-ups to the amount since last query/activation.
uint16_t SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
byte CargoID
Cargo slots to indicate a cargo type within a game.
@ Industry
Source/destination is an industry.
@ Town
Source/destination is a town.
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.
static void ClearCargoMonitoring(CargoMonitorMap &cargo_monitor_map, CompanyID company=INVALID_OWNER)
Helper method for ClearCargoPickupMonitoring and ClearCargoDeliveryMonitoring.
int32_t GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
Get the amount of cargo delivered for the given cargo monitor since activation or last query.
void ClearCargoPickupMonitoring(CompanyID company)
Clear all pick-up cargo monitors.
static const SourceID INVALID_SOURCE
Invalid/unknown index of source.
CompanyID DecodeMonitorCompany(CargoMonitorID num)
Extract the company from the 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.
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.
uint32_t CargoMonitorID
Unique number for a company / cargo type / (town or industry).