瀏覽代碼

Stability & regression fixes

Ivan Savenko 6 月之前
父節點
當前提交
77845f74bc
共有 3 個文件被更改,包括 8 次插入5 次删除
  1. 1 1
      AI/Nullkiller/AIUtility.cpp
  2. 3 0
      lib/gameState/CGameState.cpp
  3. 4 4
      lib/networkPacks/NetPacksLib.cpp

+ 1 - 1
AI/Nullkiller/AIUtility.cpp

@@ -672,7 +672,7 @@ bool shouldVisit(const Nullkiller * ai, const CGHeroInstance * h, const CGObject
 		{
 			if(q.obj == obj->id)
 			{
-				if(q.getQuest(cb)->checkQuest(h))
+				if(q.getQuest(ai->cb.get())->checkQuest(h))
 					return true; //we completed the quest
 				else
 					return false; //we can't complete this quest

+ 3 - 0
lib/gameState/CGameState.cpp

@@ -1578,6 +1578,9 @@ void CGameState::restoreBonusSystemTree()
 	for(auto & art : map->getArtifacts())
 		art->attachToBonusSystem(this);
 
+	for(auto & heroID : map->getHeroesInPool())
+		map->tryGetFromHeroPool(heroID)->artDeserializationFix(this, map->tryGetFromHeroPool(heroID));
+
 	if (campaign)
 		campaign->setGamestate(this);
 }

+ 4 - 4
lib/networkPacks/NetPacksLib.cpp

@@ -1217,16 +1217,17 @@ void RemoveObject::applyGs(CGameState *gs)
 
 			beatenHero->setVisitedTown(nullptr, false);
 		}
-		//return hero to the pool, so he may reappear in tavern
 
+		//return hero to the pool, so he may reappear in tavern
 		gs->heroesPool->addHeroToPool(beatenHero->getHeroTypeID());
+		gs->getMap().addToHeroPool(beatenHero);
 
 		//If hero on Boat is removed, the Boat disappears
 		if(beatenHero->inBoat())
 		{
-			beatenHero->detachFrom(*beatenHero->getBoat());
-			gs->getMap().eraseObject(beatenHero->getBoat()->id);
+			auto boat = beatenHero->getBoat();
 			beatenHero->setBoat(nullptr);
+			gs->getMap().eraseObject(boat->id);
 		}
 		return;
 	}
@@ -1242,7 +1243,6 @@ void RemoveObject::applyGs(CGameState *gs)
 		}
 	}
 
-
 	gs->getMap().eraseObject(objectID);
 	gs->getMap().calculateGuardingGreaturePositions();//FIXME: excessive, update only affected tiles
 }