Include types.h instead of system.h in input.h

This commit is contained in:
Robert Müller 2024-05-27 18:59:33 +02:00
parent 248225c7c4
commit 0d9f673b03
5 changed files with 24 additions and 18 deletions

View file

@ -4,7 +4,8 @@
#define ENGINE_INPUT_H
#include "kernel.h"
#include <base/system.h>
#include <base/types.h>
#include <cstdint>
#include <functional>

View file

@ -2,6 +2,8 @@
#include "gameclient.h"
#include <base/system.h>
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)

View file

@ -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.
*/

View file

@ -2,6 +2,8 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include "voting.h"
#include <base/system.h>
#include <engine/shared/config.h>
#include <engine/textrender.h>
@ -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();

View file

@ -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; }