(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.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();
}
bool AIIndustry::IsValidIndustry(IndustryID industry_id)
{
return ::IsValidIndustryID(industry_id);
}
char *AIIndustry::GetName(IndustryID industry_id)
{
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)
{
const Industry *i = ::GetIndustry(industry_id);
return i->xy;
}