script_cargo.hpp

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 SCRIPT_CARGO_HPP
00013 #define SCRIPT_CARGO_HPP
00014 
00015 #include "script_object.hpp"
00016 
00021 class ScriptCargo : public ScriptObject {
00022 public:
00026   enum CargoClass {
00027     CC_PASSENGERS   = 1 <<  0, 
00028     CC_MAIL         = 1 <<  1, 
00029     CC_EXPRESS      = 1 <<  2, 
00030     CC_ARMOURED     = 1 <<  3, 
00031     CC_BULK         = 1 <<  4, 
00032     CC_PIECE_GOODS  = 1 <<  5, 
00033     CC_LIQUID       = 1 <<  6, 
00034     CC_REFRIGERATED = 1 <<  7, 
00035     CC_HAZARDOUS    = 1 <<  8, 
00036     CC_COVERED      = 1 <<  9, 
00037   };
00038 
00042   enum TownEffect {
00043     TE_NONE       = 0, 
00044     TE_PASSENGERS = 1, 
00045     TE_MAIL       = 2, 
00046     TE_GOODS      = 3, 
00047     TE_WATER      = 4, 
00048     TE_FOOD       = 5, 
00049   };
00050 
00054   enum SpecialCargoID {
00055     CT_AUTO_REFIT = 0xFD, 
00056     CT_NO_REFIT   = 0xFE, 
00057   };
00058 
00064   static bool IsValidCargo(CargoID cargo_type);
00065 
00071   static bool IsValidTownEffect(TownEffect towneffect_type);
00072 
00081   static char *GetCargoLabel(CargoID cargo_type);
00082 
00091   static bool IsFreight(CargoID cargo_type);
00092 
00100   static bool HasCargoClass(CargoID cargo_type, CargoClass cargo_class);
00101 
00108   static TownEffect GetTownEffect(CargoID cargo_type);
00109 
00119   static Money GetCargoIncome(CargoID cargo_type, uint32 distance, uint32 days_in_transit);
00120 };
00121 
00122 #endif /* SCRIPT_CARGO_HPP */