# cargo_type.h

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef CARGO_TYPE_H
    00013 #define CARGO_TYPE_H
    00014
    00015 #include "core/enum_type.hpp"
    00016
    00022 typedef byte CargoID;
    00023
    00025 enum CargoTypes {
    00026   /* Temperate */
    00027   CT_PASSENGERS   =  0,
    00028   CT_COAL         =  1,
    00029   CT_MAIL         =  2,
    00030   CT_OIL          =  3,
    00031   CT_LIVESTOCK    =  4,
    00032   CT_GOODS        =  5,
    00033   CT_GRAIN        =  6,
    00034   CT_WOOD         =  7,
    00035   CT_IRON_ORE     =  8,
    00036   CT_STEEL        =  9,
    00037   CT_VALUABLES    = 10,
    00038
    00039   /* Arctic */
    00040   CT_WHEAT        =  6,
    00041   CT_HILLY_UNUSED =  8,
    00042   CT_PAPER        =  9,
    00043   CT_GOLD         = 10,
    00044   CT_FOOD         = 11,
    00045
    00046   /* Tropic */
    00047   CT_RUBBER       =  1,
    00048   CT_FRUIT        =  4,
    00049   CT_MAIZE        =  6,
    00050   CT_COPPER_ORE   =  8,
    00051   CT_WATER        =  9,
    00052   CT_DIAMONDS     = 10,
    00053
    00054   /* Toyland */
    00055   CT_SUGAR        =  1,
    00056   CT_TOYS         =  3,
    00057   CT_BATTERIES    =  4,
    00058   CT_CANDY        =  5,
    00059   CT_TOFFEE       =  6,
    00060   CT_COLA         =  7,
    00061   CT_COTTON_CANDY =  8,
    00062   CT_BUBBLES      =  9,
    00063   CT_PLASTIC      = 10,
    00064   CT_FIZZY_DRINKS = 11,
    00065
    00066   NUM_CARGO       = 32,
    00067
    00068   CT_NO_REFIT     = 0xFE,
    00069   CT_INVALID      = 0xFF,
    00070 };
    00071
    00073 struct CargoArray {
    00074 private:
    00075   uint amount[NUM_CARGO];
    00076
    00077 public:
    00079   FORCEINLINE CargoArray()
    00080   {
    00081     this->Clear();
    00082   }
    00083
    00085   FORCEINLINE void Clear()
    00086   {
    00087     memset(this->amount, 0, sizeof(this->amount));
    00088   }
    00089
    00094   FORCEINLINE uint &operator[](CargoID cargo)
    00095   {
    00096     return this->amount[cargo];
    00097   }
    00098
    00103   FORCEINLINE const uint &operator[](CargoID cargo) const
    00104   {
    00105     return this->amount[cargo];
    00106   }
    00107 };
    00108
    00109
    00111 enum SourceType {
    00112   ST_INDUSTRY,
    00113   ST_TOWN,
    00114   ST_HEADQUARTERS,
    00115 };
    00116 typedef SimpleTinyEnumT<SourceType, byte> SourceTypeByte;
    00117
    00118 typedef uint16 SourceID;
    00119 static const SourceID INVALID_SOURCE = 0xFFFF;
    00120
    00121 #endif /* CARGO_TYPE_H */