diff options
author | truebrain <truebrain@openttd.org> | 2009-01-12 17:11:45 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2009-01-12 17:11:45 +0000 |
commit | c2406cd42d481a697602b430111a9e59af61660f (patch) | |
tree | ced1a262eb143ad6e64ec02f4a4c89835c0c32fd /src/ai/api/ai_industrytype.hpp | |
parent | ec97e1fd0d6ca942805fa25d94007437bc0ed952 (diff) | |
download | openttd-c2406cd42d481a697602b430111a9e59af61660f.tar.xz |
(svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
NoAI is an API (a framework) to build your own AIs in. See:
http://wiki.openttd.org/wiki/index.php/AI:Main_Page
With many thanks to:
- glx and Rubidium for their syncing, feedback and hard work
- Yexo for his feedback, patches, and AIs which tested the system very deep
- Morloth for his feedback and patches
- TJIP for hosting a challenge which kept NoAI on track
- All AI authors for testing our AI API, and all other people who helped in one way or another
-Remove: all old AIs and their cheats/hacks
Diffstat (limited to 'src/ai/api/ai_industrytype.hpp')
-rw-r--r-- | src/ai/api/ai_industrytype.hpp | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/ai/api/ai_industrytype.hpp b/src/ai/api/ai_industrytype.hpp new file mode 100644 index 000000000..88ba6d730 --- /dev/null +++ b/src/ai/api/ai_industrytype.hpp @@ -0,0 +1,114 @@ +/* $Id$ */ + +/** @file ai_industrytype.hpp Everything to query and build industries. */ + +#ifndef AI_INDUSTRYTYPE_HPP +#define AI_INDUSTRYTYPE_HPP + +#include "ai_object.hpp" +#include "ai_error.hpp" +#include "ai_list.hpp" + +/** + * Class that handles all industry-type related functions. + */ +class AIIndustryType : public AIObject { +public: + static const char *GetClassName() { return "AIIndustryType"; } + + /** + * Checks whether the given industry-type is valid. + * @param industry_type The type check. + * @return True if and only if the industry-type is valid. + */ + static bool IsValidIndustryType(IndustryType industry_type); + + /** + * Get the name of an industry-type. + * @param industry_type The type to get the name for. + * @pre IsValidIndustryType(industry_type). + * @return The name of an industry. + */ + static const char *GetName(IndustryType industry_type); + + /** + * Get a list of CargoID possible produced by this industry-type. + * @param industry_type The type to get the CargoIDs for. + * @pre IsValidIndustryType(industry_type). + * @return The CargoIDs of all cargotypes this industry could produce. + */ + static AIList *GetProducedCargo(IndustryType industry_type); + + /** + * Get a list of CargoID accepted by this industry-type. + * @param industry_type The type to get the CargoIDs for. + * @pre IsValidIndustryType(industry_type). + * @return The CargoIDs of all cargotypes this industry accepts. + */ + static AIList *GetAcceptedCargo(IndustryType industry_type); + + /** + * Is this industry type a raw industry? + * @param industry_type The type of the industry. + * @pre IsValidIndustryType(industry_type). + * @return True if it should be handled as a raw industry. + */ + static bool IsRawIndustry(IndustryType industry_type); + + /** + * Can the production of this industry increase? + * @param industry_type The type of the industry. + * @pre IsValidIndustryType(industry_type). + * @return True if the production of this industry can increase. + */ + static bool ProductionCanIncrease(IndustryType industry_type); + + /** + * Get the cost for building this industry-type. + * @param industry_type The type of the industry. + * @pre IsValidIndustryType(industry_type). + * @return The cost for building this industry-type. + */ + static Money GetConstructionCost(IndustryType industry_type); + + /** + * Can you build this type of industry? + * @param industry_type The type of the industry. + * @pre IsValidIndustryType(industry_type). + * @return True if you can prospect this type of industry. + * @note Returns false if you can only prospect this type of industry. + */ + static bool CanBuildIndustry(IndustryType industry_type); + + /** + * Can you prospect this type of industry? + * @param industry_type The type of the industry. + * @pre IsValidIndustryType(industry_type). + * @return True if you can prospect this type of industry. + * @note If the patch setting "Manual primary industry construction method" is set + * to either "None" or "as other industries" this function always returns false. + */ + static bool CanProspectIndustry(IndustryType industry_type); + + /** + * Build an industry of the specified type. + * @param industry_type The type of the industry to build. + * @param tile The tile to build the industry on. + * @pre CanBuildIndustry(industry_type). + * @return True if the industry was succesfully build. + */ + static bool BuildIndustry(IndustryType industry_type, TileIndex tile); + + /** + * Prospect an industry of this type. Prospecting an industries let the game try to create + * an industry on a random place on the map. + * @param industry_type The type of the industry. + * @pre CanProspectIndustry(industry_type). + * @return True if no error occured while trying to prospect. + * @note Even if true is returned there is no guarantee a new industry is build. + * @note If true is returned the money is paid, whether a new industry was build or not. + */ + static bool ProspectIndustry(IndustryType industry_type); +}; + +#endif /* AI_INDUSTRYTYPE_HPP */ |