Index: ps/trunk/source/network/FSM.h =================================================================== --- ps/trunk/source/network/FSM.h +++ ps/trunk/source/network/FSM.h @@ -19,7 +19,6 @@ #define FSM_H #include -#include #include @@ -41,8 +40,6 @@ } }; -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 @@ -102,12 +99,6 @@ 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. */ void AddTransition(unsigned int state, unsigned int eventType, unsigned int nextState, @@ -137,11 +128,6 @@ return m_NextState; } - const StateSet& GetStates() const - { - return m_States; - } - /** * Updates the FSM and retrieves next state. * @return whether the state was changed. @@ -149,11 +135,6 @@ 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 @@ unsigned int m_FirstState; unsigned int m_CurrState; unsigned int m_NextState; - StateSet m_States; TransitionMap m_Transitions; }; Index: ps/trunk/source/network/FSM.cpp =================================================================== --- ps/trunk/source/network/FSM.cpp +++ ps/trunk/source/network/FSM.cpp @@ -50,7 +50,6 @@ void CFsm::Shutdown() { - m_States.clear(); m_Transitions.clear(); m_Done = false; @@ -59,20 +58,9 @@ 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 @@ 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 @@ // 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; -} Index: ps/trunk/source/network/NetServer.cpp =================================================================== --- ps/trunk/source/network/NetServer.cpp +++ ps/trunk/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 /**