script_cargo.hpp

Go to the documentation of this file.
00001 /* $Id: script_cargo.hpp 23614 2011-12-19 20:57:23Z truebrain $ */
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 #include "../../cargotype.h"
00017 #include "../../cargo_type.h"
00018 
00023 class ScriptCargo : public ScriptObject {
00024 public:
00028   enum CargoClass {
00029     /* Note: these values represent part of the in-game CargoClass enum */
00030     CC_PASSENGERS   = ::CC_PASSENGERS,   
00031     CC_MAIL         = ::CC_MAIL,         
00032     CC_EXPRESS      = ::CC_EXPRESS,      
00033     CC_ARMOURED     = ::CC_ARMOURED,     
00034     CC_BULK         = ::CC_BULK,         
00035     CC_PIECE_GOODS  = ::CC_PIECE_GOODS,  
00036     CC_LIQUID       = ::CC_LIQUID,       
00037     CC_REFRIGERATED = ::CC_REFRIGERATED, 
00038     CC_HAZARDOUS    = ::CC_HAZARDOUS,    
00039     CC_COVERED      = ::CC_COVERED,      
00040   };
00041 
00045   enum TownEffect {
00046     /* Note: these values represent part of the in-game TownEffect enum */
00047     TE_NONE       = ::TE_NONE,       
00048     TE_PASSENGERS = ::TE_PASSENGERS, 
00049     TE_MAIL       = ::TE_MAIL,       
00050     TE_GOODS      = ::TE_GOODS,      
00051     TE_WATER      = ::TE_WATER,      
00052     TE_FOOD       = ::TE_FOOD,       
00053   };
00054 
00058   enum SpecialCargoID {
00059     /* Note: these values represent part of the in-game CargoTypes enum */
00060     CT_AUTO_REFIT = ::CT_AUTO_REFIT, 
00061     CT_NO_REFIT   = ::CT_NO_REFIT,   
00062   };
00063 
00069   static bool IsValidCargo(CargoID cargo_type);
00070 
00076   static bool IsValidTownEffect(TownEffect towneffect_type);
00077 
00086   static char *GetCargoLabel(CargoID cargo_type);
00087 
00096   static bool IsFreight(CargoID cargo_type);
00097 
00105   static bool HasCargoClass(CargoID cargo_type, CargoClass cargo_class);
00106 
00113   static TownEffect GetTownEffect(CargoID cargo_type);
00114 
00124   static Money GetCargoIncome(CargoID cargo_type, uint32 distance, uint32 days_in_transit);
00125 };
00126 
00127 #endif /* SCRIPT_CARGO_HPP */