From e3afeae72795ce2dd80ec2740f1e622e073f1020 Mon Sep 17 00:00:00 2001 From: Tycho Date: Tue, 9 Sep 2014 15:56:36 +0100 Subject: fix issue with local types in template --- tests/Components/Tick.cpp | 57 +++++++++++++++++++++--------------------- tests/Components/creatable.cpp | 5 ++-- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/tests/Components/Tick.cpp b/tests/Components/Tick.cpp index fac47489b..8d1fe8628 100644 --- a/tests/Components/Tick.cpp +++ b/tests/Components/Tick.cpp @@ -1,37 +1,38 @@ #include "Globals.h" #include "Mobs/Components/BurningComponent.h" +class cMockEntity +{ +public: + double GetPosX () { return 0;} + double GetPosY () { return 0;} + double GetPosZ () { return 0;} + + int GetChunkX () { return 0; } + int GetChunkZ () { return 0; } + + virtual bool IsOnFire () const { return false; } + void StartBurning(int a_TicksLeftBurning) {} +} Entity; +class cMockChunk +{ + class cMockWorld + { + public: + void QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = NULL) {} + virtual int GetTimeOfDay(void) const { return 0;} + virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) { return true; } + } mutable m_World; +public: + bool IsLightValid(void) { return true; } + inline NIBBLETYPE GetSkyLight (int a_RelX, int a_RelY, int a_RelZ) const { return 0; } + cMockWorld * GetWorld(void) const { return &m_World; } + BLOCKTYPE GetBlock (int a_BlockX, int a_BlockY, int a_BlockZ) { return 0; } +} chunk; int main(int argc, char** argv) { - class cMockEntity - { - public: - double GetPosX () { return 0;} - double GetPosY () { return 0;} - double GetPosZ () { return 0;} - - int GetChunkX () { return 0; } - int GetChunkZ () { return 0; } - - virtual bool IsOnFire () const { return false; } - void StartBurning(int a_TicksLeftBurning) {} - } Entity; - class cMockChunk - { - class cMockWorld - { - public: - void QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = NULL) {} - virtual int GetTimeOfDay(void) const { return 0;} - virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) { return true; } - } mutable m_World; - public: - bool IsLightValid(void) { return true; } - inline NIBBLETYPE GetSkyLight (int a_RelX, int a_RelY, int a_RelZ) const { return 0; } - cMockWorld * GetWorld(void) const { return &m_World; } - BLOCKTYPE GetBlock (int a_BlockX, int a_BlockY, int a_BlockZ) { return 0; } - } chunk; + cBurningComponent component(Entity); component.Tick(1.0f/20.0f, chunk); diff --git a/tests/Components/creatable.cpp b/tests/Components/creatable.cpp index bf96720c6..9041fd427 100644 --- a/tests/Components/creatable.cpp +++ b/tests/Components/creatable.cpp @@ -2,10 +2,11 @@ #include "Globals.h" #include "Mobs/Components/BurningComponent.h" +class cMockEntity {} Entity; +class cMockChunk {}; int main(int argc, char** argv) { - class cMockEntity {} Entity; - class cMockChunk {}; + cBurningComponent component(Entity); return 0; } -- cgit v1.2.3