mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
fix regressions from modernization
This commit is contained in:
parent
5d98471d12
commit
f65c6ad275
@ -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)
|
||||
|
@ -243,7 +243,7 @@ CGHeroInstance::CGHeroInstance():
|
||||
movement(UNINITIALIZED_MOVEMENT),
|
||||
portrait(UNINITIALIZED_PORTRAIT),
|
||||
level(1),
|
||||
exp(std::numeric_limits<TExpType>::max()),
|
||||
exp(UNINITIALIZED_EXPERIENCE),
|
||||
sex(std::numeric_limits<ui8>::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())
|
||||
{
|
||||
|
@ -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<TExpType>::max();
|
||||
|
||||
//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
|
||||
|
@ -82,6 +82,11 @@ void CCreGenLeveledCastleInfo::serializeJson(JsonSerializeFormat & handler)
|
||||
CCreGenLeveledInfo::serializeJson(handler);
|
||||
}
|
||||
|
||||
CGDwelling::CGDwelling()
|
||||
: info(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
CGDwelling::~CGDwelling()
|
||||
{
|
||||
vstd::clear_pointer(info);
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
CSpecObjInfo * info; //random dwelling options; not serialized
|
||||
TCreaturesSet creatures; //creatures[level] -> <vector of alternative ids (base creature and upgrades, creatures amount>
|
||||
|
||||
CGDwelling();
|
||||
~CGDwelling() override;
|
||||
|
||||
void initRandomObjectInfo();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user