5 #ifndef AI_INDUSTRY_HPP |
5 #ifndef AI_INDUSTRY_HPP |
6 #define AI_INDUSTRY_HPP |
6 #define AI_INDUSTRY_HPP |
7 |
7 |
8 #include "ai_object.hpp" |
8 #include "ai_object.hpp" |
9 |
9 |
|
10 /** |
|
11 * Class that handles all industry related functions. |
|
12 */ |
10 class AIIndustry : public AIObject { |
13 class AIIndustry : public AIObject { |
11 public: |
14 public: |
12 /** |
15 /** |
13 * Gets the maximum industry index; there are no valid industries with a higher index |
16 * Gets the maximum industry index; there are no valid industries with a |
14 * @return the maximum town index |
17 * higher index. |
15 * @post return >= 0 |
18 * @return the maximum industry index. |
|
19 * @post return value is always non-negative. |
16 */ |
20 */ |
17 IndustryID GetMaxIndustryID(); |
21 IndustryID GetMaxIndustryID(); |
18 |
22 |
19 /** |
23 /** |
20 * Gets the number of industries |
24 * Gets the number of industries. This is different than GetMaxIndustryID() |
21 * @return the number of industries |
25 * because of the way OpenTTD works internally. |
22 * @post return >= 0 |
26 * @return the number of industries. |
|
27 * @post return value is always non-negative. |
23 */ |
28 */ |
24 int32 GetIndustryCount(); |
29 int32 GetIndustryCount(); |
25 |
30 |
26 /** |
31 /** |
27 * Checks whether the given industry index is valid |
32 * Checks whether the given industry index is valid. |
28 * @param industry_id the index to check |
33 * @param industry_id the index to check. |
29 * @return true if and only if the industry is valid |
34 * @return true if and only if the industry is valid. |
30 */ |
35 */ |
31 bool IsValidIndustry(IndustryID industry_id); |
36 bool IsValidIndustry(IndustryID industry_id); |
32 |
37 |
33 /** |
38 /** |
34 * Get the name of the industry |
39 * Get the name of the industry. |
35 * @param industry_id the industry to get the name of |
40 * @param industry_id the industry to get the name of. |
36 * @pre this->IsValidIndustry(industry_id) |
41 * @pre industry_id has to be valid (use IsValidIndustry()). |
37 * @return the name of the industry |
42 * @return the name of the industry. |
38 * @note the returned name must be freed |
43 * @note the returned name must be free'd (C++ only). |
39 */ |
44 */ |
40 char *GetName(IndustryID industry_id); |
45 char *GetName(IndustryID industry_id); |
41 |
46 |
42 /** |
47 /** |
43 * Gets the location of the industry |
48 * Gets the location of the industry. |
44 * @param industry_id the location of the industry |
49 * @param industry_id the location of the industry. |
45 * @pre this->IsValidIndustry(industry_id) |
50 * @pre industry_id has to be valid (use IsValidIndustry()). |
46 * @return the location of the industry |
51 * @return the location of the industry. |
47 * @post return >= 0 |
52 * @post return value is always positive and below AIMap::GetMapSize(). |
48 */ |
53 */ |
49 TileIndex GetLocation(IndustryID industry_id); |
54 TileIndex GetLocation(IndustryID industry_id); |
50 }; |
55 }; |
51 |
56 |
52 #ifdef DEFINE_SQUIRREL_CLASS |
57 #ifdef DEFINE_SQUIRREL_CLASS |