1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Show per-type object names in editor

This commit is contained in:
Ivan Savenko
2023-07-15 14:50:09 +03:00
parent dddb599bf9
commit 8ed5f412e2
4 changed files with 66 additions and 2 deletions

View File

@ -20,6 +20,7 @@
#include "../TerrainHandler.h"
#include "../VCMI_Lib.h"
#include "../mapObjects/CGCreature.h"
#include "../mapObjects/CGHeroInstance.h"
#include "../mapObjects/CGMarket.h"
#include "../mapObjects/CGTownInstance.h"
@ -35,6 +36,26 @@ bool CObstacleConstructor::isStaticObject()
return true;
}
bool CreatureInstanceConstructor::hasNameTextID() const
{
return true;
}
std::string CreatureInstanceConstructor::getNameTextID() const
{
return VLC->creatures()->getByIndex(getSubIndex())->getNamePluralTextID();
}
bool ResourceInstanceConstructor::hasNameTextID() const
{
return true;
}
std::string ResourceInstanceConstructor::getNameTextID() const
{
return TextIdentifier("core", "restypes", getSubIndex()).get();
}
void CTownInstanceConstructor::initTypeData(const JsonNode & input)
{
VLC->modh->identifiers.requestIdentifier("faction", input["faction"], [&](si32 index)
@ -86,6 +107,16 @@ void CTownInstanceConstructor::randomizeObject(CGTownInstance * object, CRandomG
object->appearance = templ;
}
bool CTownInstanceConstructor::hasNameTextID() const
{
return true;
}
std::string CTownInstanceConstructor::getNameTextID() const
{
return faction->getNameTextID();
}
void CHeroInstanceConstructor::initTypeData(const JsonNode & input)
{
VLC->modh->identifiers.requestIdentifier(
@ -133,6 +164,16 @@ void CHeroInstanceConstructor::randomizeObject(CGHeroInstance * object, CRandomG
}
bool CHeroInstanceConstructor::hasNameTextID() const
{
return true;
}
std::string CHeroInstanceConstructor::getNameTextID() const
{
return heroClass->getNameTextID();
}
void BoatInstanceConstructor::initTypeData(const JsonNode & input)
{
layer = EPathfindingLayer::SAIL;