(svn r21663) -Add: [NoAI]: AIRail::GetName() to get the name of a railtype

This commit is contained in:
yexo
2010-12-29 23:20:12 +00:00
parent c986325763
commit 5b25e620dd
6 changed files with 28 additions and 0 deletions
+12
View File
@@ -19,6 +19,18 @@
#include "../../newgrf.h"
#include "../../newgrf_generic.h"
#include "../../newgrf_station.h"
#include "../../strings_func.h"
/* static */ char *AIRail::GetName(RailType rail_type)
{
if (!IsRailTypeAvailable(rail_type)) return NULL;
static const int len = 64;
char *railtype_name = MallocT<char>(len);
::GetString(railtype_name, GetRailTypeInfo((::RailType)rail_type)->strings.menu_text, &railtype_name[len - 1]);
return railtype_name;
}
/* static */ bool AIRail::IsRailTile(TileIndex tile)
{