From 88e9dec9740f8a613d9593dc82578d81db660c92 Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Wed, 7 Mar 2012 14:05:54 +0000 Subject: [PATCH] Fixed Thieves Guild window showing for all players. It needed 11 files modified... :/ --- AI/VCAI/VCAI.cpp | 6 ++++++ AI/VCAI/VCAI.h | 1 + client/CPlayerInterface.cpp | 7 +++++++ client/CPlayerInterface.h | 1 + client/Client.h | 2 +- client/NetPacksClient.cpp | 6 ++---- lib/CObjectHandler.cpp | 2 +- lib/IGameCallback.h | 2 +- lib/IGameEventsReceiver.h | 1 + server/CGameHandler.cpp | 5 +++-- server/CGameHandler.h | 2 +- 11 files changed, 25 insertions(+), 10 deletions(-) diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index cfda09a6b..3ae1e4151 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -435,6 +435,12 @@ void VCAI::showTavernWindow(const CGObjectInstance *townOrTavern) LOG_ENTRY; } +void VCAI::showThievesGuildWindow (const CGObjectInstance * obj) +{ + NET_EVENT_HANDLER; + LOG_ENTRY; +} + void VCAI::playerBlocked(int reason) { NET_EVENT_HANDLER; diff --git a/AI/VCAI/VCAI.h b/AI/VCAI/VCAI.h index 90f81c629..ad574a105 100644 --- a/AI/VCAI/VCAI.h +++ b/AI/VCAI/VCAI.h @@ -200,6 +200,7 @@ public: virtual void artifactMoved(const ArtifactLocation &src, const ArtifactLocation &dst) OVERRIDE; virtual void artifactAssembled(const ArtifactLocation &al) OVERRIDE; virtual void showTavernWindow(const CGObjectInstance *townOrTavern) OVERRIDE; + virtual void showThievesGuildWindow (const CGObjectInstance * obj) OVERRIDE; virtual void playerBlocked(int reason) OVERRIDE; virtual void showPuzzleMap() OVERRIDE; virtual void showShipyardDialog(const IShipyard *obj) OVERRIDE; diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index d5305f876..a53f2f3f9 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -2219,6 +2219,13 @@ void CPlayerInterface::showTavernWindow(const CGObjectInstance *townOrTavern) GH.pushInt(tv); } +void CPlayerInterface::showThievesGuildWindow (const CGObjectInstance * obj) +{ + boost::unique_lock un(*pim); + CThievesGuildWindow *tgw = new CThievesGuildWindow(obj); + GH.pushInt(tgw); +} + void CPlayerInterface::showShipyardDialogOrProblemPopup(const IShipyard *obj) { if(obj->state()) diff --git a/client/CPlayerInterface.h b/client/CPlayerInterface.h index 7ca7036d9..1b57d30c5 100644 --- a/client/CPlayerInterface.h +++ b/client/CPlayerInterface.h @@ -154,6 +154,7 @@ public: void showUniversityWindow(const IMarket *market, const CGHeroInstance *visitor) OVERRIDE; void showHillFortWindow(const CGObjectInstance *object, const CGHeroInstance *visitor) OVERRIDE; void showTavernWindow(const CGObjectInstance *townOrTavern) OVERRIDE; + void showThievesGuildWindow (const CGObjectInstance * obj) OVERRIDE; void advmapSpellCast(const CGHeroInstance * caster, int spellID) OVERRIDE; //called when a hero casts a spell void tileHidden(const boost::unordered_set &pos) OVERRIDE; //called when given tiles become hidden under fog of war void tileRevealed(const boost::unordered_set &pos) OVERRIDE; //called when fog of war disappears from given tiles diff --git a/client/Client.h b/client/Client.h index b50603b94..8cb0638fc 100644 --- a/client/Client.h +++ b/client/Client.h @@ -119,7 +119,7 @@ public: void showBlockingDialog(BlockingDialog *iw, const CFunctionList &callback) OVERRIDE {}; ui32 showBlockingDialog(BlockingDialog *iw) OVERRIDE {return 0;}; //synchronous version of above void showGarrisonDialog(int upobj, int hid, bool removableUnits, const boost::function &cb) OVERRIDE {}; - void showThievesGuildWindow(int requestingObjId) OVERRIDE {}; + void showThievesGuildWindow(int player, int requestingObjId) OVERRIDE {}; void giveResource(int player, int which, int val) OVERRIDE {}; void giveCreatures(const CArmedInstance * objid, const CGHeroInstance * h, const CCreatureSet &creatures, bool remove) OVERRIDE {}; diff --git a/client/NetPacksClient.cpp b/client/NetPacksClient.cpp index 12777122e..c244ba893 100644 --- a/client/NetPacksClient.cpp +++ b/client/NetPacksClient.cpp @@ -816,10 +816,8 @@ void OpenWindow::applyCl(CClient *cl) case THIEVES_GUILD: { //displays Thieves' Guild window (when hero enters Den of Thieves) - if(!LOCPLINT) - return; - const CGObjectInstance *obj = cl->getObj(id1); - GH.pushInt( new CThievesGuildWindow(obj) ); + const CGObjectInstance *obj = cl->getObj(id2); + INTERFACE_CALL_IF_PRESENT(id1, showThievesGuildWindow, obj); } break; case UNIVERSITY_WINDOW: diff --git a/lib/CObjectHandler.cpp b/lib/CObjectHandler.cpp index 0c15ed248..2a3e3b067 100644 --- a/lib/CObjectHandler.cpp +++ b/lib/CObjectHandler.cpp @@ -6556,7 +6556,7 @@ void CCartographer::buyMap (const CGHeroInstance *h, ui32 accept) const void CGDenOfthieves::onHeroVisit (const CGHeroInstance * h) const { - cb->showThievesGuildWindow(id); + cb->showThievesGuildWindow(h->tempOwner, id); } void CGObelisk::onHeroVisit( const CGHeroInstance * h ) const diff --git a/lib/IGameCallback.h b/lib/IGameCallback.h index b80853ee4..2c44a3cda 100644 --- a/lib/IGameCallback.h +++ b/lib/IGameCallback.h @@ -284,7 +284,7 @@ public: virtual void showBlockingDialog(BlockingDialog *iw, const CFunctionList &callback)=0; virtual ui32 showBlockingDialog(BlockingDialog *iw) =0; //synchronous version of above //TODO: virtual void showGarrisonDialog(int upobj, int hid, bool removableUnits, const boost::function &cb) =0; //cb will be called when player closes garrison window - virtual void showThievesGuildWindow(int requestingObjId) =0; + virtual void showThievesGuildWindow(int player, int requestingObjId) =0; virtual void giveResource(int player, int which, int val)=0; virtual void giveCreatures(const CArmedInstance *objid, const CGHeroInstance * h, const CCreatureSet &creatures, bool remove) =0; diff --git a/lib/IGameEventsReceiver.h b/lib/IGameEventsReceiver.h index 7f14f3b9b..863c2e453 100644 --- a/lib/IGameEventsReceiver.h +++ b/lib/IGameEventsReceiver.h @@ -99,6 +99,7 @@ public: virtual void showUniversityWindow(const IMarket *market, const CGHeroInstance *visitor){}; virtual void showHillFortWindow(const CGObjectInstance *object, const CGHeroInstance *visitor){}; virtual void showTavernWindow(const CGObjectInstance *townOrTavern){}; + virtual void showThievesGuildWindow (const CGObjectInstance * obj){}; virtual void advmapSpellCast(const CGHeroInstance * caster, int spellID){}; //called when a hero casts a spell virtual void tileHidden(const boost::unordered_set &pos){}; virtual void tileRevealed(const boost::unordered_set &pos){}; diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 10072b284..742840df1 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -4342,11 +4342,12 @@ void CGameHandler::showGarrisonDialog( int upobj, int hid, bool removableUnits, } } -void CGameHandler::showThievesGuildWindow(int requestingObjId) +void CGameHandler::showThievesGuildWindow(int player, int requestingObjId) { OpenWindow ow; ow.window = OpenWindow::THIEVES_GUILD; - ow.id1 = requestingObjId; + ow.id1 = player; + ow.id2 = requestingObjId; sendAndApply(&ow); } diff --git a/server/CGameHandler.h b/server/CGameHandler.h index 4ac5f9b98..9e3b4e2d0 100644 --- a/server/CGameHandler.h +++ b/server/CGameHandler.h @@ -137,7 +137,7 @@ public: void showBlockingDialog(BlockingDialog *iw, const CFunctionList &callback) OVERRIDE; ui32 showBlockingDialog(BlockingDialog *iw) OVERRIDE; //synchronous version of above void showGarrisonDialog(int upobj, int hid, bool removableUnits, const boost::function &cb) OVERRIDE; - void showThievesGuildWindow(int requestingObjId) OVERRIDE; //TODO: make something more general? + void showThievesGuildWindow(int player, int requestingObjId) OVERRIDE; void giveResource(int player, int which, int val) OVERRIDE; void giveCreatures(const CArmedInstance *objid, const CGHeroInstance * h, const CCreatureSet &creatures, bool remove) OVERRIDE;