|
1 /* $Id$ */ |
|
2 |
|
3 /** @file ai_industry.hpp Everything to query about industries */ |
|
4 |
|
5 #ifndef AI_INDUSTRY_HPP |
|
6 #define AI_INDUSTRY_HPP |
|
7 |
|
8 #include "ai_object.hpp" |
|
9 |
|
10 class AIIndustry : public AIObject { |
|
11 public: |
|
12 /** |
|
13 * Gets the maximum industry index; there are no valid industries with a higher index |
|
14 * @return the maximum town index |
|
15 * @post return >= 0 |
|
16 */ |
|
17 IndustryID GetMaxIndustryID(); |
|
18 |
|
19 /** |
|
20 * Gets the number of industries |
|
21 * @return the number of industries |
|
22 * @post return >= 0 |
|
23 */ |
|
24 int32 GetIndustryCount(); |
|
25 |
|
26 /** |
|
27 * Checks whether the given industry index is valid |
|
28 * @param industry_id the index to check |
|
29 * @return true if and only if the industry is valid |
|
30 */ |
|
31 bool IsValidIndustry(IndustryID industry_id); |
|
32 |
|
33 /** |
|
34 * Get the name of the industry |
|
35 * @param industry_id the industry to get the name of |
|
36 * @pre this->IsValidIndustry(industry_id) |
|
37 * @return the name of the industry |
|
38 * @note the returned name must be freed |
|
39 */ |
|
40 char *GetName(IndustryID industry_id); |
|
41 |
|
42 /** |
|
43 * Gets the location of the industry |
|
44 * @param industry_id the location of the industry |
|
45 * @pre this->IsValidIndustry(industry_id) |
|
46 * @return the location of the industry |
|
47 * @post return >= 0 |
|
48 */ |
|
49 TileIndex GetLocation(IndustryID industry_id); |
|
50 }; |
|
51 |
|
52 #ifdef SQUIRREL_CLASS |
|
53 void SQAIIndustryRegister(SquirrelEngine *engine) { |
|
54 DefSQClass <AIIndustry> SQAIIndustry("AIIndustry"); |
|
55 SQAIIndustry.PreRegister(engine); |
|
56 SQAIIndustry.AddConstructor(engine); |
|
57 SQAIIndustry.DefSQFunction(engine, &AIIndustry::GetMaxIndustryID, "GetMaxIndustryID"); |
|
58 SQAIIndustry.DefSQFunction(engine, &AIIndustry::GetIndustryCount, "GetIndustryCount"); |
|
59 SQAIIndustry.DefSQFunction(engine, &AIIndustry::IsValidIndustry, "IsValidIndustry"); |
|
60 SQAIIndustry.DefSQFunction(engine, &AIIndustry::GetName, "GetName"); |
|
61 SQAIIndustry.DefSQFunction(engine, &AIIndustry::GetLocation, "GetLocation"); |
|
62 SQAIIndustry.PostRegister(engine); |
|
63 } |
|
64 #endif /* SQUIRREL_CLASS */ |
|
65 |
|
66 #endif /* AI_INDUSTRY_HPP */ |