Use a real Lua table for the environment; this obsoletes m_mapEnv.
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
#include "MessageManager.h"
|
#include "MessageManager.h"
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
|
#include "LuaReference.h"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <set>
|
#include <set>
|
||||||
@@ -73,6 +74,7 @@ GameState::GameState() :
|
|||||||
m_pPlayerState[p]->m_PlayerNumber = p;
|
m_pPlayerState[p]->m_PlayerNumber = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_Environment = new LuaTable;
|
||||||
|
|
||||||
/* Don't reset yet; let the first screen do it, so we can
|
/* Don't reset yet; let the first screen do it, so we can
|
||||||
* use PREFSMAN and THEME. */
|
* use PREFSMAN and THEME. */
|
||||||
@@ -86,6 +88,8 @@ GameState::~GameState()
|
|||||||
|
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
SAFE_DELETE( m_pPlayerState[p] );
|
SAFE_DELETE( m_pPlayerState[p] );
|
||||||
|
|
||||||
|
delete m_Environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::ApplyGameCommand( const CString &sCommand, PlayerNumber pn )
|
void GameState::ApplyGameCommand( const CString &sCommand, PlayerNumber pn )
|
||||||
@@ -1832,6 +1836,7 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int SetTemporaryEventMode( T* p, lua_State *L ) { p->m_bTemporaryEventMode = BArg(1); return 0; }
|
static int SetTemporaryEventMode( T* p, lua_State *L ) { p->m_bTemporaryEventMode = BArg(1); return 0; }
|
||||||
|
static int Env( T* p, lua_State *L ) { p->m_Environment->PushSelf(L); return 1; }
|
||||||
static int SetEnv( T* p, lua_State *L ) { p->m_mapEnv[SArg(1)] = SArg(2); return 0; }
|
static int SetEnv( T* p, lua_State *L ) { p->m_mapEnv[SArg(1)] = SArg(2); return 0; }
|
||||||
static int GetEnv( T* p, lua_State *L )
|
static int GetEnv( T* p, lua_State *L )
|
||||||
{
|
{
|
||||||
@@ -1865,6 +1870,7 @@ public:
|
|||||||
ADD_METHOD( GetCurrentCourse )
|
ADD_METHOD( GetCurrentCourse )
|
||||||
ADD_METHOD( SetCurrentCourse )
|
ADD_METHOD( SetCurrentCourse )
|
||||||
ADD_METHOD( SetTemporaryEventMode )
|
ADD_METHOD( SetTemporaryEventMode )
|
||||||
|
ADD_METHOD( Env )
|
||||||
ADD_METHOD( SetEnv )
|
ADD_METHOD( SetEnv )
|
||||||
ADD_METHOD( GetEnv )
|
ADD_METHOD( GetEnv )
|
||||||
ADD_METHOD( GetEditSourceSteps )
|
ADD_METHOD( GetEditSourceSteps )
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class TimingData;
|
|||||||
struct StageStats;
|
struct StageStats;
|
||||||
struct PlayerState;
|
struct PlayerState;
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
|
class LuaTable;
|
||||||
|
|
||||||
class GameState
|
class GameState
|
||||||
{
|
{
|
||||||
@@ -65,6 +65,7 @@ public:
|
|||||||
Difficulty GetEasiestNotesDifficulty() const;
|
Difficulty GetEasiestNotesDifficulty() const;
|
||||||
RageTimer m_timeGameStarted; // from the moment the first player pressed Start
|
RageTimer m_timeGameStarted; // from the moment the first player pressed Start
|
||||||
map<CString,CString> m_mapEnv;
|
map<CString,CString> m_mapEnv;
|
||||||
|
LuaTable *m_Environment;
|
||||||
|
|
||||||
/* This is set to a random number per-game/round; it can be used for a random seed. */
|
/* This is set to a random number per-game/round; it can be used for a random seed. */
|
||||||
int m_iGameSeed, m_iStageSeed;
|
int m_iGameSeed, m_iStageSeed;
|
||||||
|
|||||||
Reference in New Issue
Block a user