diff --git a/src/engine/input.h b/src/engine/input.h index 2e9c56ce7..d1d926604 100644 --- a/src/engine/input.h +++ b/src/engine/input.h @@ -4,7 +4,8 @@ #define ENGINE_INPUT_H #include "kernel.h" -#include + +#include #include #include diff --git a/src/game/client/component.cpp b/src/game/client/component.cpp index 0d085f428..c682d7457 100644 --- a/src/game/client/component.cpp +++ b/src/game/client/component.cpp @@ -2,6 +2,8 @@ #include "gameclient.h" +#include + class IKernel *CComponent::Kernel() const { return m_pClient->Kernel(); } class IEngine *CComponent::Engine() const { return m_pClient->Engine(); } class IGraphics *CComponent::Graphics() const { return m_pClient->Graphics(); } @@ -27,6 +29,15 @@ class IUpdater *CComponent::Updater() const } #endif +int64_t CComponent::time() const +{ +#if defined(CONF_VIDEORECORDER) + return IVideo::Current() ? IVideo::Time() : time_get(); +#else + return time_get(); +#endif +} + float CComponent::LocalTime() const { #if defined(CONF_VIDEORECORDER) diff --git a/src/game/client/component.h b/src/game/client/component.h index be49eb991..639c8b140 100644 --- a/src/game/client/component.h +++ b/src/game/client/component.h @@ -104,25 +104,12 @@ protected: class IUpdater *Updater() const; #endif -#if defined(CONF_VIDEORECORDER) /** * Gets the current time. * @see time_get() */ - int64_t time() const - { - return IVideo::Current() ? IVideo::Time() : time_get(); - } -#else - /** - * Gets the current time. - * @see time_get() - */ - int64_t time() const - { - return time_get(); - } -#endif + int64_t time() const; + /** * Gets the local time. */ diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp index f25dedf99..0c2fbb57e 100644 --- a/src/game/client/components/voting.cpp +++ b/src/game/client/components/voting.cpp @@ -2,6 +2,8 @@ /* If you are missing that file, acquire a complete release at teeworlds.com. */ #include "voting.h" +#include + #include #include @@ -139,6 +141,11 @@ void CVoting::Vote(int v) Client()->SendPackMsgActive(&Msg, MSGFLAG_VITAL); } +int CVoting::SecondsLeft() const +{ + return (m_Closetime - time()) / time_freq(); +} + CVoting::CVoting() { ClearOptions(); diff --git a/src/game/client/components/voting.h b/src/game/client/components/voting.h index 3e5531a6a..2d3d36d15 100644 --- a/src/game/client/components/voting.h +++ b/src/game/client/components/voting.h @@ -57,8 +57,8 @@ public: void Vote(int v); // -1 = no, 1 = yes - int SecondsLeft() { return (m_Closetime - time()) / time_freq(); } - bool IsVoting() { return m_Closetime != 0; } + int SecondsLeft() const; + bool IsVoting() const { return m_Closetime != 0; } int TakenChoice() const { return m_Voted; } const char *VoteDescription() const { return m_aDescription; } const char *VoteReason() const { return m_aReason; }