Implementing automatic kick of players after a certain timeout within a game.
This commit is contained in:
@@ -5123,3 +5123,13 @@ bool LocalPlayer::checkIfINeedToShowCards()
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LocalPlayer::markRemoteAction()
|
||||
{
|
||||
m_lastRemoteActionTimer.restart();
|
||||
}
|
||||
|
||||
unsigned LocalPlayer::getTimeSecSinceLastRemoteAction() const
|
||||
{
|
||||
return m_lastRemoteActionTimer.elapsed().total_seconds();
|
||||
}
|
||||
|
||||
@@ -285,12 +285,11 @@ public:
|
||||
void setIsKicked(bool kicked);
|
||||
bool isKicked() const;
|
||||
|
||||
unsigned getActionTimeoutCounter() const;
|
||||
void incrementActionTimeoutCounter();
|
||||
void resetActionTimeoutCounter();
|
||||
|
||||
bool checkIfINeedToShowCards();
|
||||
|
||||
void markRemoteAction();
|
||||
unsigned getTimeSecSinceLastRemoteAction() const;
|
||||
|
||||
private:
|
||||
|
||||
ConfigFile *myConfig;
|
||||
@@ -336,6 +335,7 @@ private:
|
||||
unsigned m_actionTimeoutCounter;
|
||||
bool m_isSessionActive;
|
||||
bool m_isKicked;
|
||||
boost::timers::portable::microsec_timer m_lastRemoteActionTimer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -140,6 +140,9 @@ public:
|
||||
|
||||
bool checkIfINeedToShowCards();
|
||||
|
||||
void markRemoteAction() {}
|
||||
unsigned getTimeSecSinceLastRemoteAction() const {return 0;}
|
||||
|
||||
private:
|
||||
mutable boost::recursive_mutex m_syncMutex;
|
||||
|
||||
|
||||
@@ -124,6 +124,9 @@ public:
|
||||
virtual bool isKicked() const=0;
|
||||
|
||||
virtual bool checkIfINeedToShowCards() =0;
|
||||
|
||||
virtual void markRemoteAction() =0;
|
||||
virtual unsigned getTimeSecSinceLastRemoteAction() const =0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user