summaryrefslogtreecommitdiff
path: root/src/subsidy_base.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-08-08 16:42:55 +0000
committersmatz <smatz@openttd.org>2009-08-08 16:42:55 +0000
commit2a430d981f680485b9d4f9e5fab8bc642952b9bf (patch)
treee37f617ae610677d7c92aad77b5f184545599102 /src/subsidy_base.h
parenteff8cb839072c3aa80d1e54b189810061160669a (diff)
downloadopenttd-2a430d981f680485b9d4f9e5fab8bc642952b9bf.tar.xz
(svn r17113) -Change [FS#265][FS#2094][FS#2589]: apply the subsidy when subsidy's destination is in station's catchment area and cargo packets originate from subsidy's source
-Change [FS#1134]: subsidies aren't bound to stations after awarding anymore, they still apply to town or industry, no matter what station is used for loading and unloading. Awarded subsidies from older savegames are lost -Change [NoAI]: due to these changes, AISubsidy::GetSource and AISubsidy::GetDestination now return STATION_INVALID for awarded subsidies
Diffstat (limited to 'src/subsidy_base.h')
-rw-r--r--src/subsidy_base.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/subsidy_base.h b/src/subsidy_base.h
index 1460c4eec..4750605bc 100644
--- a/src/subsidy_base.h
+++ b/src/subsidy_base.h
@@ -7,18 +7,17 @@
#include "cargo_type.h"
#include "company_type.h"
-#include "station_type.h"
-
-typedef uint16 SubsidyID; ///< ID of a subsidy
+#include "subsidy_type.h"
/** Struct about subsidies, offered and awarded */
struct Subsidy {
CargoID cargo_type; ///< Cargo type involved in this subsidy, CT_INVALID for invalid subsidy
- byte age; ///< Subsidy age; < 12 is unawarded, >= 12 is awarded
- SourceTypeByte src_type; ///< Source of subsidised path
- SourceTypeByte dst_type; ///< Destination of subsidised path
- uint16 src; ///< Index of source. Either TownID, IndustryID or StationID, when awarded
- uint16 dst; ///< Index of destination. Either TownID, IndustryID or StationID, when awarded
+ byte remaining; ///< Remaining months when this subsidy is valid
+ CompanyByte awarded; ///< Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone
+ SourceTypeByte src_type; ///< Source of subsidised path (ST_INDUSTRY or ST_TOWN)
+ SourceTypeByte dst_type; ///< Destination of subsidised path (ST_INDUSTRY or ST_TOWN)
+ SourceID src; ///< Index of source. Either TownID or IndustryID
+ SourceID dst; ///< Index of destination. Either TownID or IndustryID
/**
* Tests whether this subsidy has been awarded to someone
@@ -26,10 +25,10 @@ struct Subsidy {
*/
FORCEINLINE bool IsAwarded() const
{
- return this->age >= 12;
+ return this->awarded != INVALID_COMPANY;
}
- void AwardTo(StationID from, StationID to, CompanyID company);
+ void AwardTo(CompanyID company);
/**
* Determines index of this subsidy