some minor cleanups and new asserts
This commit is contained in:
parent
6de773f270
commit
c18ed56011
|
@ -11,13 +11,14 @@ GameState::GameState(GameApp *gameApp, StateManager *stateManager)
|
||||||
: EventListenerEx(gameApp->GetEventManager())
|
: EventListenerEx(gameApp->GetEventManager())
|
||||||
{
|
{
|
||||||
STACK_TRACE;
|
STACK_TRACE;
|
||||||
|
ASSERT(gameApp != NULL);
|
||||||
|
ASSERT(stateManager != NULL);
|
||||||
|
|
||||||
m_gameApp = gameApp;
|
m_gameApp = gameApp;
|
||||||
m_stateManager = stateManager;
|
m_stateManager = stateManager;
|
||||||
|
|
||||||
m_effectManager = new EffectManager();
|
m_effectManager = new EffectManager();
|
||||||
ASSERT(m_effectManager != NULL);
|
|
||||||
m_processManager = new ProcessManager(this);
|
m_processManager = new ProcessManager(this);
|
||||||
ASSERT(m_processManager != NULL);
|
|
||||||
|
|
||||||
m_isFinished = FALSE;
|
m_isFinished = FALSE;
|
||||||
m_returnValue = 0;
|
m_returnValue = 0;
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
GwenGameStateUIController::GwenGameStateUIController(GwenGameState *gameState)
|
GwenGameStateUIController::GwenGameStateUIController(GwenGameState *gameState)
|
||||||
{
|
{
|
||||||
STACK_TRACE;
|
STACK_TRACE;
|
||||||
|
ASSERT(gameState != NULL);
|
||||||
|
|
||||||
m_gameState = gameState;
|
m_gameState = gameState;
|
||||||
m_canvas = NULL;
|
m_canvas = NULL;
|
||||||
m_inputProcessor = NULL;
|
m_inputProcessor = NULL;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
StateManager::StateManager(GameApp *gameApp)
|
StateManager::StateManager(GameApp *gameApp)
|
||||||
{
|
{
|
||||||
STACK_TRACE;
|
STACK_TRACE;
|
||||||
|
ASSERT(gameApp != NULL);
|
||||||
m_gameApp = gameApp;
|
m_gameApp = gameApp;
|
||||||
m_stateReturnValue = 0;
|
m_stateReturnValue = 0;
|
||||||
m_hasStateReturnValue = FALSE;
|
m_hasStateReturnValue = FALSE;
|
||||||
|
|
|
@ -43,12 +43,12 @@ public:
|
||||||
void OnUpdate(float delta);
|
void OnUpdate(float delta);
|
||||||
|
|
||||||
BOOL IsTransitioning() const;
|
BOOL IsTransitioning() const;
|
||||||
BOOL IsEmpty() const { return (m_states.empty() && m_pushQueue.empty() && m_swapQueue.empty()); }
|
BOOL IsEmpty() const;
|
||||||
BOOL IsTop(const GameState *state) const { return GetTop()->gameState == state; }
|
BOOL IsTop(const GameState *state) const;
|
||||||
BOOL IsTransitioning(const GameState *state) const { return GetStateInfoFor(state)->isTransitioning; }
|
BOOL IsTransitioning(const GameState *state) const;
|
||||||
|
|
||||||
GameState* GetTopState() const { return GetTop()->gameState; }
|
GameState* GetTopState() const;
|
||||||
GameState* GetTopNonOverlayState() const { return GetTopNonOverlay()->gameState; }
|
GameState* GetTopNonOverlayState() const;
|
||||||
|
|
||||||
uint32_t GetLastReturnValue() const { return m_stateReturnValue; }
|
uint32_t GetLastReturnValue() const { return m_stateReturnValue; }
|
||||||
BOOL HasLastReturnValue() const { return m_hasStateReturnValue; }
|
BOOL HasLastReturnValue() const { return m_hasStateReturnValue; }
|
||||||
|
@ -151,6 +151,31 @@ T* StateManager::SwapTopNonOverlayWith(const stl::string &name)
|
||||||
return newState;
|
return newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline BOOL StateManager::IsEmpty() const
|
||||||
|
{
|
||||||
|
return (m_states.empty() && m_pushQueue.empty() && m_swapQueue.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline BOOL StateManager::IsTop(const GameState *state) const
|
||||||
|
{
|
||||||
|
return GetTop()->gameState == state;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline BOOL StateManager::IsTransitioning(const GameState *state) const
|
||||||
|
{
|
||||||
|
return GetStateInfoFor(state)->isTransitioning;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline GameState* StateManager::GetTopState() const
|
||||||
|
{
|
||||||
|
return GetTop()->gameState;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline GameState* StateManager::GetTopNonOverlayState() const
|
||||||
|
{
|
||||||
|
return GetTopNonOverlay()->gameState;
|
||||||
|
}
|
||||||
|
|
||||||
inline StateInfo* StateManager::GetTop() const
|
inline StateInfo* StateManager::GetTop() const
|
||||||
{
|
{
|
||||||
if (m_states.empty())
|
if (m_states.empty())
|
||||||
|
|
Reference in a new issue