1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

fix regressions from modernization

This commit is contained in:
Ivan Savenko 2023-02-15 12:10:39 +02:00
parent 5d98471d12
commit f65c6ad275
6 changed files with 14 additions and 7 deletions

View File

@ -419,8 +419,8 @@ ArtifactPosition::ArtifactPosition(std::string slotName):
auto it = artifactPositionMap.find (slotName); auto it = artifactPositionMap.find (slotName);
if (it != artifactPositionMap.end()) if (it != artifactPositionMap.end())
num = it->second; num = it->second;
else
logMod->warn("Warning! Artifact slot %s not recognized!", slotName); logMod->warn("Warning! Artifact slot %s not recognized!", slotName);
} }
void CArtHandler::addSlot(CArtifact * art, const std::string & slotID) void CArtHandler::addSlot(CArtifact * art, const std::string & slotID)

View File

@ -243,7 +243,7 @@ CGHeroInstance::CGHeroInstance():
movement(UNINITIALIZED_MOVEMENT), movement(UNINITIALIZED_MOVEMENT),
portrait(UNINITIALIZED_PORTRAIT), portrait(UNINITIALIZED_PORTRAIT),
level(1), level(1),
exp(std::numeric_limits<TExpType>::max()), exp(UNINITIALIZED_EXPERIENCE),
sex(std::numeric_limits<ui8>::max()) sex(std::numeric_limits<ui8>::max())
{ {
setNodeType(HERO); setNodeType(HERO);
@ -320,7 +320,7 @@ void CGHeroInstance::initHero(CRandomGenerator & rand)
if (patrol.patrolling) if (patrol.patrolling)
patrol.initialPos = visitablePos(); patrol.initialPos = visitablePos();
if(exp == 0xffffffff) if(exp == UNINITIALIZED_EXPERIENCE)
{ {
initExp(rand); initExp(rand);
} }
@ -1445,7 +1445,7 @@ void CGHeroInstance::serializeCommonOptions(JsonSerializeFormat & handler)
handler.serializeString("biography", biographyCustom); handler.serializeString("biography", biographyCustom);
handler.serializeInt("experience", exp, 0); handler.serializeInt("experience", exp, 0);
if(!handler.saving && exp != 0xffffffff) //do not gain levels if experience is not initialized if(!handler.saving && exp != UNINITIALIZED_EXPERIENCE) //do not gain levels if experience is not initialized
{ {
while (gainsLevel()) while (gainsLevel())
{ {

View File

@ -82,6 +82,7 @@ public:
static constexpr si32 UNINITIALIZED_PORTRAIT = -1; static constexpr si32 UNINITIALIZED_PORTRAIT = -1;
static constexpr si32 UNINITIALIZED_MANA = -1; static constexpr si32 UNINITIALIZED_MANA = -1;
static constexpr ui32 UNINITIALIZED_MOVEMENT = -1; static constexpr ui32 UNINITIALIZED_MOVEMENT = -1;
static constexpr TExpType UNINITIALIZED_EXPERIENCE = std::numeric_limits<TExpType>::max();
//std::vector<const CArtifact*> artifacts; //hero's artifacts from bag //std::vector<const CArtifact*> artifacts; //hero's artifacts from bag
//std::map<ui16, const CArtifact*> artifWorn; //map<position,artifact_id>; positions: 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5 //std::map<ui16, const CArtifact*> artifWorn; //map<position,artifact_id>; positions: 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5

View File

@ -82,6 +82,11 @@ void CCreGenLeveledCastleInfo::serializeJson(JsonSerializeFormat & handler)
CCreGenLeveledInfo::serializeJson(handler); CCreGenLeveledInfo::serializeJson(handler);
} }
CGDwelling::CGDwelling()
: info(nullptr)
{
}
CGDwelling::~CGDwelling() CGDwelling::~CGDwelling()
{ {
vstd::clear_pointer(info); vstd::clear_pointer(info);

View File

@ -68,6 +68,7 @@ public:
CSpecObjInfo * info; //random dwelling options; not serialized CSpecObjInfo * info; //random dwelling options; not serialized
TCreaturesSet creatures; //creatures[level] -> <vector of alternative ids (base creature and upgrades, creatures amount> TCreaturesSet creatures; //creatures[level] -> <vector of alternative ids (base creature and upgrades, creatures amount>
CGDwelling();
~CGDwelling() override; ~CGDwelling() override;
void initRandomObjectInfo(); void initRandomObjectInfo();

View File

@ -1609,7 +1609,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(const ObjectInstanceID & idToBeGiven,
} }
else else
{ {
nhi->exp = 0xffffffff; nhi->exp = CGHeroInstance::UNINITIALIZED_EXPERIENCE;
} }
} }
else else
@ -1619,7 +1619,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(const ObjectInstanceID & idToBeGiven,
//0 means "not set" in <=AB maps //0 means "not set" in <=AB maps
if(!nhi->exp) if(!nhi->exp)
{ {
nhi->exp = 0xffffffff; nhi->exp = CGHeroInstance::UNINITIALIZED_EXPERIENCE;
} }
} }