Browse Source

Close window at time expiring

nordsoft 2 years ago
parent
commit
e426924930
3 changed files with 8 additions and 3 deletions
  1. 5 0
      client/CPlayerInterface.cpp
  2. 1 1
      client/gui/CIntObject.h
  3. 2 2
      client/windows/InfoWindows.h

+ 5 - 0
client/CPlayerInterface.cpp

@@ -181,6 +181,11 @@ void CPlayerInterface::playerStartsTurn(PlayerColor player)
 		GH.windows().pushWindow(adventureInt);
 	}
 
+	//close window from another player
+	if(auto w = GH.windows().topWindow<CInfoWindow>())
+		if(w->ID == -1 && player != playerID)
+			w->close();
+	
 	// remove all dialogs that do not expect query answer
 	while (!GH.windows().topWindow<AdventureMapInterface>() && !GH.windows().topWindow<CInfoWindow>())
 		GH.windows().popWindows(1);

+ 1 - 1
client/gui/CIntObject.h

@@ -142,7 +142,7 @@ class WindowBase : public CIntObject
 public:
 	WindowBase(int used_ = 0, Point pos_ = Point());
 protected:
-	void close();
+	virtual void close();
 };
 
 class IGarrisonHolder

+ 2 - 2
client/windows/InfoWindows.h

@@ -55,7 +55,7 @@ public:
 	std::vector<std::shared_ptr<CButton>> buttons;
 	TCompsInfo components;
 
-	virtual void close();
+	void close() override;
 
 	void show(Canvas & to) override;
 	void showAll(Canvas & to) override;
@@ -78,7 +78,7 @@ public:
 class CRClickPopup : public WindowBase
 {
 public:
-	virtual void close();
+	void close() override;
 	bool isPopupWindow() const override;
 
 	static std::shared_ptr<WindowBase> createInfoWin(Point position, const CGObjectInstance * specific);