summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-22 02:58:51 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-22 02:58:51 +0300
commit2d4e2d93267392487c17cfc6b2649bdd29d42456 (patch)
treed5ae6bb22999c53f85008d5e4643f3a90ce34464
parentfff0343ddfdfab92c9b21453df76e57fa1426f4c (diff)
downloadplus-2d4e2d93267392487c17cfc6b2649bdd29d42456.tar.gz
plus-2d4e2d93267392487c17cfc6b2649bdd29d42456.tar.bz2
plus-2d4e2d93267392487c17cfc6b2649bdd29d42456.tar.xz
plus-2d4e2d93267392487c17cfc6b2649bdd29d42456.zip
Show incomplete ping value if time waiting already more than previous ping time.
-rw-r--r--src/localplayer.cpp20
-rw-r--r--src/localplayer.h3
2 files changed, 21 insertions, 2 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 0a571b3f2..619150ef9 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -3452,6 +3452,26 @@ void LocalPlayer::pingRequest()
Net::getBeingHandler()->requestNameById(getId());
}
+int LocalPlayer::getPingTime() const
+{
+ int time = 0;
+ if (!mWaitPing)
+ {
+ time = mPingTime;
+ }
+ else
+ {
+ time = tick_time;
+ if (time > mPingSendTick)
+ {
+ time -= mPingSendTick;
+ if (time <= mPingTime)
+ time = mPingTime;
+ }
+ }
+ return time;
+}
+
void LocalPlayer::pingResponse()
{
if (mWaitPing == true && mPingSendTick > 0)
diff --git a/src/localplayer.h b/src/localplayer.h
index 2d463de4e..ce615b2e6 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -286,8 +286,7 @@ class LocalPlayer final : public Being,
int getDisableGameModifiers() const A_WARN_UNUSED
{ return mDisableGameModifiers; }
- int getPingTime() const A_WARN_UNUSED
- { return mPingTime; }
+ int getPingTime() const A_WARN_UNUSED;
void tryPingRequest();