From 97943710d847ddb2b52099330f1961bda127e37b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 9 Sep 2016 19:41:31 +0300 Subject: Fix code style. --- src/actions/actions.cpp | 4 ++-- src/being/beingcacheentry.h | 6 +++--- src/being/flooritem.cpp | 4 ++-- src/being/flooritem.h | 2 +- src/being/localplayer.cpp | 2 +- src/being/localplayer.h | 2 +- src/effectmanager.cpp | 4 ++-- src/effectmanager.h | 4 ++-- src/game.h | 2 +- src/net/packetcounters.cpp | 2 +- src/particle/particletimer.h | 4 ++-- src/resources/sprite/animatedsprite_unittest.cc | 6 +++--- 12 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index f855deb05..cb829445c 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -118,7 +118,7 @@ extern std::string tradePartnerName; extern QuitDialog *quitDialog; -extern int start_time; +extern time_t start_time; extern char **environ; namespace Actions @@ -1214,7 +1214,7 @@ impHandler0(uptime) { // TRANSLATORS: uptime command debugChatTab->chatLog(strprintf(_("Client uptime: %s"), - timeDiffToString(cur_time - start_time).c_str()), + timeDiffToString(CAST_S32(cur_time - start_time)).c_str()), ChatMsgType::BY_SERVER); } return true; diff --git a/src/being/beingcacheentry.h b/src/being/beingcacheentry.h index 4da40f2c2..c1a45120a 100644 --- a/src/being/beingcacheentry.h +++ b/src/being/beingcacheentry.h @@ -85,10 +85,10 @@ class BeingCacheEntry final int getLevel() const { return mLevel; } - void setTime(const int n) + void setTime(const time_t n) { mTime = n; } - int getTime() const + time_t getTime() const { return mTime; } unsigned getPvpRank() const @@ -129,7 +129,7 @@ class BeingCacheEntry final BeingId mId; /**< Unique sprite id */ int mLevel; unsigned int mPvpRank; - int mTime; + time_t mTime; int mFlags; uint16_t mTeamId; bool mIsAdvanced; diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp index 83857d043..586fb044a 100644 --- a/src/being/flooritem.cpp +++ b/src/being/flooritem.cpp @@ -178,14 +178,14 @@ void FloorItem::draw(Graphics *const graphics, && curTime < mDropTime + 28) { graphics->setColor(Color(200, 80, 20, - 80 + 10 * (curTime - mDropTime - 18))); + 80 + 10 * CAST_S32(curTime - mDropTime - 18))); graphics->fillRectangle(Rect( x, y, dx, dy)); } else if (curTime > mDropTime && curTime < mDropTime + 20) { graphics->setColor(Color(20, 20, 255, - 7 * (curTime - mDropTime))); + 7 * CAST_S32(curTime - mDropTime))); graphics->fillRectangle(Rect(x, y, dx, dy)); } } diff --git a/src/being/flooritem.h b/src/being/flooritem.h index 60e5d953d..23c32f446 100644 --- a/src/being/flooritem.h +++ b/src/being/flooritem.h @@ -136,7 +136,7 @@ class FloorItem final : public ActorSprite int mCards[maxCards]; int mItemId; int mX, mY; - int mDropTime; + time_t mDropTime; int mAmount; int mRefine; int mHeightPosDiff; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 2766a31b1..007a3d88e 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -287,7 +287,7 @@ void LocalPlayer::logic() { if (mMessageTime == 0) { - MessagePair info = mMessages.front(); + const MessagePair info = mMessages.front(); if (particleEngine && gui) { diff --git a/src/being/localplayer.h b/src/being/localplayer.h index a3d4814e5..d74481298 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -500,7 +500,7 @@ class LocalPlayer final : public Being, std::string mLastHitFrom; std::string mWaitFor; - int mAdvertTime; + time_t mAdvertTime; Particle *mTestParticle; std::string mTestParticleName; time_t mTestParticleTime; diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index c4241c29f..1a8fd7b53 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -180,7 +180,7 @@ Particle *EffectManager::triggerReturn(const int id, bool EffectManager::trigger(const int id, const int x, const int y, - const int endTime, + const time_t endTime, const int rotation) { if (!particleEngine || id == -1) @@ -226,7 +226,7 @@ void EffectManager::triggerDefault(int effectId, void EffectManager::triggerDefault(int effectId, const int x, const int y, - const int endTime, + const time_t endTime, const int defaultEffectId) { if (effectId == -1) diff --git a/src/effectmanager.h b/src/effectmanager.h index 4c30f2690..d439ebf21 100644 --- a/src/effectmanager.h +++ b/src/effectmanager.h @@ -73,7 +73,7 @@ class EffectManager final */ bool trigger(const int id, const int x, const int y, - const int endTime, + const time_t endTime, const int rotation = 0); void triggerDefault(int effectId, @@ -83,7 +83,7 @@ class EffectManager final void triggerDefault(int effectId, const int x, const int y, - const int endTime, + const time_t endTime, const int defaultEffectId); void logic(); diff --git a/src/game.h b/src/game.h index 551378ef2..05b2574f9 100644 --- a/src/game.h +++ b/src/game.h @@ -40,7 +40,7 @@ class Map; struct LastKey final { InputActionT key; - int time; + time_t time; int cnt; }; diff --git a/src/net/packetcounters.cpp b/src/net/packetcounters.cpp index f29bb890c..7d28ab3be 100644 --- a/src/net/packetcounters.cpp +++ b/src/net/packetcounters.cpp @@ -108,7 +108,7 @@ void PacketCounters::updateCounter(int &restrict currentSec, int &restrict calc, int &restrict counter) { - const time_t idx = cur_time % 60; + const int idx = CAST_S32(cur_time % 60); if (currentSec != idx) { currentSec = idx; diff --git a/src/particle/particletimer.h b/src/particle/particletimer.h index 1550935d8..fa4b86458 100644 --- a/src/particle/particletimer.h +++ b/src/particle/particletimer.h @@ -28,14 +28,14 @@ class Particle; struct ParticleTimer final { ParticleTimer(Particle *const particle0, - const int endTime0) A_NONNULL(2) : + const time_t endTime0) A_NONNULL(2) : particle(particle0), endTime(endTime0) { } Particle *const particle; - const int endTime; + const time_t endTime; }; #endif // PARTICLE_PARTICLETIMER_H diff --git a/src/resources/sprite/animatedsprite_unittest.cc b/src/resources/sprite/animatedsprite_unittest.cc index b59b4dbbb..9111434b2 100644 --- a/src/resources/sprite/animatedsprite_unittest.cc +++ b/src/resources/sprite/animatedsprite_unittest.cc @@ -89,7 +89,7 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") REQUIRE(false == sprite->update(11)); REQUIRE(10 == sprite->getFrameTime()); REQUIRE(0 == sprite->getFrameIndex()); - delete(sprite); + delete sprite; } SECTION("basic test 2") @@ -150,7 +150,7 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") REQUIRE(true == sprite->update(1 + 10 + 20 + 10 + 25 + 10 + 10 + 1)); REQUIRE(4 == sprite->getFrameIndex()); REQUIRE(1 == sprite->getFrameTime()); - delete(sprite); + delete sprite; } SECTION("basic test 3") @@ -168,7 +168,7 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") REQUIRE(true == sprite2->update(1 + 10 + 20 + 10 + 25 + 10 + 10 + 1)); REQUIRE(1 == sprite2->getFrameIndex()); REQUIRE(1 == sprite2->getFrameTime()); - delete(sprite2); + delete sprite2; } delete client; -- cgit v1.2.3-60-g2f50