mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Finalization of refactoring:
- Entity interface now has getNameTranslated & getNameTextID methods - Entity interface no longer has getName method - removed (most) usages of normalizeIndentifier workaround method - all moddable objects have identifier in form of mod:name - all moddable object register strings in form of mod.type.name
This commit is contained in:
parent
05a1d7c6e3
commit
47c1803c42
@ -33,16 +33,16 @@ TSubgoal AdventureSpellCast::whatToDoToAchieve()
|
||||
|
||||
auto spell = getSpell();
|
||||
|
||||
logAi->trace("Decomposing adventure spell cast of %s for hero %s", spell->getName(), hero->getNameTranslated());
|
||||
logAi->trace("Decomposing adventure spell cast of %s for hero %s", spell->getNameTranslated(), hero->getNameTranslated());
|
||||
|
||||
if(!spell->isAdventure())
|
||||
throw cannotFulfillGoalException(spell->getName() + " is not an adventure spell.");
|
||||
throw cannotFulfillGoalException(spell->getNameTranslated() + " is not an adventure spell.");
|
||||
|
||||
if(!hero->canCastThisSpell(spell))
|
||||
throw cannotFulfillGoalException("Hero can not cast " + spell->getName());
|
||||
throw cannotFulfillGoalException("Hero can not cast " + spell->getNameTranslated());
|
||||
|
||||
if(hero->mana < hero->getSpellCost(spell))
|
||||
throw cannotFulfillGoalException("Hero has not enough mana to cast " + spell->getName());
|
||||
throw cannotFulfillGoalException("Hero has not enough mana to cast " + spell->getNameTranslated());
|
||||
|
||||
if(spellID == SpellID::TOWN_PORTAL && town && town->visitingHero)
|
||||
throw cannotFulfillGoalException("The town is already occupied by " + town->visitingHero->getNameTranslated());
|
||||
@ -75,10 +75,10 @@ void AdventureSpellCast::accept(VCAI * ai)
|
||||
|
||||
std::string AdventureSpellCast::name() const
|
||||
{
|
||||
return "AdventureSpellCast " + getSpell()->getName();
|
||||
return "AdventureSpellCast " + getSpell()->getNameTranslated();
|
||||
}
|
||||
|
||||
std::string AdventureSpellCast::completeMessage() const
|
||||
{
|
||||
return "Spell cast successfully " + getSpell()->getName();
|
||||
return "Spell cast successfully " + getSpell()->getNameTranslated();
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ void ClientCommandManager::processCommand(const std::string &message, bool calle
|
||||
{
|
||||
const JsonNode & object = nameAndObject.second;
|
||||
|
||||
std::string name = CModHandler::normalizeIdentifier(object.meta, CModHandler::scopeBuiltin(), nameAndObject.first);
|
||||
std::string name = CModHandler::makeFullIdentifier(object.meta, contentName, nameAndObject.first);
|
||||
|
||||
boost::algorithm::replace_all(name,":","_");
|
||||
|
||||
|
@ -19,8 +19,8 @@ class CreatureID;
|
||||
|
||||
class DLL_LINKAGE Artifact : public EntityWithBonuses<ArtifactID>
|
||||
{
|
||||
using EntityWithBonuses<ArtifactID>::getName;
|
||||
public:
|
||||
|
||||
virtual bool isBig() const = 0;
|
||||
virtual bool isTradable() const = 0;
|
||||
virtual uint32_t getPrice() const = 0;
|
||||
@ -28,11 +28,9 @@ public:
|
||||
|
||||
virtual std::string getDescriptionTranslated() const = 0;
|
||||
virtual std::string getEventTranslated() const = 0;
|
||||
virtual std::string getNameTranslated() const = 0;
|
||||
|
||||
virtual std::string getDescriptionTextID() const = 0;
|
||||
virtual std::string getEventTextID() const = 0;
|
||||
virtual std::string getNameTextID() const = 0;
|
||||
};
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
@ -19,10 +19,10 @@ class CreatureID;
|
||||
class DLL_LINKAGE Creature : public EntityWithBonuses<CreatureID>
|
||||
{
|
||||
protected:
|
||||
using EntityWithBonuses<CreatureID>::getName;
|
||||
// use getNamePlural/Singular instead
|
||||
std::string getNameTranslated() const override = 0;
|
||||
std::string getNameTextID() const override = 0;
|
||||
|
||||
virtual std::string getNameTranslated() const = 0;
|
||||
virtual std::string getNameTextID() const = 0;
|
||||
public:
|
||||
virtual std::string getNamePluralTranslated() const = 0;
|
||||
virtual std::string getNameSingularTranslated() const = 0;
|
||||
|
@ -23,8 +23,9 @@ public:
|
||||
|
||||
virtual int32_t getIndex() const = 0;
|
||||
virtual int32_t getIconIndex() const = 0;
|
||||
virtual const std::string & getJsonKey() const = 0;
|
||||
virtual const std::string & getName() const = 0;
|
||||
virtual std::string getJsonKey() const = 0;
|
||||
virtual std::string getNameTranslated() const = 0;
|
||||
virtual std::string getNameTextID() const = 0;
|
||||
|
||||
virtual void registerIcons(const IconRegistar & cb) const = 0;
|
||||
};
|
||||
|
@ -18,12 +18,9 @@ class FactionID;
|
||||
|
||||
class DLL_LINKAGE Faction : public EntityT<FactionID>
|
||||
{
|
||||
using EntityT<FactionID>::getName;
|
||||
public:
|
||||
virtual bool hasTown() const = 0;
|
||||
|
||||
virtual std::string getNameTranslated() const = 0;
|
||||
virtual std::string getNameTextID() const = 0;
|
||||
};
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
@ -18,12 +18,6 @@ class HeroClassID;
|
||||
|
||||
class DLL_LINKAGE HeroClass : public EntityT<HeroClassID>
|
||||
{
|
||||
using EntityT<HeroClassID>::getName;
|
||||
public:
|
||||
virtual std::string getNameTranslated() const = 0;
|
||||
virtual std::string getNameTextID() const = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -18,15 +18,11 @@ class HeroTypeID;
|
||||
|
||||
class DLL_LINKAGE HeroType : public EntityT<HeroTypeID>
|
||||
{
|
||||
using EntityT<HeroTypeID>::getName;
|
||||
public:
|
||||
virtual std::string getNameTranslated() const = 0;
|
||||
virtual std::string getBiographyTranslated() const = 0;
|
||||
virtual std::string getSpecialtyNameTranslated() const = 0;
|
||||
virtual std::string getSpecialtyDescriptionTranslated() const = 0;
|
||||
virtual std::string getSpecialtyTooltipTranslated() const = 0;
|
||||
|
||||
virtual std::string getNameTextID() const = 0;
|
||||
virtual std::string getBiographyTextID() const = 0;
|
||||
virtual std::string getSpecialtyNameTextID() const = 0;
|
||||
virtual std::string getSpecialtyDescriptionTextID() const = 0;
|
||||
|
@ -23,8 +23,6 @@ class Caster;
|
||||
|
||||
class DLL_LINKAGE Spell: public EntityT<SpellID>
|
||||
{
|
||||
using EntityT<SpellID>::getName;
|
||||
|
||||
public:
|
||||
using SchoolCallback = std::function<void(const SchoolInfo &, bool &)>;
|
||||
|
||||
|
@ -16,25 +16,13 @@ VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
BattleFieldInfo * BattleFieldHandler::loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
|
||||
BattleFieldInfo * info = new BattleFieldInfo(BattleField(index), identifier);
|
||||
|
||||
if(json["graphics"].getType() == JsonNode::JsonType::DATA_STRING)
|
||||
{
|
||||
info->graphics = json["graphics"].String();
|
||||
}
|
||||
|
||||
if(json["icon"].getType() == JsonNode::JsonType::DATA_STRING)
|
||||
{
|
||||
info->icon = json["icon"].String();
|
||||
}
|
||||
|
||||
if(json["name"].getType() == JsonNode::JsonType::DATA_STRING)
|
||||
{
|
||||
info->name = json["name"].String();
|
||||
}
|
||||
|
||||
if(json["bonuses"].getType() == JsonNode::JsonType::DATA_VECTOR)
|
||||
{
|
||||
for(auto b : json["bonuses"].Vector())
|
||||
{
|
||||
auto bonus = JsonUtils::parseBonus(b);
|
||||
@ -45,19 +33,10 @@ BattleFieldInfo * BattleFieldHandler::loadFromJson(const std::string & scope, co
|
||||
|
||||
info->bonuses.push_back(bonus);
|
||||
}
|
||||
}
|
||||
|
||||
if(json["isSpecial"].getType() == JsonNode::JsonType::DATA_BOOL)
|
||||
{
|
||||
info->isSpecial = json["isSpecial"].Bool();
|
||||
}
|
||||
|
||||
if(json["impassableHexes"].getType() == JsonNode::JsonType::DATA_VECTOR)
|
||||
{
|
||||
for(auto node : json["impassableHexes"].Vector())
|
||||
info->impassableHexes.push_back(BattleHex(node.Integer()));
|
||||
}
|
||||
|
||||
|
||||
return info;
|
||||
}
|
||||
@ -89,14 +68,19 @@ int32_t BattleFieldInfo::getIconIndex() const
|
||||
return iconIndex;
|
||||
}
|
||||
|
||||
const std::string & BattleFieldInfo::getName() const
|
||||
std::string BattleFieldInfo::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
std::string BattleFieldInfo::getNameTextID() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
const std::string & BattleFieldInfo::getJsonKey() const
|
||||
std::string BattleFieldInfo::getNameTranslated() const
|
||||
{
|
||||
return identifier;
|
||||
return name; // TODO?
|
||||
}
|
||||
|
||||
void BattleFieldInfo::registerIcons(const IconRegistar & cb) const
|
||||
|
@ -43,8 +43,9 @@ public:
|
||||
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
const std::string & getName() const override;
|
||||
const std::string & getJsonKey() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getNameTextID() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
BattleField getId() const override;
|
||||
|
||||
|
@ -60,14 +60,9 @@ int32_t CArtifact::getIconIndex() const
|
||||
return iconIndex;
|
||||
}
|
||||
|
||||
const std::string & CArtifact::getName() const
|
||||
std::string CArtifact::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
const std::string & CArtifact::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
return modScope + ':' + identifier;
|
||||
}
|
||||
|
||||
void CArtifact::registerIcons(const IconRegistar & cb) const
|
||||
@ -103,17 +98,17 @@ std::string CArtifact::getNameTranslated() const
|
||||
|
||||
std::string CArtifact::getDescriptionTextID() const
|
||||
{
|
||||
return TextIdentifier("object", modScope, identifier, "description").get();
|
||||
return TextIdentifier("artifact", modScope, identifier, "description").get();
|
||||
}
|
||||
|
||||
std::string CArtifact::getEventTextID() const
|
||||
{
|
||||
return TextIdentifier("object", modScope, identifier, "event").get();
|
||||
return TextIdentifier("artifact", modScope, identifier, "event").get();
|
||||
}
|
||||
|
||||
std::string CArtifact::getNameTextID() const
|
||||
{
|
||||
return TextIdentifier("object", modScope, identifier, "name").get();
|
||||
return TextIdentifier("artifact", modScope, identifier, "name").get();
|
||||
}
|
||||
|
||||
uint32_t CArtifact::getPrice() const
|
||||
@ -181,7 +176,7 @@ int CArtifact::getArtClassSerial() const
|
||||
|
||||
std::string CArtifact::nodeName() const
|
||||
{
|
||||
return "Artifact: " + getName();
|
||||
return "Artifact: " + getNameTranslated();
|
||||
}
|
||||
|
||||
void CArtifact::addNewBonus(const std::shared_ptr<Bonus>& b)
|
||||
@ -301,7 +296,7 @@ std::vector<JsonNode> CArtHandler::loadLegacyData(size_t dataSize)
|
||||
|
||||
void CArtHandler::loadObject(std::string scope, std::string name, const JsonNode & data)
|
||||
{
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name), objects.size());
|
||||
auto object = loadFromJson(scope, data, name, objects.size());
|
||||
|
||||
object->iconIndex = object->getIndex() + 5;
|
||||
|
||||
@ -312,7 +307,7 @@ void CArtHandler::loadObject(std::string scope, std::string name, const JsonNode
|
||||
|
||||
void CArtHandler::loadObject(std::string scope, std::string name, const JsonNode & data, size_t index)
|
||||
{
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name), index);
|
||||
auto object = loadFromJson(scope, data, name, index);
|
||||
|
||||
object->iconIndex = object->getIndex();
|
||||
|
||||
@ -330,6 +325,9 @@ const std::vector<std::string> & CArtHandler::getTypeNames() const
|
||||
|
||||
CArtifact * CArtHandler::loadFromJson(const std::string & scope, const JsonNode & node, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
assert(!scope.empty());
|
||||
|
||||
CArtifact * art;
|
||||
|
||||
if(!VLC->modh->modules.COMMANDERS || node["growing"].isNull())
|
||||
@ -690,11 +688,11 @@ void CArtHandler::erasePickedArt(ArtifactID id)
|
||||
artifactList->erase(itr);
|
||||
}
|
||||
else
|
||||
logMod->warn("Problem: cannot erase artifact %s from list, it was not present", art->getName());
|
||||
logMod->warn("Problem: cannot erase artifact %s from list, it was not present", art->getNameTranslated());
|
||||
|
||||
}
|
||||
else
|
||||
logMod->warn("Problem: cannot find list for artifact %s, strange class. (special?)", art->getName());
|
||||
logMod->warn("Problem: cannot find list for artifact %s, strange class. (special?)", art->getNameTranslated());
|
||||
}
|
||||
|
||||
boost::optional<std::vector<CArtifact*>&> CArtHandler::listFromClass( CArtifact::EartClass artifactClass )
|
||||
|
@ -50,8 +50,6 @@ class DLL_LINKAGE CArtifact : public Artifact, public CBonusSystemNode //contain
|
||||
std::string modScope;
|
||||
std::string identifier;
|
||||
|
||||
const std::string & getName() const override;
|
||||
|
||||
public:
|
||||
enum EartClass {ART_SPECIAL=1, ART_TREASURE=2, ART_MINOR=4, ART_MAJOR=8, ART_RELIC=16}; //artifact classes
|
||||
|
||||
@ -68,7 +66,7 @@ public:
|
||||
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
const std::string & getJsonKey() const override;
|
||||
std::string getJsonKey() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
ArtifactID getId() const override;
|
||||
virtual const IBonusBearer * accessBonuses() const override;
|
||||
|
@ -33,14 +33,9 @@ int32_t CCreature::getIconIndex() const
|
||||
return iconIndex;
|
||||
}
|
||||
|
||||
const std::string & CCreature::getName() const
|
||||
std::string CCreature::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
const std::string & CCreature::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
return modScope + ':' + identifier;;
|
||||
}
|
||||
|
||||
void CCreature::registerIcons(const IconRegistar & cb) const
|
||||
@ -598,6 +593,9 @@ std::vector<JsonNode> CCreatureHandler::loadLegacyData(size_t dataSize)
|
||||
|
||||
CCreature * CCreatureHandler::loadFromJson(const std::string & scope, const JsonNode & node, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
assert(!scope.empty());
|
||||
|
||||
auto cre = new CCreature();
|
||||
|
||||
if(node["hasDoubleWeek"].Bool())
|
||||
@ -607,6 +605,7 @@ CCreature * CCreatureHandler::loadFromJson(const std::string & scope, const Json
|
||||
cre->idNumber = CreatureID(index);
|
||||
cre->iconIndex = cre->getIndex() + 2;
|
||||
cre->identifier = identifier;
|
||||
cre->modScope = scope;
|
||||
|
||||
JsonDeserializer handler(nullptr, node);
|
||||
cre->serializeJson(handler);
|
||||
|
@ -37,7 +37,6 @@ class DLL_LINKAGE CCreature : public Creature, public CBonusSystemNode
|
||||
// std::string nameSing;// singular name, e.g. Centaur
|
||||
// std::string namePl; // plural name, e.g. Centaurs
|
||||
|
||||
const std::string & getName() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
std::string getNameTextID() const override;
|
||||
|
||||
@ -153,7 +152,7 @@ public:
|
||||
TerrainId getNativeTerrain() const;
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
const std::string & getJsonKey() const override;
|
||||
std::string getJsonKey() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
CreatureID getId() const override;
|
||||
virtual const IBonusBearer * accessBonuses() const override;
|
||||
|
@ -1713,7 +1713,7 @@ void CGameState::initTowns()
|
||||
}
|
||||
if(vti->getNameTranslated().empty())
|
||||
{
|
||||
size_t nameID = getRandomGenerator().nextInt(vti->town->getRandomNamesCount());
|
||||
size_t nameID = getRandomGenerator().nextInt(vti->town->getRandomNamesCount() - 1);
|
||||
vti->setNameTranslated(vti->town->getRandomNameTranslated(nameID));
|
||||
}
|
||||
|
||||
|
@ -405,6 +405,8 @@ const std::string & CGeneralTextHandler::deserialize(const TextIdentifier & iden
|
||||
|
||||
void CGeneralTextHandler::registerString(const TextIdentifier & UID, const std::string & localized)
|
||||
{
|
||||
assert(UID.get().find("..") == std::string::npos);
|
||||
|
||||
stringsIdentifiers[localized] = UID.get();
|
||||
stringsLocalizations[UID.get()] = localized;
|
||||
}
|
||||
|
@ -41,14 +41,9 @@ int32_t CHero::getIconIndex() const
|
||||
return imageIndex;
|
||||
}
|
||||
|
||||
const std::string & CHero::getName() const
|
||||
std::string CHero::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
const std::string & CHero::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
return modScope + ':' + identifier;;
|
||||
}
|
||||
|
||||
HeroTypeID CHero::getId() const
|
||||
@ -168,14 +163,9 @@ int32_t CHeroClass::getIconIndex() const
|
||||
return getIndex();
|
||||
}
|
||||
|
||||
const std::string & CHeroClass::getName() const
|
||||
std::string CHeroClass::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
const std::string & CHeroClass::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
return modScope + ':' + identifier;;
|
||||
}
|
||||
|
||||
HeroClassID CHeroClass::getId() const
|
||||
@ -224,7 +214,7 @@ void CHeroClassHandler::fillPrimarySkillData(const JsonNode & node, CHeroClass *
|
||||
if(currentPrimarySkillValue < primarySkillLegalMinimum)
|
||||
{
|
||||
logMod->error("Hero class '%s' has incorrect initial value '%d' for skill '%s'. Value '%d' will be used instead.",
|
||||
heroClass->getName(), currentPrimarySkillValue, skillName, primarySkillLegalMinimum);
|
||||
heroClass->getNameTranslated(), currentPrimarySkillValue, skillName, primarySkillLegalMinimum);
|
||||
currentPrimarySkillValue = primarySkillLegalMinimum;
|
||||
}
|
||||
heroClass->primarySkillInitial.push_back(currentPrimarySkillValue);
|
||||
@ -240,12 +230,16 @@ const std::vector<std::string> & CHeroClassHandler::getTypeNames() const
|
||||
|
||||
CHeroClass * CHeroClassHandler::loadFromJson(const std::string & scope, const JsonNode & node, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
assert(!scope.empty());
|
||||
|
||||
std::string affinityStr[2] = { "might", "magic" };
|
||||
|
||||
auto heroClass = new CHeroClass();
|
||||
|
||||
heroClass->id = HeroClassID(index);
|
||||
heroClass->identifier = identifier;
|
||||
heroClass->modScope = scope;
|
||||
heroClass->imageBattleFemale = node["animation"]["battle"]["female"].String();
|
||||
heroClass->imageBattleMale = node["animation"]["battle"]["male"].String();
|
||||
//MODS COMPATIBILITY FOR 0.96
|
||||
@ -417,9 +411,13 @@ const std::vector<std::string> & CHeroHandler::getTypeNames() const
|
||||
|
||||
CHero * CHeroHandler::loadFromJson(const std::string & scope, const JsonNode & node, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
assert(!scope.empty());
|
||||
|
||||
auto hero = new CHero();
|
||||
hero->ID = HeroTypeID(index);
|
||||
hero->identifier = identifier;
|
||||
hero->modScope = scope;
|
||||
hero->sex = node["female"].Bool();
|
||||
hero->special = node["special"].Bool();
|
||||
|
||||
@ -923,7 +921,7 @@ std::vector<JsonNode> CHeroHandler::loadLegacyData(size_t dataSize)
|
||||
void CHeroHandler::loadObject(std::string scope, std::string name, const JsonNode & data)
|
||||
{
|
||||
size_t index = objects.size();
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name), index);
|
||||
auto object = loadFromJson(scope, data, name, index);
|
||||
object->imageIndex = (si32)index + GameConstants::HERO_PORTRAIT_SHIFT; // 2 special frames + some extra portraits
|
||||
|
||||
objects.push_back(object);
|
||||
@ -933,7 +931,7 @@ void CHeroHandler::loadObject(std::string scope, std::string name, const JsonNod
|
||||
|
||||
void CHeroHandler::loadObject(std::string scope, std::string name, const JsonNode & data, size_t index)
|
||||
{
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name), index);
|
||||
auto object = loadFromJson(scope, data, name, index);
|
||||
object->imageIndex = static_cast<si32>(index);
|
||||
|
||||
assert(objects[index] == nullptr); // ensure that this id was not loaded before
|
||||
|
@ -66,8 +66,6 @@ class DLL_LINKAGE CHero : public HeroType
|
||||
std::string nameTextID; //name of hero
|
||||
std::string biographyTextID;
|
||||
|
||||
const std::string & getName() const override;
|
||||
|
||||
public:
|
||||
struct InitialArmyStack
|
||||
{
|
||||
@ -108,7 +106,7 @@ public:
|
||||
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
const std::string & getJsonKey() const override;
|
||||
std::string getJsonKey() const override;
|
||||
HeroTypeID getId() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
|
||||
@ -146,6 +144,7 @@ public:
|
||||
h & portraitSmall;
|
||||
h & portraitLarge;
|
||||
h & identifier;
|
||||
h & modScope;
|
||||
h & battleImage;
|
||||
}
|
||||
};
|
||||
@ -162,7 +161,6 @@ class DLL_LINKAGE CHeroClass : public HeroClass
|
||||
std::string identifier; // use getJsonKey instead
|
||||
std::string nameTextID;
|
||||
|
||||
const std::string & getName() const override;
|
||||
public:
|
||||
enum EClassAffinity
|
||||
{
|
||||
@ -197,7 +195,7 @@ public:
|
||||
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
const std::string & getJsonKey() const override;
|
||||
std::string getJsonKey() const override;
|
||||
HeroClassID getId() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
|
||||
|
@ -54,11 +54,6 @@ int32_t CSkill::getIconIndex() const
|
||||
return getIndex(); //TODO: actual value with skill level
|
||||
}
|
||||
|
||||
const std::string & CSkill::getName() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
std::string CSkill::getNameTextID() const
|
||||
{
|
||||
TextIdentifier id("skill", modScope, identifier, "name");
|
||||
@ -70,9 +65,9 @@ std::string CSkill::getNameTranslated() const
|
||||
return VLC->generaltexth->translate(getNameTextID());
|
||||
}
|
||||
|
||||
const std::string & CSkill::getJsonKey() const
|
||||
std::string CSkill::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
return modScope + ':' + identifier;;
|
||||
}
|
||||
|
||||
std::string CSkill::getDescriptionTextID(int level) const
|
||||
@ -210,7 +205,11 @@ const std::vector<std::string> & CSkillHandler::getTypeNames() const
|
||||
|
||||
CSkill * CSkillHandler::loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
assert(!scope.empty());
|
||||
|
||||
CSkill * skill = new CSkill(SecondarySkill((si32)index), identifier);
|
||||
skill->modScope = scope;
|
||||
|
||||
VLC->generaltexth->registerString(skill->getNameTextID(), json["name"].String());
|
||||
switch(json["gainChance"].getType())
|
||||
|
@ -50,20 +50,18 @@ private:
|
||||
std::string modScope;
|
||||
std::string identifier;
|
||||
|
||||
const std::string & getName() const override;
|
||||
|
||||
public:
|
||||
CSkill(SecondarySkill id = SecondarySkill::DEFAULT, std::string identifier = "default");
|
||||
~CSkill();
|
||||
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
const std::string & getJsonKey() const override;
|
||||
std::string getJsonKey() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
SecondarySkill getId() const override;
|
||||
|
||||
std::string getNameTextID() const;
|
||||
std::string getNameTranslated() const;
|
||||
std::string getNameTextID() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
|
||||
std::string getDescriptionTextID(int level) const;
|
||||
std::string getDescriptionTranslated(int level) const;
|
||||
|
@ -46,7 +46,7 @@ const std::map<std::string, CBuilding::ETowerHeight> CBuilding::TOWER_TYPES =
|
||||
|
||||
std::string CBuilding::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
return modScope + ':' + identifier;;
|
||||
}
|
||||
|
||||
std::string CBuilding::getNameTranslated() const
|
||||
@ -61,12 +61,12 @@ std::string CBuilding::getDescriptionTranslated() const
|
||||
|
||||
std::string CBuilding::getNameTextID() const
|
||||
{
|
||||
return TextIdentifier("building", town->faction->getJsonKey(), modScope, identifier, "name").get();
|
||||
return TextIdentifier("building", modScope, town->faction->identifier, identifier, "name").get();
|
||||
}
|
||||
|
||||
std::string CBuilding::getDescriptionTextID() const
|
||||
{
|
||||
return TextIdentifier("building", town->faction->getJsonKey(), modScope, identifier, "description").get();
|
||||
return TextIdentifier("building", modScope, town->faction->identifier, identifier, "description").get();
|
||||
}
|
||||
|
||||
BuildingID CBuilding::getBase() const
|
||||
@ -122,14 +122,9 @@ int32_t CFaction::getIconIndex() const
|
||||
return index; //???
|
||||
}
|
||||
|
||||
const std::string & CFaction::getName() const
|
||||
std::string CFaction::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
const std::string & CFaction::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
return modScope + ':' + identifier;;
|
||||
}
|
||||
|
||||
void CFaction::registerIcons(const IconRegistar & cb) const
|
||||
@ -205,7 +200,7 @@ std::string CTown::getRandomNameTranslated(size_t index) const
|
||||
|
||||
std::string CTown::getRandomNameTextID(size_t index) const
|
||||
{
|
||||
return TextIdentifier("faction", faction->getJsonKey(), "randomName", index).get();
|
||||
return TextIdentifier("faction", faction->modScope, faction->identifier, "randomName", index).get();
|
||||
}
|
||||
|
||||
size_t CTown::getRandomNamesCount() const
|
||||
@ -582,6 +577,9 @@ void CTownHandler::loadSpecialBuildingBonuses(const JsonNode & source, BonusList
|
||||
|
||||
void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, const JsonNode & source)
|
||||
{
|
||||
assert(stringID.find(':') == std::string::npos);
|
||||
assert(!source.meta.empty());
|
||||
|
||||
auto ret = new CBuilding();
|
||||
ret->bid = getMappedValue<BuildingID, std::string>(stringID, BuildingID::NONE, MappedKeys::BUILDING_NAMES_TO_TYPES, false);
|
||||
|
||||
@ -603,6 +601,7 @@ void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, cons
|
||||
ret->height = getMappedValue<CBuilding::ETowerHeight>(source["height"], CBuilding::HEIGHT_NO_TOWER, CBuilding::TOWER_TYPES);
|
||||
|
||||
ret->identifier = stringID;
|
||||
ret->modScope = source.meta;
|
||||
ret->town = town;
|
||||
|
||||
VLC->generaltexth->registerString(ret->getNameTextID(), source["name"].String());
|
||||
@ -983,6 +982,8 @@ void CTownHandler::loadPuzzle(CFaction &faction, const JsonNode &source)
|
||||
|
||||
CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode & source, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
|
||||
auto faction = new CFaction();
|
||||
|
||||
faction->index = static_cast<TFaction>(index);
|
||||
@ -1032,7 +1033,7 @@ CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode
|
||||
|
||||
void CTownHandler::loadObject(std::string scope, std::string name, const JsonNode & data)
|
||||
{
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name), objects.size());
|
||||
auto object = loadFromJson(scope, data, name, objects.size());
|
||||
|
||||
objects.push_back(object);
|
||||
|
||||
@ -1071,7 +1072,7 @@ void CTownHandler::loadObject(std::string scope, std::string name, const JsonNod
|
||||
|
||||
void CTownHandler::loadObject(std::string scope, std::string name, const JsonNode & data, size_t index)
|
||||
{
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name), index);
|
||||
auto object = loadFromJson(scope, data, name, index);
|
||||
|
||||
if (objects.size() > index)
|
||||
assert(objects[index] == nullptr); // ensure that this id was not loaded before
|
||||
|
@ -183,13 +183,14 @@ struct DLL_LINKAGE SPuzzleInfo
|
||||
class DLL_LINKAGE CFaction : public Faction
|
||||
{
|
||||
friend class CTownHandler;
|
||||
friend class CBuilding;
|
||||
friend class CTown;
|
||||
|
||||
std::string modScope; //town name, by default - from TownName.txt
|
||||
std::string identifier;
|
||||
|
||||
TFaction index;
|
||||
|
||||
const std::string & getName() const override;
|
||||
|
||||
public:
|
||||
TerrainId nativeTerrain;
|
||||
EAlignment::EAlignment alignment;
|
||||
@ -207,7 +208,7 @@ public:
|
||||
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
const std::string & getJsonKey() const override;
|
||||
std::string getJsonKey() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
FactionID getId() const override;
|
||||
|
||||
|
@ -24,9 +24,4 @@ void IHandlerBase::registerObject(std::string scope, std::string type_name, std:
|
||||
return VLC->modh->identifiers.registerObject(scope, type_name, name, index);
|
||||
}
|
||||
|
||||
std::string IHandlerBase::normalizeIdentifier(const std::string& scope, const std::string& remoteScope, const std::string& identifier) const
|
||||
{
|
||||
return VLC->modh->normalizeIdentifier(scope, remoteScope, identifier);
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
@ -25,8 +25,6 @@ protected:
|
||||
|
||||
/// Calls modhandler. Mostly needed to avoid large number of includes in headers
|
||||
void registerObject(std::string scope, std::string type_name, std::string name, si32 index);
|
||||
std::string normalizeIdentifier(const std::string & scope, const std::string & remoteScope, const std::string & identifier) const;
|
||||
|
||||
public:
|
||||
/// loads all original game data in vector of json nodes
|
||||
/// dataSize - is number of items that must be loaded (normally - constant from GameConstants)
|
||||
@ -94,7 +92,7 @@ public:
|
||||
|
||||
void loadObject(std::string scope, std::string name, const JsonNode & data) override
|
||||
{
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, getScopeBuiltin(), name), objects.size());
|
||||
auto object = loadFromJson(scope, data, name, objects.size());
|
||||
|
||||
objects.push_back(object);
|
||||
|
||||
@ -104,7 +102,7 @@ public:
|
||||
|
||||
void loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) override
|
||||
{
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, getScopeBuiltin(), name), index);
|
||||
auto object = loadFromJson(scope, data, name, index);
|
||||
|
||||
assert(objects[index] == nullptr); // ensure that this id was not loaded before
|
||||
objects[index] = object;
|
||||
|
@ -24,16 +24,21 @@ int32_t ObstacleInfo::getIconIndex() const
|
||||
return iconIndex;
|
||||
}
|
||||
|
||||
const std::string & ObstacleInfo::getName() const
|
||||
std::string ObstacleInfo::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
const std::string & ObstacleInfo::getJsonKey() const
|
||||
std::string ObstacleInfo::getNameTranslated() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
std::string ObstacleInfo::getNameTextID() const
|
||||
{
|
||||
return identifier; // TODO?
|
||||
}
|
||||
|
||||
void ObstacleInfo::registerIcons(const IconRegistar & cb) const
|
||||
{
|
||||
}
|
||||
@ -43,7 +48,6 @@ Obstacle ObstacleInfo::getId() const
|
||||
return obstacle;
|
||||
}
|
||||
|
||||
|
||||
std::vector<BattleHex> ObstacleInfo::getBlocked(BattleHex hex) const
|
||||
{
|
||||
std::vector<BattleHex> ret;
|
||||
@ -81,6 +85,8 @@ bool ObstacleInfo::isAppropriate(const TerrainId terrainType, const BattleField
|
||||
|
||||
ObstacleInfo * ObstacleHandler::loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
|
||||
auto * info = new ObstacleInfo(Obstacle(index), identifier);
|
||||
|
||||
info->animation = json["animation"].String();
|
||||
|
@ -44,8 +44,9 @@ public:
|
||||
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
const std::string & getJsonKey() const override;
|
||||
const std::string & getName() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
std::string getNameTextID() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
Obstacle getId() const override;
|
||||
|
||||
|
@ -26,6 +26,8 @@ RiverType * RiverTypeHandler::loadFromJson(
|
||||
const std::string & identifier,
|
||||
size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
|
||||
RiverType * info = new RiverType;
|
||||
|
||||
info->id = RiverId(index);
|
||||
|
@ -23,17 +23,16 @@ class DLL_LINKAGE RiverType : public EntityT<RiverId>
|
||||
std::string identifier;
|
||||
RiverId id;
|
||||
|
||||
const std::string & getName() const override { return identifier;}
|
||||
public:
|
||||
int32_t getIndex() const override { return id.getNum(); }
|
||||
int32_t getIconIndex() const override { return 0; }
|
||||
const std::string & getJsonKey() const override { return identifier;}
|
||||
std::string getJsonKey() const override { return identifier;}
|
||||
void registerIcons(const IconRegistar & cb) const override {}
|
||||
RiverId getId() const override { return id;}
|
||||
void updateFrom(const JsonNode & data) {};
|
||||
|
||||
std::string getNameTextID() const;
|
||||
std::string getNameTranslated() const;
|
||||
std::string getNameTextID() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
|
||||
std::string tilesFilename;
|
||||
std::string shortIdentifier;
|
||||
|
@ -26,6 +26,8 @@ RoadType * RoadTypeHandler::loadFromJson(
|
||||
const std::string & identifier,
|
||||
size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
|
||||
RoadType * info = new RoadType;
|
||||
|
||||
info->id = RoadId(index);
|
||||
|
@ -23,17 +23,16 @@ class DLL_LINKAGE RoadType : public EntityT<RoadId>
|
||||
std::string identifier;
|
||||
RoadId id;
|
||||
|
||||
const std::string & getName() const override { return identifier;}
|
||||
public:
|
||||
int32_t getIndex() const override { return id.getNum(); }
|
||||
int32_t getIconIndex() const override { return 0; }
|
||||
const std::string & getJsonKey() const override { return identifier;}
|
||||
std::string getJsonKey() const override { return identifier;}
|
||||
void registerIcons(const IconRegistar & cb) const override {}
|
||||
RoadId getId() const override { return id;}
|
||||
void updateFrom(const JsonNode & data) {};
|
||||
|
||||
std::string getNameTextID() const;
|
||||
std::string getNameTranslated() const;
|
||||
std::string getNameTextID() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
|
||||
std::string tilesFilename;
|
||||
std::string shortIdentifier;
|
||||
|
@ -243,7 +243,7 @@ ScriptPtr ScriptHandler::loadFromJson(vstd::CLoggerBase * logger, const std::str
|
||||
|
||||
void ScriptHandler::loadObject(std::string scope, std::string name, const JsonNode & data)
|
||||
{
|
||||
auto object = loadFromJson(logMod, scope, data, normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name));
|
||||
auto object = loadFromJson(logMod, scope, data, name);
|
||||
objects[object->identifier] = object;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@ VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
TerrainType * TerrainTypeHandler::loadFromJson( const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
|
||||
TerrainType * info = new TerrainType;
|
||||
|
||||
info->id = TerrainId(index);
|
||||
|
@ -24,17 +24,16 @@ class DLL_LINKAGE TerrainType : public EntityT<TerrainId>
|
||||
TerrainId id;
|
||||
ui8 passabilityType;
|
||||
|
||||
const std::string & getName() const override { return identifier;}
|
||||
public:
|
||||
int32_t getIndex() const override { return id.getNum(); }
|
||||
int32_t getIconIndex() const override { return 0; }
|
||||
const std::string & getJsonKey() const override { return identifier;}
|
||||
std::string getJsonKey() const override { return identifier;}
|
||||
void registerIcons(const IconRegistar & cb) const override {}
|
||||
TerrainId getId() const override { return id;}
|
||||
void updateFrom(const JsonNode & data) {};
|
||||
|
||||
std::string getNameTextID() const;
|
||||
std::string getNameTranslated() const;
|
||||
std::string getNameTextID() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
|
||||
enum PassabilityType : ui8
|
||||
{
|
||||
|
@ -259,14 +259,14 @@ CObjectClassesHandler::ObjectContainter * CObjectClassesHandler::loadFromJson(co
|
||||
|
||||
void CObjectClassesHandler::loadObject(std::string scope, std::string name, const JsonNode & data)
|
||||
{
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name));
|
||||
auto object = loadFromJson(scope, data, VLC->modh->normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name));
|
||||
objects[object->id] = object;
|
||||
VLC->modh->identifiers.registerObject(scope, "object", name, object->id);
|
||||
}
|
||||
|
||||
void CObjectClassesHandler::loadObject(std::string scope, std::string name, const JsonNode & data, size_t index)
|
||||
{
|
||||
auto object = loadFromJson(scope, data, normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name));
|
||||
auto object = loadFromJson(scope, data, VLC->modh->normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name));
|
||||
assert(objects[(si32)index] == nullptr); // ensure that this id was not loaded before
|
||||
objects[(si32)index] = object;
|
||||
VLC->modh->identifiers.registerObject(scope, "object", name, object->id);
|
||||
|
@ -31,7 +31,7 @@ void CRmgTemplateStorage::loadObject(std::string scope, std::string name, const
|
||||
try
|
||||
{
|
||||
JsonDeserializer handler(nullptr, data);
|
||||
auto fullKey = normalizeIdentifier(scope, CModHandler::scopeBuiltin(), name); //actually it's not used
|
||||
auto fullKey = scope + ":" + name; //actually it's not used
|
||||
templates[fullKey].setId(fullKey);
|
||||
templates[fullKey].serializeJson(handler);
|
||||
templates[fullKey].setName(name);
|
||||
|
@ -201,11 +201,6 @@ SpellID CSpell::getId() const
|
||||
return id;
|
||||
}
|
||||
|
||||
const std::string & CSpell::getName() const
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
std::string CSpell::getNameTextID() const
|
||||
{
|
||||
TextIdentifier id("spell", modScope, identifier, "name");
|
||||
@ -228,9 +223,9 @@ std::string CSpell::getDescriptionTranslated(int32_t level) const
|
||||
return VLC->generaltexth->translate(getDescriptionTextID(level));
|
||||
}
|
||||
|
||||
const std::string & CSpell::getJsonKey() const
|
||||
std::string CSpell::getJsonKey() const
|
||||
{
|
||||
return identifier;
|
||||
return modScope + ':' + identifier;;
|
||||
}
|
||||
|
||||
int32_t CSpell::getIndex() const
|
||||
@ -711,6 +706,9 @@ const std::vector<std::string> & CSpellHandler::getTypeNames() const
|
||||
|
||||
CSpell * CSpellHandler::loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index)
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
assert(!scope.empty());
|
||||
|
||||
using namespace SpellConfig;
|
||||
|
||||
SpellID id(static_cast<si32>(index));
|
||||
@ -947,7 +945,8 @@ CSpell * CSpellHandler::loadFromJson(const std::string & scope, const JsonNode &
|
||||
|
||||
const si32 levelPower = levelObject.power = static_cast<si32>(levelNode["power"].Integer());
|
||||
|
||||
VLC->generaltexth->registerString(spell->getDescriptionTranslated(levelIndex), levelNode["description"].String());
|
||||
if (!spell->isCreatureAbility())
|
||||
VLC->generaltexth->registerString(spell->getDescriptionTextID(levelIndex), levelNode["description"].String());
|
||||
|
||||
levelObject.cost = static_cast<si32>(levelNode["cost"].Integer());
|
||||
levelObject.AIValue = static_cast<si32>(levelNode["aiValue"].Integer());
|
||||
|
@ -170,7 +170,6 @@ public:
|
||||
SpellID id;
|
||||
std::string identifier;
|
||||
std::string modScope;
|
||||
const std::string & getName() const override;
|
||||
public:
|
||||
enum ESpellPositiveness
|
||||
{
|
||||
@ -236,7 +235,7 @@ public:
|
||||
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
const std::string & getJsonKey() const override;
|
||||
std::string getJsonKey() const override;
|
||||
SpellID getId() const override;
|
||||
|
||||
std::string getNameTextID() const override;
|
||||
|
@ -571,7 +571,7 @@ SpellID BaseMechanics::getSpellId() const
|
||||
|
||||
std::string BaseMechanics::getSpellName() const
|
||||
{
|
||||
return owner->getName();
|
||||
return owner->getNameTranslated();
|
||||
}
|
||||
|
||||
int32_t BaseMechanics::getSpellLevel() const
|
||||
|
@ -90,7 +90,7 @@ QList<QString> RewardsWidget::getListForType(RewardType typeId)
|
||||
for(int i = 0; i < map.allowedSpell.size(); ++i)
|
||||
{
|
||||
if(map.allowedSpell[i])
|
||||
result.append(QString::fromStdString(VLC->spellh->objects.at(i)->getName()));
|
||||
result.append(QString::fromStdString(VLC->spellh->objects.at(i)->getNameTranslated()));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -42,7 +42,7 @@ MapSettings::MapSettings(MapController & ctrl, QWidget *parent) :
|
||||
}
|
||||
for(int i = 0; i < controller.map()->allowedSpell.size(); ++i)
|
||||
{
|
||||
auto * item = new QListWidgetItem(QString::fromStdString(VLC->spellh->objects[i]->getName()));
|
||||
auto * item = new QListWidgetItem(QString::fromStdString(VLC->spellh->objects[i]->getNameTranslated()));
|
||||
item->setData(Qt::UserRole, QVariant::fromValue(i));
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(controller.map()->allowedSpell[i] ? Qt::Checked : Qt::Unchecked);
|
||||
|
Loading…
Reference in New Issue
Block a user