summaryrefslogtreecommitdiff
path: root/src/cargo_type.h
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-12-05 21:39:28 +0000
committeralberth <alberth@openttd.org>2009-12-05 21:39:28 +0000
commit41d2214e7e5a72be58e1b97a7f5f04a1b4b6660b (patch)
tree91d859e91169cf51c32960784114923f3bc6bccf /src/cargo_type.h
parent29606c0de66de3c40074eb086410ef39951e0d86 (diff)
downloadopenttd-41d2214e7e5a72be58e1b97a7f5f04a1b4b6660b.tar.xz
(svn r18413) -Doc: Added doxygen strings for cargo-type related enums, structs, and functions.
Diffstat (limited to 'src/cargo_type.h')
-rw-r--r--src/cargo_type.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/cargo_type.h b/src/cargo_type.h
index 8706b4373..8d9a1a825 100644
--- a/src/cargo_type.h
+++ b/src/cargo_type.h
@@ -14,6 +14,11 @@
#include "core/enum_type.hpp"
+/**
+ * Cargo slots to indicate a cargo type within a game.
+ * Numbers are re-used between different climates.
+ * @see CargoTypes
+ */
typedef byte CargoID;
/** Available types of cargo */
@@ -58,33 +63,41 @@ enum CargoTypes {
CT_PLASTIC = 10,
CT_FIZZY_DRINKS = 11,
- NUM_CARGO = 32,
+ NUM_CARGO = 32, ///< Maximal number of cargo types in a game.
- CT_NO_REFIT = 0xFE,
- CT_INVALID = 0xFF
+ CT_NO_REFIT = 0xFE, ///< Do not refit cargo of a vehicle (used in vehicle orders and auto-replace/auto-new).
+ CT_INVALID = 0xFF, ///< Invalid cargo type.
};
/** Class for storing amounts of cargo */
struct CargoArray {
private:
- uint amount[NUM_CARGO];
+ uint amount[NUM_CARGO]; ///< Amount of each type of cargo.
public:
+ /** Default constructor. */
FORCEINLINE CargoArray()
{
this->Clear();
}
+ /** Reset all entries. */
FORCEINLINE void Clear()
{
memset(this->amount, 0, sizeof(this->amount));
}
+ /** Read/write access to an amount of a specific cargo type.
+ * @param cargo Cargo type to access.
+ */
FORCEINLINE uint &operator[](CargoID cargo)
{
return this->amount[cargo];
}
+ /** Read-only access to an amount of a specific cargo type.
+ * @param cargo Cargo type to access.
+ */
FORCEINLINE const uint &operator[](CargoID cargo) const
{
return this->amount[cargo];