diff --git a/source/network/FSM.cpp b/source/network/FSM.cpp index d2e8e5184d..fdca70eb66 100644 --- a/source/network/FSM.cpp +++ b/source/network/FSM.cpp @@ -50,7 +50,6 @@ void CFsm::Setup() void CFsm::Shutdown() { - m_States.clear(); m_Transitions.clear(); m_Done = false; @@ -59,20 +58,9 @@ void CFsm::Shutdown() m_NextState = FSM_INVALID_STATE; } -void CFsm::AddState(unsigned int state) -{ - m_States.insert(state); -} - void CFsm::AddTransition(unsigned int state, unsigned int eventType, unsigned int nextState, Action* pAction /* = nullptr */, void* pContext /* = nullptr*/) { - // Make sure we store the current state - AddState(state); - - // Make sure we store the next state - AddState(nextState); - m_Transitions.insert({TransitionKey{state, eventType}, Transition{{pAction, pContext}, nextState}}); } @@ -96,9 +84,6 @@ bool CFsm::Update(unsigned int eventType, void* pEventParam) if (IsFirstTime()) m_CurrState = m_FirstState; - if (!IsValidState(m_CurrState)) - return false; - // Lookup transition auto transitionIterator = m_Transitions.find({m_CurrState, eventType}); if (transitionIterator == m_Transitions.end()) @@ -126,12 +111,3 @@ bool CFsm::IsDone() const // By default the internal flag m_Done is tested return m_Done; } - -bool CFsm::IsValidState(unsigned int state) const -{ - StateSet::const_iterator it = m_States.find(state); - if (it == m_States.end()) - return false; - - return true; -} diff --git a/source/network/FSM.h b/source/network/FSM.h index fab678421b..482b54f88a 100644 --- a/source/network/FSM.h +++ b/source/network/FSM.h @@ -19,7 +19,6 @@ #define FSM_H #include -#include #include @@ -41,8 +40,6 @@ struct CallbackFunction } }; -using StateSet = std::set; - /** * Represents a signal in the state machine that a change has occurred. * The CFsmEvent objects are under the control of CFsm so @@ -101,12 +98,6 @@ public: */ void Shutdown(); - /** - * Adds the specified state to the internal list of states. - * @note If a state with the specified ID exists, the state is not added. - */ - void AddState(unsigned int state); - /** * Adds a new transistion to the state machine. */ @@ -137,22 +128,12 @@ public: return m_NextState; } - const StateSet& GetStates() const - { - return m_States; - } - /** * Updates the FSM and retrieves next state. * @return whether the state was changed. */ bool Update(unsigned int eventType, void* pEventData); - /** - * Verifies whether the specified state is managed by the FSM. - */ - bool IsValidState(unsigned int state) const; - /** * Tests whether the state machine has finished its work. * @note This is state machine specific. @@ -200,7 +181,6 @@ private: unsigned int m_FirstState; unsigned int m_CurrState; unsigned int m_NextState; - StateSet m_States; TransitionMap m_Transitions; }; diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp index 5e005e0744..72c206fefd 100644 --- a/source/network/NetServer.cpp +++ b/source/network/NetServer.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2023 Wildfire Games. +/* Copyright (C) 2024 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -48,6 +48,7 @@ #include #endif +#include #include /**