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