Browse Source

Add comments about getArtPlace - it is a bit dangerouse

AlexVinS 10 years ago
parent
commit
c135591f81
2 changed files with 3 additions and 3 deletions
  1. 2 2
      client/widgets/CArtifactHolder.cpp
  2. 1 1
      client/widgets/CArtifactHolder.h

+ 2 - 2
client/widgets/CArtifactHolder.cpp

@@ -306,7 +306,7 @@ void CArtPlace::deselect ()
 		{
 			auto place = ourOwner->getArtPlace(i);
 			
-			if(nullptr != place)
+			if(nullptr != place)//getArtPlace may return null
 				place->pickSlot(false);
 		}			
 	}
@@ -778,7 +778,7 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact
 			if(dst.isHolder(aoh->curHero))
 			{
 				commonInfo->src.AOH = aoh;
-				if((ap = aoh->getArtPlace(dst.slot)))
+				if((ap = aoh->getArtPlace(dst.slot)))//getArtPlace may return null
 					break;
 			}
 		}

+ 1 - 1
client/widgets/CArtifactHolder.h

@@ -118,7 +118,7 @@ public:
 	void artifactRemoved(const ArtifactLocation &al);
 	void artifactAssembled(const ArtifactLocation &al);
 	void artifactDisassembled(const ArtifactLocation &al);
-	CArtPlace *getArtPlace(int slot);
+	CArtPlace *getArtPlace(int slot);//may return null
 
 	void setHero(const CGHeroInstance * hero);
 	const CGHeroInstance *getHero() const;