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

Fix issues reported by Sonar, review fixes

This commit is contained in:
Ivan Savenko
2025-04-21 18:41:01 +03:00
parent f3a57f754c
commit 4e8e85e3e4
26 changed files with 94 additions and 107 deletions

View File

@ -665,21 +665,16 @@ void CGArtifact::initObj(vstd::RNG & rand)
blockVisit = true;
if(ID == Obj::ARTIFACT)
{
assert(getArtifactType().hasValue());
if (!storedArtifact.hasValue())
setArtifactInstance(cb->gameState().createArtifact(ArtifactID()));
auto * artifact = cb->gameState().getArtInstance(storedArtifact);
if(!artifact->getType())
artifact->setType(getArtifactType().toArtifact());
setArtifactInstance(cb->gameState().createArtifact(getArtifactType()));
}
if(ID == Obj::SPELL_SCROLL)
subID = 1;
assert(getArtifactInstance()->getType());
assert(!getArtifactInstance()->getParentNodes().empty());
//assert(storedArtifact->artType->id == subID); //this does not stop desync
}
std::string CGArtifact::getObjectName() const