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