some minor cleanups and new asserts

This commit is contained in:
Gered 2013-04-02 12:14:09 -04:00
parent 6de773f270
commit c18ed56011
9 changed files with 52 additions and 23 deletions

View file

@ -11,13 +11,14 @@ GameState::GameState(GameApp *gameApp, StateManager *stateManager)
: EventListenerEx(gameApp->GetEventManager())
{
STACK_TRACE;
ASSERT(gameApp != NULL);
ASSERT(stateManager != NULL);
m_gameApp = gameApp;
m_stateManager = stateManager;
m_effectManager = new EffectManager();
ASSERT(m_effectManager != NULL);
m_processManager = new ProcessManager(this);
ASSERT(m_processManager != NULL);
m_isFinished = FALSE;
m_returnValue = 0;

View file

@ -14,6 +14,8 @@
GwenGameStateUIController::GwenGameStateUIController(GwenGameState *gameState)
{
STACK_TRACE;
ASSERT(gameState != NULL);
m_gameState = gameState;
m_canvas = NULL;
m_inputProcessor = NULL;

View file

@ -13,6 +13,7 @@
StateManager::StateManager(GameApp *gameApp)
{
STACK_TRACE;
ASSERT(gameApp != NULL);
m_gameApp = gameApp;
m_stateReturnValue = 0;
m_hasStateReturnValue = FALSE;

View file

@ -43,12 +43,12 @@ public:
void OnUpdate(float delta);
BOOL IsTransitioning() const;
BOOL IsEmpty() const { return (m_states.empty() && m_pushQueue.empty() && m_swapQueue.empty()); }
BOOL IsTop(const GameState *state) const { return GetTop()->gameState == state; }
BOOL IsTransitioning(const GameState *state) const { return GetStateInfoFor(state)->isTransitioning; }
BOOL IsEmpty() const;
BOOL IsTop(const GameState *state) const;
BOOL IsTransitioning(const GameState *state) const;
GameState* GetTopState() const { return GetTop()->gameState; }
GameState* GetTopNonOverlayState() const { return GetTopNonOverlay()->gameState; }
GameState* GetTopState() const;
GameState* GetTopNonOverlayState() const;
uint32_t GetLastReturnValue() const { return m_stateReturnValue; }
BOOL HasLastReturnValue() const { return m_hasStateReturnValue; }
@ -151,6 +151,31 @@ T* StateManager::SwapTopNonOverlayWith(const stl::string &name)
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
{
if (m_states.empty())