(svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
/* $Id$ */
/** @file ai_industry.cpp handles the query-related of the AIIndustry class */
#include "ai_industry.hpp"
#include "../../industry.h"
#include "../../strings.h"
#include "../../variables.h" /* For SetDParam */
#include "table/strings.h"
IndustryID AIIndustry::GetMaxIndustryID()
{
return ::GetMaxIndustryIndex();
}
int32 AIIndustry::GetIndustryCount()
{
return ::GetNumIndustries();
}
/* static */ bool AIIndustry::IsValidIndustry(IndustryID industry_id)
{
return ::IsValidIndustryID(industry_id);
}
char *AIIndustry::GetName(IndustryID industry_id)
{
if (!this->IsValidIndustry(industry_id)) return NULL;
static const int len = 64;
char *industry_name = MallocT<char>(len);
SetDParam(0, industry_id);
GetString(industry_name, STR_INDUSTRY, &industry_name[len - 1]);
return industry_name;
}
TileIndex AIIndustry::GetLocation(IndustryID industry_id)
{
if (!this->IsValidIndustry(industry_id)) return INVALID_TILE;
const Industry *i = ::GetIndustry(industry_id);
return i->xy;
}