00001 /* $Id: subsidy_base.h 23704 2012-01-01 17:22:32Z alberth $ */ 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 SUBSIDY_BASE_H 00013 #define SUBSIDY_BASE_H 00014 00015 #include "cargo_type.h" 00016 #include "company_type.h" 00017 #include "subsidy_type.h" 00018 #include "core/pool_type.hpp" 00019 00020 typedef Pool<Subsidy, SubsidyID, 1, 256> SubsidyPool; 00021 extern SubsidyPool _subsidy_pool; 00022 00024 struct Subsidy : SubsidyPool::PoolItem<&_subsidy_pool> { 00025 CargoID cargo_type; 00026 byte remaining; 00027 CompanyByte awarded; 00028 SourceTypeByte src_type; 00029 SourceTypeByte dst_type; 00030 SourceID src; 00031 SourceID dst; 00032 00036 inline Subsidy() { } 00037 00041 inline ~Subsidy() { } 00042 00047 inline bool IsAwarded() const 00048 { 00049 return this->awarded != INVALID_COMPANY; 00050 } 00051 00052 void AwardTo(CompanyID company); 00053 }; 00054 00056 static const uint SUBSIDY_OFFER_MONTHS = 12; 00057 static const uint SUBSIDY_CONTRACT_MONTHS = 12; 00058 static const uint SUBSIDY_PAX_MIN_POPULATION = 400; 00059 static const uint SUBSIDY_CARGO_MIN_POPULATION = 900; 00060 static const uint SUBSIDY_MAX_PCT_TRANSPORTED = 42; 00061 static const uint SUBSIDY_MAX_DISTANCE = 70; 00062 00063 #define FOR_ALL_SUBSIDIES_FROM(var, start) FOR_ALL_ITEMS_FROM(Subsidy, subsidy_index, var, start) 00064 #define FOR_ALL_SUBSIDIES(var) FOR_ALL_SUBSIDIES_FROM(var, 0) 00065 00066 #endif /* SUBSIDY_BASE_H */