(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
/* $Id$ */
/** @file ai_industry.hpp Everything to query about industries */
#ifndef AI_INDUSTRY_HPP
#define AI_INDUSTRY_HPP
#include "ai_object.hpp"
class AIIndustry : public AIObject {
public:
/**
* Gets the maximum industry index; there are no valid industries with a higher index
* @return the maximum town index
* @post return >= 0
*/
IndustryID GetMaxIndustryID();
/**
* Gets the number of industries
* @return the number of industries
* @post return >= 0
*/
int32 GetIndustryCount();
/**
* Checks whether the given industry index is valid
* @param industry_id the index to check
* @return true if and only if the industry is valid
*/
bool IsValidIndustry(IndustryID industry_id);
/**
* Get the name of the industry
* @param industry_id the industry to get the name of
* @pre this->IsValidIndustry(industry_id)
* @return the name of the industry
* @note the returned name must be freed
*/
char *GetName(IndustryID industry_id);
/**
* Gets the location of the industry
* @param industry_id the location of the industry
* @pre this->IsValidIndustry(industry_id)
* @return the location of the industry
* @post return >= 0
*/
TileIndex GetLocation(IndustryID industry_id);
};
#ifdef SQUIRREL_CLASS
void SQAIIndustryRegister(SquirrelEngine *engine) {
DefSQClass <AIIndustry> SQAIIndustry("AIIndustry");
SQAIIndustry.PreRegister(engine);
SQAIIndustry.AddConstructor(engine);
SQAIIndustry.DefSQFunction(engine, &AIIndustry::GetMaxIndustryID, "GetMaxIndustryID");
SQAIIndustry.DefSQFunction(engine, &AIIndustry::GetIndustryCount, "GetIndustryCount");
SQAIIndustry.DefSQFunction(engine, &AIIndustry::IsValidIndustry, "IsValidIndustry");
SQAIIndustry.DefSQFunction(engine, &AIIndustry::GetName, "GetName");
SQAIIndustry.DefSQFunction(engine, &AIIndustry::GetLocation, "GetLocation");
SQAIIndustry.PostRegister(engine);
}
#endif /* SQUIRREL_CLASS */
#endif /* AI_INDUSTRY_HPP */