subsidy_base.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
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, MAX_COMPANIES> 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 FORCEINLINE Subsidy() { }
00037
00041 FORCEINLINE ~Subsidy() { }
00042
00047 FORCEINLINE bool IsAwarded() const
00048 {
00049 return this->awarded != INVALID_COMPANY;
00050 }
00051
00052 void AwardTo(CompanyID company);
00053 };
00054
00056 enum {
00057 SUBSIDY_OFFER_MONTHS = 12,
00058 SUBSIDY_CONTRACT_MONTHS = 12,
00059 SUBSIDY_PAX_MIN_POPULATION = 400,
00060 SUBSIDY_CARGO_MIN_POPULATION = 900,
00061 SUBSIDY_MAX_PCT_TRANSPORTED = 42,
00062 SUBSIDY_MAX_DISTANCE = 70,
00063 };
00064
00065 #define FOR_ALL_SUBSIDIES_FROM(var, start) FOR_ALL_ITEMS_FROM(Subsidy, subsidy_index, var, start)
00066 #define FOR_ALL_SUBSIDIES(var) FOR_ALL_SUBSIDIES_FROM(var, 0)
00067
00068 #endif