From 2ba04274328d39e05c1bd89740d80e3bfb13d5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Fri, 28 Sep 2012 20:49:23 +0000 Subject: [PATCH] * Fixed #1096 * serializing icon index, otherwise creature portraits are gone after loading a game * VCAI: fixed crash on attempting revisiting a boat (that is no longer present because it was boarded) * Fixed strange crash with "neutral hero" (there should be no such thing... but somehow it appears, needs further investigation) --- AI/VCAI/VCAI.cpp | 4 ++++ client/mapHandler.cpp | 6 ++++++ lib/CCreatureHandler.h | 5 +++-- lib/NetPacksLib.cpp | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index 3770cdc7d..de2537635 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -3539,6 +3539,10 @@ bool shouldVisit(HeroPtr h, const CGObjectInstance * obj) case Obj::MAGIC_WELL: return h->mana < h->manaLimit(); break; + + case Obj::BOAT: + return false; + //Boats are handled by pathfinder } if (obj->wasVisited(*h)) //it must pointer to hero instance, heroPtr calls function wasVisited(ui8 player); diff --git a/client/mapHandler.cpp b/client/mapHandler.cpp index c6dcee79f..034d69849 100644 --- a/client/mapHandler.cpp +++ b/client/mapHandler.cpp @@ -568,6 +568,12 @@ void CMapHandler::terrainRect( int3 top_tile, ui8 anim, const std::vector< std:: if(themp) //hero { + if(themp->tempOwner >= GameConstants::PLAYER_LIMIT) //Neutral hero? + { + tlog1 << "A neutral hero (" << themp->name << ") at " << themp->pos << ". Should not happen!\n"; + continue; + } + dir = themp->moveDir; //pick graphics of hero (or boat if hero is sailing) diff --git a/lib/CCreatureHandler.h b/lib/CCreatureHandler.h index eb079d083..33945bcb5 100644 --- a/lib/CCreatureHandler.h +++ b/lib/CCreatureHandler.h @@ -105,9 +105,10 @@ public: & cost & upgradeNames & upgrades & fightValue & AIValue & growth & hordeGrowth & ammMin & ammMax & level - & abilityText & abilityRefs & animDefName & advMapDef - & idNumber & faction + & abilityText & abilityRefs & animDefName & advMapDef; + h & iconIndex; + h & idNumber & faction & timeBetweenFidgets & walkAnimationTime & attackAnimationTime & flightAnimationDistance & upperRightMissleOffsetX & rightMissleOffsetX & lowerRightMissleOffsetX & upperRightMissleOffsetY & rightMissleOffsetY & lowerRightMissleOffsetY & missleFrameAngles & troopCountLocationOffset & attackClimaxFrame; diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index 0f0d7ac97..167e750bd 100644 --- a/lib/NetPacksLib.cpp +++ b/lib/NetPacksLib.cpp @@ -815,7 +815,7 @@ DLL_LINKAGE void AssembledArtifact::applyGs( CGameState *gs ) CArtifactInstance *constituentInstance = artSet->getArt(pos); //move constituent from hero to be part of new, combined artifact - constituentInstance->removeFrom(al); + constituentInstance->removeFrom(ArtifactLocation(al.artHolder, pos)); combinedArt->addAsConstituent(constituentInstance, pos); if(!vstd::contains(combinedArt->artType->possibleSlots[artSet->bearerType()], al.slot) && vstd::contains(combinedArt->artType->possibleSlots[artSet->bearerType()], pos)) al.slot = pos;