diff --git a/client/CHeroWindow.cpp b/client/CHeroWindow.cpp index c81bb34f2..616583435 100644 --- a/client/CHeroWindow.cpp +++ b/client/CHeroWindow.cpp @@ -6,8 +6,8 @@ #include "CHeroWindow.h" #include "CMessage.h" #include "CKingdomInterface.h" -#include "SDL.h" -#include "SDL_Extensions.h" +#include +#include #include "CBitmapHandler.h" #include "Graphics.h" #include "CSpellWindow.h" @@ -51,7 +51,7 @@ const boost::shared_ptr CHeroWithMaybePickedArtifact::getAllBonuses(c boost::shared_ptr bonusesFromPickedUpArtifact; CArtifactsOfHero::SCommonPart *cp = cww->artSets.size() ? cww->artSets.front()->commonInfo : NULL; - if(cp && cp->src.art && cp->src.AOH && cp->src.AOH->getHero() == hero) + if(cp && cp->src.art && cp->src.valid() && cp->src.AOH && cp->src.AOH->getHero() == hero) { bonusesFromPickedUpArtifact = cp->src.art->getAllBonuses(selector, limit, hero); } diff --git a/client/GUIClasses.cpp b/client/GUIClasses.cpp index 05b8bd45b..fe7545f9d 100644 --- a/client/GUIClasses.cpp +++ b/client/GUIClasses.cpp @@ -4725,7 +4725,7 @@ void CArtPlace::clickLeft(tribool down, bool previousState) void CArtPlace::clickRight(tribool down, bool previousState) { - if(down && ourArt && !locked && text.size()) //if there is no description or it's a lock, do nothing ;] + if(down && ourArt && !locked && text.size() && !picked) //if there is no description or it's a lock, do nothing ;] { if (slotID < 19) { @@ -4748,6 +4748,7 @@ void CArtPlace::clickRight(tribool down, bool previousState) tlog3 << "More than one possibility of assembling... taking only first\n"; break; } + return; } // Otherwise if the artifact can be diasassembled, display dialog. @@ -4759,6 +4760,7 @@ void CArtPlace::clickRight(tribool down, bool previousState) false, boost::bind(&CCallback::assembleArtifacts, LOCPLINT->cb, ourOwner->curHero, slotID, false, 0), 0); + return; } } } @@ -5416,6 +5418,9 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact updateSlot(dst.slot); if(src.hero == curHero || dst.hero == curHero) //we need to update all slots, artifact might be combined and affect more slots updateWornSlots(false); + + if (src.hero != curHero && dst.hero != curHero) + return; if(commonInfo->src == src) //artifact was taken from us { @@ -5454,7 +5459,9 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact updateParentWindow(); } } - else if(src.slot >= Arts::BACKPACK_START && src.slot < commonInfo->src.slotID && src.hero == commonInfo->src.AOH->curHero) //artifact taken from before currently picked one + else if(src.slot >= Arts::BACKPACK_START && + src.slot < commonInfo->src.slotID && + src.hero == commonInfo->src.AOH->curHero) //artifact taken from before currently picked one { //int fixedSlot = src.hero->getArtPos(commonInfo->src.art); commonInfo->src.slotID--; @@ -5521,7 +5528,7 @@ void CArtifactsOfHero::artifactDisassembled(const ArtifactLocation &al) void CArtifactsOfHero::updateWornSlots(bool redrawParent /*= true*/) { - for(int i = 0; i < Arts::BACKPACK_START; i++) + for(int i = 0; i < artWorn.size(); i++) updateSlot(i);