From 7ac4e6ed1889b81227164ddb88cea164f0d6bf02 Mon Sep 17 00:00:00 2001 From: Vadim Markovtsev Date: Sun, 2 Oct 2016 16:27:01 +0200 Subject: [PATCH] Fix freshly recruited hero phantom in castle entrance --- client/NetPacksClient.cpp | 12 +++++++++--- client/mapHandler.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/NetPacksClient.cpp b/client/NetPacksClient.cpp index 6ee78e47a..3149fdbcd 100644 --- a/client/NetPacksClient.cpp +++ b/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); } } diff --git a/client/mapHandler.h b/client/mapHandler.h index a5b0ed796..024d3f032 100644 --- a/client/mapHandler.h +++ b/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();