src/ai/core/ai_industry.hpp
author rubidium
Thu, 15 Mar 2007 13:50:58 +0000
branchnoai
changeset 9405 df6f3b4b0038
child 9422 33efcc5f1b09
permissions -rw-r--r--
(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 */