Browse Source

Merge pull request #229 from vmarkovtsev/develop

Fix freshly recruited hero phantom in castle entrance
ArseniyShestakov 9 năm trước cách đây
mục cha
commit
1c2a40592a
2 tập tin đã thay đổi với 10 bổ sung4 xóa
  1. 9 3
      client/NetPacksClient.cpp
  2. 1 1
      client/mapHandler.h

+ 9 - 3
client/NetPacksClient.cpp

@@ -494,13 +494,19 @@ void HeroRecruited::applyCl( CClient *cl )
 		logNetwork->errorStream() << "Something wrong with hero recruited!";
 	}
 
-	CGI->mh->printObject(h);
-
-	if(vstd::contains(cl->playerint,h->tempOwner))
+	bool needsPrinting = true;
+	if(vstd::contains(cl->playerint, h->tempOwner))
 	{
 		cl->playerint[h->tempOwner]->heroCreated(h);
 		if(const CGTownInstance *t = GS(cl)->getTown(tid))
+		{
 			cl->playerint[h->tempOwner]->heroInGarrisonChange(t);
+			needsPrinting = false;
+		}
+	}
+	if (needsPrinting)
+	{
+		CGI->mh->printObject(h);
 	}
 }
 

+ 1 - 1
client/mapHandler.h

@@ -386,7 +386,7 @@ public:
 
 	void getTerrainDescr(const int3 &pos, std::string & out, bool terName); //if tername == false => empty string when tile is clear
 	CGObjectInstance * createObject(int id, int subid, int3 pos, int owner=254); //creates a new object with a certain id and subid
-	bool printObject(const CGObjectInstance * obj, bool fadein = false); //puts appropriate things to ttiles, so obj will be visible on map
+	bool printObject(const CGObjectInstance * obj, bool fadein = false); //puts appropriate things to tiles, so obj will be visible on map
 	bool hideObject(const CGObjectInstance * obj, bool fadeout = false); //removes appropriate things from ttiles, so obj will be no longer visible on map (but still will exist)
 	bool removeObject(CGObjectInstance * obj, bool fadeout = false); //removes object from each place in VCMI (I hope)
 	void init();