(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
DoCommand no longer returns the cost, it returns a bool.
Costs are available via this Accounting class.
/* $Id$ */
/** @file ai_industry.hpp Everything to query about industries */
#ifndef AI_INDUSTRY_HPP
#define AI_INDUSTRY_HPP
#include "ai_object.hpp"
/**
* Class that handles all industry related functions.
*/
class AIIndustry : public AIObject {
public:
/**
* Gets the maximum industry index; there are no valid industries with a
* higher index.
* @return the maximum industry index.
* @post return value is always non-negative.
*/
IndustryID GetMaxIndustryID();
/**
* Gets the number of industries. This is different than GetMaxIndustryID()
* because of the way OpenTTD works internally.
* @return the number of industries.
* @post return value is always non-negative.
*/
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 industry_id has to be valid (use IsValidIndustry()).
* @return the name of the industry.
* @note the returned name must be free'd (C++ only).
*/
char *GetName(IndustryID industry_id);
/**
* Gets the location of the industry.
* @param industry_id the location of the industry.
* @pre industry_id has to be valid (use IsValidIndustry()).
* @return the location of the industry.
* @post return value is always positive and below AIMap::GetMapSize().
*/
TileIndex GetLocation(IndustryID industry_id);
};
#ifdef DEFINE_SQUIRREL_CLASS
void SQAIIndustryRegister(Squirrel *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 */