author | truebrain |
Sat, 07 Jun 2008 23:05:36 +0000 | |
branch | noai |
changeset 10853 | 87f2238f47d4 |
parent 10344 | b7e9f5c65e30 |
child 10855 | 90904faa1890 |
permissions | -rw-r--r-- |
10344
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
1 |
/* $Id$ */ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
2 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
3 |
/** @file ai_subsidy.hpp Everything to query subsidies. */ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
4 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
5 |
#ifndef AI_SUBSIDY_HPP |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
6 |
#define AI_SUBSIDY_HPP |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
7 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
8 |
#include "ai_object.hpp" |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
9 |
#include "ai_company.hpp" |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
10 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
11 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
12 |
* Class that handles all subsidy related functions. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
13 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
14 |
class AISubsidy : public AIObject { |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
15 |
public: |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
16 |
static const char *GetClassName() { return "AISubsidy"; } |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
17 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
18 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
19 |
* Check whether this is a valid SubsidyID. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
20 |
* @param subsidy_id The SubsidyID to check. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
21 |
* @return True if and only if this subsidy is still valid. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
22 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
23 |
static bool IsValidSubsidy(SubsidyID subsidy_id); |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
24 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
25 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
26 |
* Checks whether this subsidy is already awarded to some company. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
27 |
* @param subsidy_id The SubsidyID to check. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
28 |
* @pre IsValidSubsidy(subsidy). |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
29 |
* @return True if and only if this subsidy is already awarded. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
30 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
31 |
static bool IsAwarded(SubsidyID subsidy_id); |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
32 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
33 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
34 |
* Get the company index of the company this subsidy is awarded to. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
35 |
* @param subsidy_id The SubsidyID to check. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
36 |
* @pre IsAwarded(subsidy_id). |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
37 |
* @return The companyindex of the company this subsidy is awarded to. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
38 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
39 |
static AICompany::CompanyIndex GetAwardedTo(SubsidyID subsidy_id); |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
40 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
41 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
42 |
* Get the date this subsidy expires. In case the subsidy is already |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
43 |
* awarded, return the date the subsidy expires, else, return the date the |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
44 |
* offer expires. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
45 |
* @param subsidy_id The SubsidyID to check. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
46 |
* @pre IsValidSubsidy(subsidy_id). |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
47 |
* @return The last valid date of this subsidy. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
48 |
* @note The return value of this function will change if the subsidy is |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
49 |
* awarded. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
50 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
51 |
static int32 GetExpireDate(SubsidyID subsidy_id); |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
52 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
53 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
54 |
* Get the cargo type that has to be transported in order to be awarded this |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
55 |
* subsidy. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
56 |
* @param subsidy_id The SubsidyID to check. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
57 |
* @pre IsValidSubsidy(subsidy_id). |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
58 |
* @return The cargo type to transport. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
59 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
60 |
static CargoID GetCargoType(SubsidyID subsidy_id); |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
61 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
62 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
63 |
* Is the source of the subsidy a town or an industry. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
64 |
* @param subsidy_id The SubsidyID to check. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
65 |
* @pre IsValidSubsidy(subsidy_id) && !IsAwarded(subsidy_id). |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
66 |
* @return True if the source is a town, false if it is an industry. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
67 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
68 |
static bool SourceIsTown(SubsidyID subsidy_id); |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
69 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
70 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
71 |
* Return the source TownID/IndustryID/StationID the subsidy is for. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
72 |
* 1) IsAwarded(subsidy_id) -> return the StationID the subsidy is awarded to. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
73 |
* 2) !IsAwarded(subsidy_id) && SourceIsTown(subsidy_id) -> return the TownID. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
74 |
* 3) !IsAwarded(subsidy_id) && !SourceIsTown(subsidy_id) -> return the IndustryID. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
75 |
* @param subsidy_id The SubsidyID to check. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
76 |
* @pre IsValidSubsidy(subsidy_id). |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
77 |
* @return One of TownID/IndustryID/StationID. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
78 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
79 |
static int32 GetSource(SubsidyID subsidy_id); |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
80 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
81 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
82 |
* Is the destination of the subsidy a town or an industry. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
83 |
* @param subsidy_id The SubsidyID to check. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
84 |
* @pre IsValidSubsidy(subsidy_id) && !IsAwarded(subsidy_id). |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
85 |
* @return True if the destination is a town, false if it is an industry. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
86 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
87 |
static bool DestinationIsTown(SubsidyID subsidy_id); |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
88 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
89 |
/** |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
90 |
* Return the destination TownID/IndustryID/StationID the subsidy is for. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
91 |
* 1) IsAwarded(subsidy_id) -> return the StationID the subsidy is awarded to. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
92 |
* 2) !IsAwarded(subsidy_id) && SourceIsTown(subsidy_id) -> return the TownID. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
93 |
* 3) !IsAwarded(subsidy_id) && !SourceIsTown(subsidy_id) -> return the IndustryID. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
94 |
* @param subsidy_id the SubsidyID to check. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
95 |
* @pre IsValidSubsidy(subsidy_id). |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
96 |
* @return One of TownID/IndustryID/StationID. |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
97 |
*/ |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
98 |
static int32 GetDestination(SubsidyID subsidy_id); |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
99 |
}; |
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
100 |
|
b7e9f5c65e30
(svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents:
diff
changeset
|
101 |
#endif /* AI_SUBSIDY_HPP */ |