diff --git a/lib/CArtHandler.cpp b/lib/CArtHandler.cpp index bd85d9eea..42b98fe1c 100644 --- a/lib/CArtHandler.cpp +++ b/lib/CArtHandler.cpp @@ -419,8 +419,8 @@ ArtifactPosition::ArtifactPosition(std::string slotName): auto it = artifactPositionMap.find (slotName); if (it != artifactPositionMap.end()) num = it->second; - - logMod->warn("Warning! Artifact slot %s not recognized!", slotName); + else + logMod->warn("Warning! Artifact slot %s not recognized!", slotName); } void CArtHandler::addSlot(CArtifact * art, const std::string & slotID) diff --git a/lib/mapObjects/CGHeroInstance.cpp b/lib/mapObjects/CGHeroInstance.cpp index 9a79bd8bd..98ead1869 100644 --- a/lib/mapObjects/CGHeroInstance.cpp +++ b/lib/mapObjects/CGHeroInstance.cpp @@ -243,7 +243,7 @@ CGHeroInstance::CGHeroInstance(): movement(UNINITIALIZED_MOVEMENT), portrait(UNINITIALIZED_PORTRAIT), level(1), - exp(std::numeric_limits::max()), + exp(UNINITIALIZED_EXPERIENCE), sex(std::numeric_limits::max()) { setNodeType(HERO); @@ -320,7 +320,7 @@ void CGHeroInstance::initHero(CRandomGenerator & rand) if (patrol.patrolling) patrol.initialPos = visitablePos(); - if(exp == 0xffffffff) + if(exp == UNINITIALIZED_EXPERIENCE) { initExp(rand); } @@ -1445,7 +1445,7 @@ void CGHeroInstance::serializeCommonOptions(JsonSerializeFormat & handler) handler.serializeString("biography", biographyCustom); 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()) { diff --git a/lib/mapObjects/CGHeroInstance.h b/lib/mapObjects/CGHeroInstance.h index de9581b22..8e83543da 100644 --- a/lib/mapObjects/CGHeroInstance.h +++ b/lib/mapObjects/CGHeroInstance.h @@ -82,6 +82,7 @@ public: static constexpr si32 UNINITIALIZED_PORTRAIT = -1; static constexpr si32 UNINITIALIZED_MANA = -1; static constexpr ui32 UNINITIALIZED_MOVEMENT = -1; + static constexpr TExpType UNINITIALIZED_EXPERIENCE = std::numeric_limits::max(); //std::vector artifacts; //hero's artifacts from bag //std::map artifWorn; //map; 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 diff --git a/lib/mapObjects/CGTownInstance.cpp b/lib/mapObjects/CGTownInstance.cpp index 0bb73255d..9dc6254b4 100644 --- a/lib/mapObjects/CGTownInstance.cpp +++ b/lib/mapObjects/CGTownInstance.cpp @@ -82,6 +82,11 @@ void CCreGenLeveledCastleInfo::serializeJson(JsonSerializeFormat & handler) CCreGenLeveledInfo::serializeJson(handler); } +CGDwelling::CGDwelling() + : info(nullptr) +{ +} + CGDwelling::~CGDwelling() { vstd::clear_pointer(info); diff --git a/lib/mapObjects/CGTownInstance.h b/lib/mapObjects/CGTownInstance.h index 8e14aaea5..47b497431 100644 --- a/lib/mapObjects/CGTownInstance.h +++ b/lib/mapObjects/CGTownInstance.h @@ -68,6 +68,7 @@ public: CSpecObjInfo * info; //random dwelling options; not serialized TCreaturesSet creatures; //creatures[level] -> + CGDwelling(); ~CGDwelling() override; void initRandomObjectInfo(); diff --git a/lib/mapping/MapFormatH3M.cpp b/lib/mapping/MapFormatH3M.cpp index 6b9c5b70d..2a2934646 100644 --- a/lib/mapping/MapFormatH3M.cpp +++ b/lib/mapping/MapFormatH3M.cpp @@ -1609,7 +1609,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(const ObjectInstanceID & idToBeGiven, } else { - nhi->exp = 0xffffffff; + nhi->exp = CGHeroInstance::UNINITIALIZED_EXPERIENCE; } } else @@ -1619,7 +1619,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(const ObjectInstanceID & idToBeGiven, //0 means "not set" in <=AB maps if(!nhi->exp) { - nhi->exp = 0xffffffff; + nhi->exp = CGHeroInstance::UNINITIALIZED_EXPERIENCE; } }