Link C4MapScript into mape

Remove the two dependencies to ::Game from C4MapScript, so that ::Game
does not need to be linked into mape, which would basically drag the
whole rest of the engine after itself.
issue1247
Armin Burgmeier 2014-08-03 19:01:08 -04:00
parent 92720cf490
commit f25ec83568
5 changed files with 11 additions and 17 deletions

View File

@ -464,12 +464,19 @@ set(OC_CLONK_SOURCES
set(MAPE_BASE_SOURCES
src/landscape/C4MapCreatorS2.cpp
src/landscape/C4MapCreatorS2.h
src/landscape/C4MapScriptAlgo.cpp
src/landscape/C4MapScript.cpp
src/landscape/C4MapScript.h
src/landscape/C4Material.cpp
src/landscape/C4Material.h
src/landscape/C4Texture.cpp
src/landscape/C4Texture.h
src/landscape/C4Scenario.cpp
src/landscape/C4Scenario.h
src/graphics/Bitmap256.cpp
src/graphics/Bitmap256.h
src/graphics/CSurface8.cpp
src/graphics/CSurface8.h
src/lib/C4NameList.cpp
src/lib/C4NameList.h
src/lib/C4Rect.cpp

View File

@ -1231,7 +1231,7 @@ bool C4Landscape::Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bo
if (!fLandscapeModeSet) Mode=C4LSC_Dynamic;
// script may create or edit map
if (MapScript.InitializeMap(hGroup, &sfcMap))
if (MapScript.InitializeMap(&Game.C4S.Landscape, Game.StartupPlayerCount, &sfcMap))
if (!fLandscapeModeSet) Mode=C4LSC_Dynamic;
// Dynamic map by scenario

View File

@ -574,7 +574,7 @@ C4MapScriptMap *C4MapScriptHost::CreateMap()
return new C4MapScriptMap(MapPrototype);
}
bool C4MapScriptHost::InitializeMap(C4Group &group, CSurface8 **pmap_surface)
bool C4MapScriptHost::InitializeMap(C4SLandscape *pLandscape, uint32_t iPlayerCount, CSurface8 **pmap_surface)
{
// Init scripted map by calling InitializeMap in the proper scripts. If *pmap_surface is given, it will pass the existing map to be modified by script.
assert(pmap_surface);
@ -596,7 +596,7 @@ bool C4MapScriptHost::InitializeMap(C4Group &group, CSurface8 **pmap_surface)
{
// No existing map. Create new.
int32_t map_wdt,map_hgt;
::Game.C4S.Landscape.GetMapSize(map_wdt, map_hgt, ::Game.StartupPlayerCount);
pLandscape->GetMapSize(map_wdt, map_hgt, iPlayerCount);
if (!map->CreateSurface(map_wdt, map_hgt)) return false;
}
C4AulParSet Pars(C4VPropList(map.get()));

View File

@ -331,7 +331,7 @@ public:
virtual bool LoadData(const char *, const char *, C4LangStringTable *);
void Clear();
virtual C4PropListStatic * GetPropList();
bool InitializeMap(C4Group &group, CSurface8 **pmap_surface);
bool InitializeMap(C4SLandscape *pLandscape, uint32_t iPlayerCount, CSurface8 **pmap_surface);
C4PropListStatic *GetLayerPrototype() { return LayerPrototype; }
};

View File

@ -28,8 +28,6 @@
#include "C4PXS.h"
#include "C4Record.h"
#include "C4RoundResults.h"
#include "CSurface8.h"
#include "C4MapScript.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
@ -66,8 +64,6 @@ bool C4Reloc::Open(C4Group&, char const*) const {return false;}
bool C4Draw::TextOut(const char *, CStdFont &, float, C4Surface *, float, float, DWORD, BYTE, bool) { return false; }
CSurface8::CSurface8(int, int) {}
C4Facet::C4Facet() {}
void C4Facet::Set(C4Surface*, float, float, float, float) {}
int32_t C4Facet::GetSectionCount() { return 0; }
@ -198,12 +194,3 @@ C4Game::~C4Game() {}
C4AulDebug *C4AulDebug::pDebug;
void C4AulDebug::DebugStep(C4AulBCC*, C4Value*) {}
C4MapScriptHost MapScript;
C4MapScriptHost::C4MapScriptHost() {}
C4MapScriptHost::~C4MapScriptHost() {}
void C4MapScriptHost::Clear() {}
C4PropListStatic *C4MapScriptHost::GetPropList() {return NULL;}
bool C4MapScriptHost::Load(C4Group &, const char *, const char *, C4LangStringTable *) { return false; }
bool C4MapScriptHost::LoadData(const char *, const char *, C4LangStringTable *) { return false; }
void C4MapScriptHost::AddEngineFunctions() {}