Class for storing amounts of cargo. More...
#include <cargo_type.h>
Public Member Functions | |
CargoArray () | |
Default constructor. | |
void | Clear () |
Reset all entries. | |
uint & | operator[] (CargoID cargo) |
Read/write access to an amount of a specific cargo type. | |
const uint & | operator[] (CargoID cargo) const |
Read-only access to an amount of a specific cargo type. | |
template<typename T > | |
const T | GetSum () const |
Get the sum of all cargo amounts. | |
byte | GetCount () const |
Get the amount of cargos that have an amount. | |
Private Attributes | |
uint | amount [NUM_CARGO] |
Amount of each type of cargo. |
Class for storing amounts of cargo.
Definition at line 74 of file cargo_type.h.
CargoArray::CargoArray | ( | ) | [inline] |
void CargoArray::Clear | ( | ) | [inline] |
Reset all entries.
Definition at line 86 of file cargo_type.h.
References amount.
Referenced by CargoArray(), and GetArticulatedVehicleCargoesAndRefits().
byte CargoArray::GetCount | ( | ) | const [inline] |
Get the amount of cargos that have an amount.
Definition at line 127 of file cargo_type.h.
References amount, and lengthof.
Referenced by UpdateCompanyRatingAndValue().
const T CargoArray::GetSum | ( | ) | const [inline] |
Get the sum of all cargo amounts.
Definition at line 114 of file cargo_type.h.
References amount, and lengthof.
Referenced by GetTotalCapacityOfArticulatedParts(), ServerNetworkAdminSocketHandler::SendCompanyEconomy(), and UpdateCompanyRatingAndValue().
const uint& CargoArray::operator[] | ( | CargoID | cargo | ) | const [inline] |
Read-only access to an amount of a specific cargo type.
cargo | Cargo type to access. |
Definition at line 104 of file cargo_type.h.
References amount.
uint& CargoArray::operator[] | ( | CargoID | cargo | ) | [inline] |
Read/write access to an amount of a specific cargo type.
cargo | Cargo type to access. |
Definition at line 95 of file cargo_type.h.
References amount.