فهرست منبع

Fixed Thieves Guild window showing for all players.

It needed 11 files modified... :/
DjWarmonger 13 سال پیش
والد
کامیت
88e9dec974

+ 6 - 0
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;

+ 1 - 0
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;

+ 7 - 0
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<boost::recursive_mutex> un(*pim);
+	CThievesGuildWindow *tgw = new CThievesGuildWindow(obj);
+	GH.pushInt(tgw);
+}
+
 void CPlayerInterface::showShipyardDialogOrProblemPopup(const IShipyard *obj)
 {
 	if(obj->state())

+ 1 - 0
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<int3, ShashInt3> &pos) OVERRIDE; //called when given tiles become hidden under fog of war
 	void tileRevealed(const boost::unordered_set<int3, ShashInt3> &pos) OVERRIDE; //called when fog of war disappears from given tiles

+ 1 - 1
client/Client.h

@@ -119,7 +119,7 @@ public:
 	void showBlockingDialog(BlockingDialog *iw, const CFunctionList<void(ui32)> &callback) OVERRIDE {};
 	ui32 showBlockingDialog(BlockingDialog *iw) OVERRIDE {return 0;}; //synchronous version of above
 	void showGarrisonDialog(int upobj, int hid, bool removableUnits, const boost::function<void()> &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 {};

+ 2 - 4
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:

+ 1 - 1
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

+ 1 - 1
lib/IGameCallback.h

@@ -284,7 +284,7 @@ public:
 	virtual void showBlockingDialog(BlockingDialog *iw, const CFunctionList<void(ui32)> &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<void()> &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;

+ 1 - 0
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<int3, ShashInt3> &pos){};
 	virtual void tileRevealed(const boost::unordered_set<int3, ShashInt3> &pos){};

+ 3 - 2
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);
 }
 

+ 1 - 1
server/CGameHandler.h

@@ -137,7 +137,7 @@ public:
 	void showBlockingDialog(BlockingDialog *iw, const CFunctionList<void(ui32)> &callback) OVERRIDE;
 	ui32 showBlockingDialog(BlockingDialog *iw) OVERRIDE; //synchronous version of above
 	void showGarrisonDialog(int upobj, int hid, bool removableUnits, const boost::function<void()> &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;