00001 /* $Id: script_subsidy.hpp 23628 2011-12-19 21:01:12Z 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_SUBSIDY_HPP 00013 #define SCRIPT_SUBSIDY_HPP 00014 00015 #include "script_company.hpp" 00016 00021 class ScriptSubsidy : public ScriptObject { 00022 public: 00027 enum SubsidyParticipantType { 00028 /* Values are important, as they represent the internal state of the game. 00029 * It is orignally named SourceType. ST_HEADQUARTERS is intentionally 00030 * left out, as it cannot be used for Subsidies. */ 00031 SPT_INDUSTRY = 0, 00032 SPT_TOWN = 1, 00033 SPT_INVALID = 0xFF, 00034 }; 00035 00041 static bool IsValidSubsidy(SubsidyID subsidy_id); 00042 00049 static bool IsAwarded(SubsidyID subsidy_id); 00050 00066 static bool Create(CargoID cargo_type, SubsidyParticipantType from_type, uint16 from_id, SubsidyParticipantType to_type, uint16 to_id); 00067 00074 static ScriptCompany::CompanyID GetAwardedTo(SubsidyID subsidy_id); 00075 00086 static int32 GetExpireDate(SubsidyID subsidy_id); 00087 00095 static CargoID GetCargoType(SubsidyID subsidy_id); 00096 00103 static SubsidyParticipantType GetSourceType(SubsidyID subsidy_id); 00104 00113 static int32 GetSourceIndex(SubsidyID subsidy_id); 00114 00121 static SubsidyParticipantType GetDestinationType(SubsidyID subsidy_id); 00122 00131 static int32 GetDestinationIndex(SubsidyID subsidy_id); 00132 }; 00133 00134 #endif /* SCRIPT_SUBSIDY_HPP */