From c363e7fc13a728d690ce7fb04e366cd0fc95f3c3 Mon Sep 17 00:00:00 2001 From: phosit Date: Thu, 21 Mar 2024 17:43:34 +0000 Subject: [PATCH] Default many of CFsm's special functions and remove virtual specifires Differential Revision: https://code.wildfiregames.com/D5249 git-svn-id: https://svn.wildfiregames.com/public/ps/trunk@28053 3db68df2-c116-0410-a063-a993310a9797 --- source/network/FSM.cpp | 29 ----------------------------- source/network/FSM.h | 27 +++++---------------------- 2 files changed, 5 insertions(+), 51 deletions(-) diff --git a/source/network/FSM.cpp b/source/network/FSM.cpp index fdca70eb66..0a2e53fcd8 100644 --- a/source/network/FSM.cpp +++ b/source/network/FSM.cpp @@ -30,34 +30,6 @@ CFsmEvent::~CFsmEvent() m_Param = nullptr; } -CFsm::CFsm() -{ - m_Done = false; - m_FirstState = FSM_INVALID_STATE; - m_CurrState = FSM_INVALID_STATE; - m_NextState = FSM_INVALID_STATE; -} - -CFsm::~CFsm() -{ - Shutdown(); -} - -void CFsm::Setup() -{ - // Does nothing by default -} - -void CFsm::Shutdown() -{ - m_Transitions.clear(); - - m_Done = false; - m_FirstState = FSM_INVALID_STATE; - m_CurrState = FSM_INVALID_STATE; - m_NextState = FSM_INVALID_STATE; -} - void CFsm::AddTransition(unsigned int state, unsigned int eventType, unsigned int nextState, Action* pAction /* = nullptr */, void* pContext /* = nullptr*/) { @@ -108,6 +80,5 @@ bool CFsm::Update(unsigned int eventType, void* pEventParam) bool CFsm::IsDone() const { - // By default the internal flag m_Done is tested return m_Done; } diff --git a/source/network/FSM.h b/source/network/FSM.h index 482b54f88a..28a1d2d890 100644 --- a/source/network/FSM.h +++ b/source/network/FSM.h @@ -81,23 +81,7 @@ private: */ class CFsm { - NONCOPYABLE(CFsm); public: - - CFsm(); - virtual ~CFsm(); - - /** - * Constructs the state machine. This method must be overriden so that - * connections are constructed for the particular state machine implemented. - */ - virtual void Setup(); - - /** - * Clear event, transition lists and reset state machine. - */ - void Shutdown(); - /** * Adds a new transistion to the state machine. */ @@ -136,9 +120,8 @@ public: /** * Tests whether the state machine has finished its work. - * @note This is state machine specific. */ - virtual bool IsDone() const; + bool IsDone() const; private: struct TransitionKey @@ -177,10 +160,10 @@ private: */ bool IsFirstTime() const; - bool m_Done; - unsigned int m_FirstState; - unsigned int m_CurrState; - unsigned int m_NextState; + bool m_Done{false}; + unsigned int m_FirstState{FSM_INVALID_STATE}; + unsigned int m_CurrState{FSM_INVALID_STATE}; + unsigned int m_NextState{FSM_INVALID_STATE}; TransitionMap m_Transitions; }; -- 2.11.4.GIT