12 #ifndef CARGOMONITOR_H 13 #define CARGOMONITOR_H void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, SourceType src_type, SourceID src, const Station *st)
Cargo was delivered to its final destination, update the pickup and delivery maps.
Start bit of the cargo type field.
CargoMonitorMap _cargo_pickups
Map of monitored pick-ups to the amount since last query/activation.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
static bool MonitorMonitorsIndustry(CargoMonitorID num)
Does the cargo number monitor an industry or a town?
Start bit of the company field.
An overflow safe integer-like type.
static CargoID DecodeMonitorCargoType(CargoMonitorID num)
Extract the cargo type from the cargo monitor.
Town * town
The town this station is associated with.
Types related to cargoes...
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
Bit indicating the town/industry number is an industry.
Value of the CCB_IS_INDUSTRY_BIT bit.
CargoCompanyBits
Constants for encoding and extracting cargo monitors.
std::map< CargoMonitorID, OverflowSafeInt32 > CargoMonitorMap
Map type for storing and updating active cargo monitor numbers and their amounts. ...
static CargoMonitorID EncodeCargoIndustryMonitor(CompanyID company, CargoID ctype, IndustryID ind)
Encode a cargo monitor for pickup or delivery at an industry.
CargoMonitorMap _cargo_deliveries
Map of monitored deliveries to the amount since last query/activation.
Number of bits of the cargo type field.
void ClearCargoDeliveryMonitoring(CompanyID company=INVALID_OWNER)
Clear all delivery cargo monitors.
int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
Get the amount of cargo picked up for the given cargo monitor since activation or last query...
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.
Start bit of the town or industry number.
Functions related to companies.
static IndustryID DecodeMonitorIndustry(CargoMonitorID num)
Extract the industry number from the cargo monitor.
uint16 SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
Number of bits of the town or industry number.
static CompanyID DecodeMonitorCompany(CargoMonitorID num)
Extract the company from the cargo monitor.
Number of bits of the company field.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
Get the amount of cargo delivered for the given cargo monitor since activation or last query...
byte CargoID
Cargo slots to indicate a cargo type within a game.
Owner
Enum for all companies/owners.
static TownID DecodeMonitorTown(CargoMonitorID num)
Extract the town number from the cargo monitor.
void ClearCargoPickupMonitoring(CompanyID company=INVALID_OWNER)
Clear all pick-up cargo monitors.