1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#include <set>
#include <cctype>
#include "System/mmgr.h"
#include "LuaGaia.h"
#include "LuaInclude.h"
#include "LuaUtils.h"
#include "LuaSyncedCtrl.h"
#include "LuaSyncedRead.h"
#include "LuaUnitDefs.h"
#include "LuaWeaponDefs.h"
#include "LuaOpenGL.h"
#include "Rendering/UnitDrawer.h"
#include "Sim/Misc/GlobalSynced.h"
#include "Sim/Misc/TeamHandler.h"
#include "Sim/Units/Unit.h"
#include "Sim/Units/UnitDef.h"
#include "Sim/Units/CommandAI/Command.h"
#include "System/FileSystem/FileHandler.h"
#include "System/FileSystem/FileSystem.h"
#include "System/Util.h"
CLuaGaia* luaGaia = NULL;
static const char* LuaGaiaSyncedFilename = "LuaGaia/main.lua";
static const char* LuaGaiaUnsyncedFilename = "LuaGaia/draw.lua";
/******************************************************************************/
/******************************************************************************/
void CLuaGaia::LoadHandler()
{
//FIXME GML: this needs a mutex!!!
if (luaGaia) {
return;
}
new CLuaGaia();
if (!luaGaia->IsValid()) {
delete luaGaia;
}
}
void CLuaGaia::FreeHandler()
{
//FIXME GML: this needs a mutex!!!
delete luaGaia;
}
/******************************************************************************/
/******************************************************************************/
CLuaGaia::CLuaGaia()
: CLuaHandleSynced("LuaGaia", LUA_HANDLE_ORDER_GAIA)
{
luaGaia = this;
if (!IsValid()) {
return;
}
teamsLocked = true;
SetFullCtrl(true, true);
SetFullRead(true, true);
SetCtrlTeam(AllAccessTeam, true); //teamHandler->GaiaTeamID();
SetReadTeam(AllAccessTeam, true);
SetReadAllyTeam(AllAccessTeam, true);
SetSelectTeam(teamHandler->GaiaTeamID(), true);
Init(LuaGaiaSyncedFilename, LuaGaiaUnsyncedFilename, SPRING_VFS_MAP);
}
CLuaGaia::~CLuaGaia()
{
if (L_Sim != NULL || L_Draw != NULL) {
Shutdown();
KillLua();
}
luaGaia = NULL;
}
bool CLuaGaia::AddSyncedCode(lua_State *L)
{
return true;
}
bool CLuaGaia::AddUnsyncedCode(lua_State *L)
{
/*lua_pushliteral(L, "UNSYNCED");
lua_gettable(L, LUA_REGISTRYINDEX);*/
return true;
}
/******************************************************************************/
/******************************************************************************/
|