mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-21 17:17:06 +02:00
introduce getModScope
method toEntity
class and subclasses
This commit is contained in:
parent
18e96171de
commit
c34956e912
@ -40,6 +40,7 @@ public:
|
||||
virtual int32_t getIndex() const = 0;
|
||||
virtual int32_t getIconIndex() const = 0;
|
||||
virtual std::string getJsonKey() const = 0;
|
||||
virtual std::string getModScope() const = 0;
|
||||
virtual std::string getNameTranslated() const = 0;
|
||||
virtual std::string getNameTextID() const = 0;
|
||||
|
||||
|
@ -73,6 +73,11 @@ std::string BattleFieldInfo::getJsonKey() const
|
||||
return modScope + ':' + identifier;
|
||||
}
|
||||
|
||||
std::string BattleFieldInfo::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
std::string BattleFieldInfo::getNameTextID() const
|
||||
{
|
||||
return name;
|
||||
|
@ -52,6 +52,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
std::string getNameTextID() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
|
@ -106,6 +106,11 @@ std::string CArtifact::getJsonKey() const
|
||||
return modScope + ':' + identifier;
|
||||
}
|
||||
|
||||
std::string CArtifact::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
void CArtifact::registerIcons(const IconRegistar & cb) const
|
||||
{
|
||||
cb(getIconIndex(), 0, "ARTIFACT", image);
|
||||
|
@ -106,6 +106,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
ArtifactID getId() const override;
|
||||
const IBonusBearer * getBonusBearer() const override;
|
||||
|
@ -61,6 +61,11 @@ std::string CCreature::getJsonKey() const
|
||||
return modScope + ':' + identifier;
|
||||
}
|
||||
|
||||
std::string CCreature::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
void CCreature::registerIcons(const IconRegistar & cb) const
|
||||
{
|
||||
cb(getIconIndex(), 0, "CPRSMALL", smallIconName);
|
||||
|
@ -131,6 +131,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
CreatureID getId() const override;
|
||||
const IBonusBearer * getBonusBearer() const override;
|
||||
|
@ -53,6 +53,11 @@ std::string CHero::getJsonKey() const
|
||||
return modScope + ':' + identifier;
|
||||
}
|
||||
|
||||
std::string CHero::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
HeroTypeID CHero::getId() const
|
||||
{
|
||||
return ID;
|
||||
@ -189,6 +194,11 @@ std::string CHeroClass::getJsonKey() const
|
||||
return modScope + ':' + identifier;
|
||||
}
|
||||
|
||||
std::string CHeroClass::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
HeroClassID CHeroClass::getId() const
|
||||
{
|
||||
return id;
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
HeroTypeID getId() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
|
||||
@ -145,6 +146,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
HeroClassID getId() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
|
||||
|
@ -50,6 +50,11 @@ std::string PlayerState::getJsonKey() const
|
||||
return color.toString();
|
||||
}
|
||||
|
||||
std::string PlayerState::getModScope() const
|
||||
{
|
||||
return "core";
|
||||
}
|
||||
|
||||
std::string PlayerState::getNameTranslated() const
|
||||
{
|
||||
return VLC->generaltexth->translate(getNameTextID());
|
||||
|
@ -85,6 +85,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
std::string getNameTextID() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
|
@ -64,6 +64,11 @@ std::string CSkill::getJsonKey() const
|
||||
return modScope + ':' + identifier;
|
||||
}
|
||||
|
||||
std::string CSkill::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
std::string CSkill::getDescriptionTextID(int level) const
|
||||
{
|
||||
TextIdentifier id("skill", modScope, identifier, "description", NSecondarySkill::levels[level]);
|
||||
|
@ -52,6 +52,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
SecondarySkill getId() const override;
|
||||
|
||||
|
@ -31,6 +31,11 @@ std::string ObstacleInfo::getJsonKey() const
|
||||
return identifier;
|
||||
}
|
||||
|
||||
std::string ObstacleInfo::getModScope() const
|
||||
{
|
||||
return "core";
|
||||
}
|
||||
|
||||
std::string ObstacleInfo::getNameTranslated() const
|
||||
{
|
||||
return identifier;
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
std::string getNameTranslated() const override;
|
||||
std::string getNameTextID() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
|
@ -74,6 +74,11 @@ std::string RiverType::getJsonKey() const
|
||||
return modScope + ":" + identifier;
|
||||
}
|
||||
|
||||
std::string RiverType::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
std::string RiverType::getNameTextID() const
|
||||
{
|
||||
return TextIdentifier( "river", modScope, identifier, "name" ).get();
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
int32_t getIndex() const override { return id.getNum(); }
|
||||
int32_t getIconIndex() const override { return 0; }
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override {}
|
||||
RiverId getId() const override { return id;}
|
||||
void updateFrom(const JsonNode & data) {};
|
||||
|
@ -65,6 +65,11 @@ std::string RoadType::getJsonKey() const
|
||||
return modScope + ":" + identifier;
|
||||
}
|
||||
|
||||
std::string RoadType::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
std::string RoadType::getNameTextID() const
|
||||
{
|
||||
return TextIdentifier( "road", modScope, identifier, "name" ).get();
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
int32_t getIndex() const override { return id.getNum(); }
|
||||
int32_t getIconIndex() const override { return 0; }
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override {}
|
||||
RoadId getId() const override { return id;}
|
||||
void updateFrom(const JsonNode & data) {};
|
||||
|
@ -191,6 +191,11 @@ std::string TerrainType::getJsonKey() const
|
||||
return modScope + ":" + identifier;
|
||||
}
|
||||
|
||||
std::string TerrainType::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
std::string TerrainType::getNameTextID() const
|
||||
{
|
||||
return TextIdentifier( "terrain", modScope, identifier, "name" ).get();
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
int32_t getIndex() const override { return id.getNum(); }
|
||||
int32_t getIconIndex() const override { return 0; }
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override {}
|
||||
TerrainId getId() const override { return id;}
|
||||
void updateFrom(const JsonNode & data) {};
|
||||
|
@ -41,6 +41,11 @@ std::string CFaction::getJsonKey() const
|
||||
return modScope + ':' + identifier;
|
||||
}
|
||||
|
||||
std::string CFaction::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
void CFaction::registerIcons(const IconRegistar & cb) const
|
||||
{
|
||||
if(town)
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
void registerIcons(const IconRegistar & cb) const override;
|
||||
FactionID getId() const override;
|
||||
|
||||
|
@ -200,6 +200,11 @@ std::string CSpell::getJsonKey() const
|
||||
return modScope + ':' + identifier;
|
||||
}
|
||||
|
||||
std::string CSpell::getModScope() const
|
||||
{
|
||||
return modScope;
|
||||
}
|
||||
|
||||
int32_t CSpell::getIndex() const
|
||||
{
|
||||
return id.toEnum();
|
||||
|
@ -228,6 +228,7 @@ public:
|
||||
int32_t getIndex() const override;
|
||||
int32_t getIconIndex() const override;
|
||||
std::string getJsonKey() const override;
|
||||
std::string getModScope() const override;
|
||||
SpellID getId() const override;
|
||||
|
||||
std::string getNameTextID() const override;
|
||||
|
@ -616,17 +616,17 @@ ModCompatibilityInfo MapController::modAssessmentMap(const CMap & map)
|
||||
|
||||
auto extractEntityMod = [&result](const auto & entity)
|
||||
{
|
||||
auto modName = QString::fromStdString(entity->getJsonKey()).split(":").at(0).toStdString();
|
||||
if(modName != "core")
|
||||
result[modName] = VLC->modh->getModInfo(modName).getVerificationInfo();
|
||||
auto modScope = entity->getModScope();
|
||||
if(modScope != "core")
|
||||
result[modScope] = VLC->modh->getModInfo(modScope).getVerificationInfo();
|
||||
};
|
||||
|
||||
for(auto obj : map.objects)
|
||||
{
|
||||
auto handler = obj->getObjectHandler();
|
||||
auto modName = QString::fromStdString(handler->getJsonKey()).split(":").at(0).toStdString();
|
||||
if(modName != "core")
|
||||
result[modName] = VLC->modh->getModInfo(modName).getVerificationInfo();
|
||||
auto modScope = QString::fromStdString(handler->getJsonKey()).split(":").at(0).toStdString();
|
||||
if(modScope != "core")
|
||||
result[modScope] = VLC->modh->getModInfo(modScope).getVerificationInfo();
|
||||
|
||||
if(obj->ID == Obj::TOWN || obj->ID == Obj::RANDOM_TOWN)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user