1#include "component.h"
2
3#include "gameclient.h"
4
5#include <base/dbg.h>
6#include <base/time.h>
7
8void CComponentInterfaces::OnInterfacesInit(CGameClient *pClient)
9{
10 dbg_assert(m_pClient == nullptr, "Component already initialized");
11 m_pClient = pClient;
12}
13
14class IKernel *CComponentInterfaces::Kernel() const
15{
16 return m_pClient->Kernel();
17}
18
19class IEngine *CComponentInterfaces::Engine() const
20{
21 return m_pClient->Engine();
22}
23
24class IGraphics *CComponentInterfaces::Graphics() const
25{
26 return m_pClient->Graphics();
27}
28
29class ITextRender *CComponentInterfaces::TextRender() const
30{
31 return m_pClient->TextRender();
32}
33
34class IInput *CComponentInterfaces::Input() const
35{
36 return m_pClient->Input();
37}
38
39class IStorage *CComponentInterfaces::Storage() const
40{
41 return m_pClient->Storage();
42}
43
44class CUi *CComponentInterfaces::Ui() const
45{
46 return m_pClient->Ui();
47}
48
49class ISound *CComponentInterfaces::Sound() const
50{
51 return m_pClient->Sound();
52}
53
54class CRenderTools *CComponentInterfaces::RenderTools() const
55{
56 return m_pClient->RenderTools();
57}
58
59class CRenderMap *CComponentInterfaces::RenderMap() const
60{
61 return m_pClient->RenderMap();
62}
63
64class IConfigManager *CComponentInterfaces::ConfigManager() const
65{
66 return m_pClient->ConfigManager();
67}
68
69class CConfig *CComponentInterfaces::Config() const
70{
71 return m_pClient->Config();
72}
73
74class IConsole *CComponentInterfaces::Console() const
75{
76 return m_pClient->Console();
77}
78
79class IDemoPlayer *CComponentInterfaces::DemoPlayer() const
80{
81 return m_pClient->DemoPlayer();
82}
83
84class IDemoRecorder *CComponentInterfaces::DemoRecorder(int Recorder) const
85{
86 return m_pClient->DemoRecorder(Recorder);
87}
88
89class IFavorites *CComponentInterfaces::Favorites() const
90{
91 return m_pClient->Favorites();
92}
93
94class IServerBrowser *CComponentInterfaces::ServerBrowser() const
95{
96 return m_pClient->ServerBrowser();
97}
98
99class CLayers *CComponentInterfaces::Layers() const
100{
101 return m_pClient->Layers();
102}
103
104class CCollision *CComponentInterfaces::Collision() const
105{
106 return m_pClient->Collision();
107}
108
109#if defined(CONF_AUTOUPDATE)
110class IUpdater *CComponentInterfaces::Updater() const
111{
112 return m_pClient->Updater();
113}
114#endif
115
116int64_t CComponentInterfaces::time() const
117{
118#if defined(CONF_VIDEORECORDER)
119 if(IVideo::Current())
120 {
121 return IVideo::Current()->Time();
122 }
123#endif
124 return time_get();
125}
126
127float CComponentInterfaces::LocalTime() const
128{
129#if defined(CONF_VIDEORECORDER)
130 if(IVideo::Current())
131 {
132 return IVideo::Current()->LocalTime();
133 }
134#endif
135 return Client()->LocalTime();
136}
137
138class IClient *CComponentInterfaces::Client() const
139{
140 return m_pClient->Client();
141}
142
143class IHttp *CComponentInterfaces::Http() const
144{
145 return m_pClient->Http();
146}
147