diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index 82fc24b4b..51e0ec63c 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -1849,7 +1849,10 @@ void CGameState::initMapObjects() for(CGObjectInstance *obj : map->objects) { if(obj) + { + logGlobal->traceStream() << boost::format ("Calling Init for object %d, %d") % obj->ID % obj->subID; obj->initObj(); + } } for(CGObjectInstance *obj : map->objects) { @@ -3518,5 +3521,6 @@ CPathfinder::CPathfinder(CPathsInfo &_out, CGameState *_gs, const CGHeroInstance CRandomGenerator & CGameState::getRandomGenerator() { + logGlobal->traceStream() << "Fetching CGameState::rand with seed " << rand.nextInt(); return rand; } diff --git a/lib/mapObjects/CommonConstructors.cpp b/lib/mapObjects/CommonConstructors.cpp index e4432db8a..3241abb56 100644 --- a/lib/mapObjects/CommonConstructors.cpp +++ b/lib/mapObjects/CommonConstructors.cpp @@ -271,6 +271,8 @@ BankConfig CBankInstanceConstructor::generateConfig(const JsonNode & level, CRan void CBankInstanceConstructor::configureObject(CGObjectInstance * object, CRandomGenerator & rng) const { + //logGlobal->debugStream() << "Seed used to configure bank is " << rng.nextInt(); + auto bank = dynamic_cast(object); bank->resetDuration = bankResetDuration; @@ -282,6 +284,7 @@ void CBankInstanceConstructor::configureObject(CGObjectInstance * object, CRando assert(totalChance != 0); si32 selectedChance = rng.nextInt(totalChance - 1); + //logGlobal->debugStream() << "Selected chance for bank config is " << selectedChance; for (auto & node : levels) { diff --git a/lib/mapObjects/MiscObjects.cpp b/lib/mapObjects/MiscObjects.cpp index 57680916b..13e04b422 100644 --- a/lib/mapObjects/MiscObjects.cpp +++ b/lib/mapObjects/MiscObjects.cpp @@ -632,6 +632,11 @@ std::string CGResource::getHoverText(PlayerColor player) const return VLC->generaltexth->restypes[subID]; } +CGResource::CGResource() +{ + amount = 0; +} + void CGResource::initObj() { blockVisit = true; diff --git a/lib/mapObjects/MiscObjects.h b/lib/mapObjects/MiscObjects.h index 802aabd26..909953f64 100644 --- a/lib/mapObjects/MiscObjects.h +++ b/lib/mapObjects/MiscObjects.h @@ -182,6 +182,7 @@ public: ui32 amount; //0 if random std::string message; + CGResource(); void onHeroVisit(const CGHeroInstance * h) const override; void initObj() override; void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override; diff --git a/lib/rmg/CRmgTemplateZone.cpp b/lib/rmg/CRmgTemplateZone.cpp index d2c2fd179..e7117a365 100644 --- a/lib/rmg/CRmgTemplateZone.cpp +++ b/lib/rmg/CRmgTemplateZone.cpp @@ -620,6 +620,7 @@ bool CRmgTemplateZone::addMonster(CMapGenerator* gen, int3 &pos, si32 strength, auto guard = new CGCreature(); guard->ID = Obj::MONSTER; guard->subID = creId; + guard->character = 1; //MUST be initialized or switch will diverge auto hlp = new CStackInstance(creId, amount); //will be set during initialization guard->putStack(SlotID(0), hlp);