diff --git a/CMakeLists.txt b/CMakeLists.txt index 68d0ffcd0..35a9276f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -785,6 +785,7 @@ set(MAPE_BASE_SOURCES src/lib/C4Rect.h src/object/C4Id.cpp src/object/C4Id.h + src/script/C4ScriptStandaloneStubs.cpp ) set(MAPE_SOURCES diff --git a/src/mape/cpp-handles/c4def-handle.cpp b/src/mape/cpp-handles/c4def-handle.cpp index 65badb0fa..e6547830a 100644 --- a/src/mape/cpp-handles/c4def-handle.cpp +++ b/src/mape/cpp-handles/c4def-handle.cpp @@ -118,3 +118,5 @@ bool C4Def::Load(C4Group& hGroup, StdMeshSkeletonLoader& loader, DWORD dwLoadWha return true; } + +C4DefList Definitions; diff --git a/src/mape/cpp-handles/stub-handle.cpp b/src/mape/cpp-handles/stub-handle.cpp index 042120cfd..099024155 100644 --- a/src/mape/cpp-handles/stub-handle.cpp +++ b/src/mape/cpp-handles/stub-handle.cpp @@ -31,38 +31,16 @@ #include "C4TextureShape.h" /* This file implements stubs for the parts of the engine that are not used - * by mape. It also instantiates global variables required by mape that are - * not instantiated elsewhere. In particular, we avoid C4Globals.cpp. */ + * by mape. */ -/* These are actually used by mape: */ -#ifdef _DEBUG -C4Set C4PropList::PropLists; -#endif -C4Set C4PropListNumbered::PropLists; -C4Set C4PropListScript::PropLists; -std::vector C4PropListNumbered::ShelvedPropLists; -int32_t C4PropListNumbered::EnumerationIndex = 0; -C4StringTable Strings; -C4AulScriptEngine ScriptEngine; -C4DefList Definitions; - -/* These are just stubs used by dead code: */ C4Landscape Landscape; C4PXSSystem PXS; -C4Config Config; C4GameObjects Objects; -C4Reloc Reloc; class C4Draw *pDraw = NULL; -bool EraseItemSafe(const char *szFilename) {return false;} -void Smoke(int32_t tx, int32_t ty, int32_t level, DWORD dwClr) {} class C4SoundInstance *StartSoundEffectAt(const char *, int32_t, int32_t, int32_t, int32_t, int32_t, class C4SoundModifier *) { return NULL; } -C4Config::C4Config() {} -C4Config::~C4Config() {} const char* C4Config::AtTempPath(const char *) { return NULL; } -const char* C4Config::AtRelativePath(char const* s) {return s;} -bool C4Reloc::Open(C4Group&, char const*) const {return false;} bool C4Draw::TextOut(const char *, CStdFont &, float, C4Surface *, float, float, DWORD, BYTE, bool) { return false; } @@ -101,8 +79,6 @@ C4IDListChunk::~C4IDListChunk() {} C4DefGraphics::C4DefGraphics(C4Def*) {} void C4DefGraphics::Clear() {} -void C4Def::IncludeDefinition(C4Def*) {} - void C4DefList::Draw(C4ID, C4Facet &, bool, int32_t) {} void C4DefList::CallEveryDefinition() {} void C4DefList::ResetIncludeDependencies() {} @@ -154,8 +130,6 @@ C4PXSSystem::C4PXSSystem() {} C4PXSSystem::~C4PXSSystem() {} bool C4PXSSystem::Create(int, C4Real, C4Real, C4Real, C4Real) { return false; } -void AddDbgRec(C4RecordChunkType, const void *, int) {} - bool C4TextureShape::Load(C4Group &group, const char *filename, int32_t base_tex_wdt, int32_t base_tex_hgt) { return true; } #if 0 @@ -195,8 +169,5 @@ C4Game::C4Game(): Parameters(GameParameters), Clients(Parameters.Clients), Teams C4Game::~C4Game() {} #endif -C4AulDebug *C4AulDebug::pDebug; -void C4AulDebug::DebugStep(C4AulBCC*, C4Value*) {} - C4Shader::C4Shader() {} C4Shader::~C4Shader() {} diff --git a/src/script/C4ScriptStandalone.cpp b/src/script/C4ScriptStandalone.cpp index 6b4ab888c..dfb3ced92 100644 --- a/src/script/C4ScriptStandalone.cpp +++ b/src/script/C4ScriptStandalone.cpp @@ -22,6 +22,14 @@ #include "gamescript/C4Script.h" #include "script/C4Aul.h" #include "script/C4ScriptHost.h" +#include + +/* StandaloneStubs.cpp is shared with mape, which has a real implementation of these */ +C4Def* C4DefList::GetByName(const StdStrBuf &) {return NULL;} +C4Def * C4DefList::GetDef(int) {return 0;} +int C4DefList::GetDefCount() {return 0;} +void C4DefList::CallEveryDefinition() {} +void C4DefList::ResetIncludeDependencies() {} void InitializeC4Script() { diff --git a/src/script/C4ScriptStandaloneStubs.cpp b/src/script/C4ScriptStandaloneStubs.cpp index 3153a88ec..d2ef24c02 100644 --- a/src/script/C4ScriptStandaloneStubs.cpp +++ b/src/script/C4ScriptStandaloneStubs.cpp @@ -19,11 +19,11 @@ #include #include #include -#include #include #include #include +/* Parts of the ScriptEngine that are normally in C4Globals for initialization order reasons. */ #ifdef _DEBUG C4Set C4PropList::PropLists; #endif @@ -34,17 +34,12 @@ int32_t C4PropListNumbered::EnumerationIndex = 0; C4StringTable Strings; C4AulScriptEngine ScriptEngine; +/* Stubs */ C4Config Config; C4Config::C4Config() {} C4Config::~C4Config() {} const char * C4Config::AtRelativePath(char const*s) {return s;} -C4Def* C4DefList::GetByName(const StdStrBuf &) {return NULL;} -C4Def * C4DefList::GetDef(int) {return 0;} -int C4DefList::GetDefCount() {return 0;} -void C4DefList::CallEveryDefinition() {} -void C4DefList::ResetIncludeDependencies() {} - C4AulDebug *C4AulDebug::pDebug; void C4AulDebug::DebugStep(C4AulBCC*,C4Value*) {} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2a9d75be2..11d650851 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -121,6 +121,7 @@ if (GTEST_FOUND AND GMOCK_FOUND) aul/AulMathTest.cpp aul/AulPredefinedFunctionTest.cpp ../src/script/C4ScriptStandaloneStubs.cpp + ../src/script/C4ScriptStandalone.cpp LIBRARIES libmisc libc4script)