From ca130a19b36a78c6a23aa56c6ea82eaa187b0a06 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 29 Aug 2016 01:24:49 +0300 Subject: Use time_t for time values. --- src/being/being.cpp | 2 +- src/being/being.h | 24 ++++++++++++------------ src/being/flooritem.cpp | 4 ++-- src/being/localplayer.cpp | 14 +++++++------- src/being/localplayer.h | 8 ++++---- 5 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index b0d8234ca..398d82f48 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -118,7 +118,7 @@ const unsigned int CACHE_SIZE = 50; -int Being::mUpdateConfigTime = 0; +time_t Being::mUpdateConfigTime = 0; unsigned int Being::mConfLineLim = 0; int Being::mSpeechType = 0; bool Being::mHighlightMapPortals = false; diff --git a/src/being/being.h b/src/being/being.h index 0b1bddcf4..78f0ec65c 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -66,7 +66,7 @@ struct HorseInfo; struct SkillInfo; struct ParticleInfo; -extern volatile int cur_time; +extern volatile time_t cur_time; struct NextSoundInfo final { @@ -705,19 +705,19 @@ class Being notfinal : public ActorSprite, void setOtherTime() restrict2 noexcept2 { mOtherTime = cur_time; } - int getMoveTime() const restrict2 noexcept2 + time_t getMoveTime() const restrict2 noexcept2 { return mMoveTime; } - int getAttackTime() const restrict2 noexcept2 + time_t getAttackTime() const restrict2 noexcept2 { return mAttackTime; } - int getTalkTime() const restrict2 noexcept2 + time_t getTalkTime() const restrict2 noexcept2 { return mTalkTime; } - int getTestTime() const restrict2 noexcept2 + time_t getTestTime() const restrict2 noexcept2 { return mTestTime; } - int getOtherTime() const restrict2 noexcept2 + time_t getOtherTime() const restrict2 noexcept2 { return mOtherTime; } void resetCounters() restrict2; @@ -1259,7 +1259,7 @@ class Being notfinal : public ActorSprite, ReachableT mReachable; int mGoodStatus; - static int mUpdateConfigTime; + static time_t mUpdateConfigTime; static unsigned int mConfLineLim; static int mSpeechType; static bool mHighlightMapPortals; @@ -1279,11 +1279,11 @@ class Being notfinal : public ActorSprite, static uint8_t mShowBadges; static int mAwayEffect; - int mMoveTime; - int mAttackTime; - int mTalkTime; - int mOtherTime; - int mTestTime; + time_t mMoveTime; + time_t mAttackTime; + time_t mTalkTime; + time_t mOtherTime; + time_t mTestTime; int mAttackDelay; int mMinHit; int mMaxHit; diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp index 00b4ae45a..83857d043 100644 --- a/src/being/flooritem.cpp +++ b/src/being/flooritem.cpp @@ -41,7 +41,7 @@ #include "debug.h" -extern volatile int cur_time; +extern volatile time_t cur_time; FloorItem::FloorItem(const BeingId id, const int itemId, @@ -161,7 +161,7 @@ void FloorItem::draw(Graphics *const graphics, if (mHighlight) { - const int curTime = cur_time; + const time_t curTime = cur_time; font = gui->getFont(); if (mDropTime < curTime) { diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index bf50025fd..1a1155b36 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -343,7 +343,7 @@ void LocalPlayer::logic() void LocalPlayer::slowLogic() { BLOCK_START("LocalPlayer::slowLogic") - const int time = cur_time; + const time_t time = cur_time; if (weightNotice && weightNoticeTime < time) { weightNotice->scheduleDelete(); @@ -1873,11 +1873,11 @@ std::string LocalPlayer::getPingTime() const if (!mPingTime) str = "?"; else - str = toString(mPingTime); + str = toString(CAST_S32(mPingTime)); } else { - int time = tick_time; + time_t time = tick_time; if (time > mPingSendTick) time -= mPingSendTick; else @@ -1885,9 +1885,9 @@ std::string LocalPlayer::getPingTime() const if (time <= mPingTime) time = mPingTime; if (mPingTime != time) - str = strprintf("%d (%d)", mPingTime, time); + str = strprintf("%d (%d)", CAST_S32(mPingTime), CAST_S32(time)); else - str = toString(time); + str = toString(CAST_S32(time)); } return str; } @@ -1954,7 +1954,7 @@ void LocalPlayer::afkRespond(ChatTab *const tab, const std::string &nick) { if (settings.awayMode) { - const int time = cur_time; + const time_t time = cur_time; if (mAfkTime == 0 || time < mAfkTime || time - mAfkTime > awayLimitTimer) { @@ -2490,7 +2490,7 @@ void LocalPlayer::fixPos() const int dx = abs(mX - mCrossX); const int dy = abs(mY - mCrossY); const int dist = dx > dy ? dx : dy; - const int time = cur_time; + const time_t time = cur_time; const int maxDist = mSyncPlayerMove ? mSyncPlayerMoveDistance : 7; if (dist > maxDist) diff --git a/src/being/localplayer.h b/src/being/localplayer.h index e48730f6b..a3d4814e5 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -484,9 +484,9 @@ class LocalPlayer final : public Being, OkDialog *mAwayDialog; int mPingSendTick; - int mPingTime; - int mAfkTime; - int mActivityTime; + time_t mPingTime; + time_t mAfkTime; + time_t mActivityTime; int mNavigateX; int mNavigateY; BeingId mNavigateId; @@ -503,7 +503,7 @@ class LocalPlayer final : public Being, int mAdvertTime; Particle *mTestParticle; std::string mTestParticleName; - int mTestParticleTime; + time_t mTestParticleTime; unsigned long mTestParticleHash; int mSyncPlayerMoveDistance; int mUnfreezeTime; -- cgit v1.2.3-70-g09d2