rubidium@9405: /* $Id$ */ rubidium@9405: rubidium@9405: /** @file ai_industry.hpp Everything to query about industries */ rubidium@9405: rubidium@9405: #ifndef AI_INDUSTRY_HPP rubidium@9405: #define AI_INDUSTRY_HPP rubidium@9405: rubidium@9405: #include "ai_object.hpp" rubidium@9723: #include "../../industry.h" rubidium@9405: truelight@9448: /** truelight@9448: * Class that handles all industry related functions. truelight@9448: */ rubidium@9405: class AIIndustry : public AIObject { rubidium@9405: public: rubidium@9405: /** truelight@9529: * The name of the class, needed by several sub-processes. truelight@9529: */ truelight@9529: static const char *GetClassName() { return "AIIndustry"; } truelight@9529: truelight@9529: /** truelight@9448: * Gets the maximum industry index; there are no valid industries with a truelight@9448: * higher index. truelight@9448: * @return the maximum industry index. truelight@9448: * @post return value is always non-negative. rubidium@9405: */ rubidium@9405: IndustryID GetMaxIndustryID(); rubidium@9405: rubidium@9405: /** truelight@9448: * Gets the number of industries. This is different than GetMaxIndustryID() truelight@9448: * because of the way OpenTTD works internally. truelight@9448: * @return the number of industries. truelight@9448: * @post return value is always non-negative. rubidium@9405: */ rubidium@9405: int32 GetIndustryCount(); rubidium@9405: rubidium@9405: /** truelight@9448: * Checks whether the given industry index is valid. truelight@9448: * @param industry_id the index to check. truelight@9448: * @return true if and only if the industry is valid. rubidium@9405: */ rubidium@9497: static bool IsValidIndustry(IndustryID industry_id); rubidium@9405: rubidium@9405: /** truelight@9448: * Get the name of the industry. truelight@9448: * @param industry_id the industry to get the name of. truelight@9448: * @pre industry_id has to be valid (use IsValidIndustry()). truelight@9448: * @return the name of the industry. truelight@9448: * @note the returned name must be free'd (C++ only). rubidium@9405: */ rubidium@9405: char *GetName(IndustryID industry_id); rubidium@9405: rubidium@9405: /** truelight@9649: * Gets the production of a cargo of the industry. truelight@9649: * @param industry_id the index of the industry. truelight@9649: * @param cargo_id the index of the cargo. truelight@9649: * @pre industry_id has to be valid (use IsValidIndustry()). truelight@9649: * @pre cargo_id has to be valid (use IsValidCargo()). truelight@9649: * @return the production of the cargo for this industry. truelight@9649: */ truelight@9650: static int32 GetProduction(IndustryID industry_id, CargoID cargo_id); truelight@9649: truelight@9649: /** truelight@9710: * See if an industry accepts a certain cargo. truelight@9710: * @param industry_id the index of the industry. truelight@9710: * @param cargo_id the index of the cargo. truelight@9710: * @pre industry_id has to be valid (use IsValidIndustry()). truelight@9710: * @pre cargo_id has to be valid (use IsValidCargo()). truelight@9710: * @return the production of the cargo for this industry. truelight@9710: */ truelight@9710: static bool IsCargoAccepted(IndustryID industry_id, CargoID cargo_id); truelight@9710: truelight@9710: /** truelight@9448: * Gets the location of the industry. truelight@9649: * @param industry_id the index of the industry. truelight@9448: * @pre industry_id has to be valid (use IsValidIndustry()). truelight@9448: * @return the location of the industry. truelight@9448: * @post return value is always positive and below AIMap::GetMapSize(). rubidium@9405: */ truelight@9649: static TileIndex GetLocation(IndustryID industry_id); rubidium@9405: }; rubidium@9405: rubidium@9405: #endif /* AI_INDUSTRY_HPP */