Ivan Savenko пре 14 година
родитељ
комит
11fade5e67
2 измењених фајлова са 13 додато и 6 уклоњено
  1. 3 3
      client/CHeroWindow.cpp
  2. 10 3
      client/GUIClasses.cpp

+ 3 - 3
client/CHeroWindow.cpp

@@ -6,8 +6,8 @@
 #include "CHeroWindow.h"
 #include "CHeroWindow.h"
 #include "CMessage.h"
 #include "CMessage.h"
 #include "CKingdomInterface.h"
 #include "CKingdomInterface.h"
-#include "SDL.h"
-#include "SDL_Extensions.h"
+#include <SDL.h>
+#include <SDL_Extensions.h>
 #include "CBitmapHandler.h"
 #include "CBitmapHandler.h"
 #include "Graphics.h"
 #include "Graphics.h"
 #include "CSpellWindow.h"
 #include "CSpellWindow.h"
@@ -51,7 +51,7 @@ const boost::shared_ptr<BonusList> CHeroWithMaybePickedArtifact::getAllBonuses(c
 	boost::shared_ptr<BonusList> bonusesFromPickedUpArtifact;
 	boost::shared_ptr<BonusList> bonusesFromPickedUpArtifact;
 
 
 	CArtifactsOfHero::SCommonPart *cp = cww->artSets.size() ? cww->artSets.front()->commonInfo : NULL;
 	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);
 		bonusesFromPickedUpArtifact = cp->src.art->getAllBonuses(selector, limit, hero);
 	}
 	}

+ 10 - 3
client/GUIClasses.cpp

@@ -4725,7 +4725,7 @@ void CArtPlace::clickLeft(tribool down, bool previousState)
 
 
 void CArtPlace::clickRight(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) 
 		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";
 						tlog3 << "More than one possibility of assembling... taking only first\n";
 						break;
 						break;
 					}
 					}
+					return;
 				}
 				}
 
 
 				// Otherwise if the artifact can be diasassembled, display dialog.
 				// Otherwise if the artifact can be diasassembled, display dialog.
@@ -4759,6 +4760,7 @@ void CArtPlace::clickRight(tribool down, bool previousState)
 						false,
 						false,
 						boost::bind(&CCallback::assembleArtifacts, LOCPLINT->cb, ourOwner->curHero, slotID, false, 0),
 						boost::bind(&CCallback::assembleArtifacts, LOCPLINT->cb, ourOwner->curHero, slotID, false, 0),
 						0);
 						0);
+					return;
 				}
 				}
 			}
 			}
 		}
 		}
@@ -5416,6 +5418,9 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact
 		updateSlot(dst.slot);
 		updateSlot(dst.slot);
 	if(src.hero == curHero  ||  dst.hero == curHero) //we need to update all slots, artifact might be combined and affect more slots
 	if(src.hero == curHero  ||  dst.hero == curHero) //we need to update all slots, artifact might be combined and affect more slots
 		updateWornSlots(false);
 		updateWornSlots(false);
+	
+	if (src.hero != curHero && dst.hero != curHero)
+		return;
 
 
 	if(commonInfo->src == src) //artifact was taken from us
 	if(commonInfo->src == src) //artifact was taken from us
 	{
 	{
@@ -5454,7 +5459,9 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact
 			updateParentWindow();
 			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);
 		//int fixedSlot = src.hero->getArtPos(commonInfo->src.art);
 		commonInfo->src.slotID--;
 		commonInfo->src.slotID--;
@@ -5521,7 +5528,7 @@ void CArtifactsOfHero::artifactDisassembled(const ArtifactLocation &al)
 
 
 void CArtifactsOfHero::updateWornSlots(bool redrawParent /*= true*/)
 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);
 		updateSlot(i);