Remove unused previous state in AI StateMachine
The StateMachine offered a feature to remember the previous state and allow reverting to it. However this feature is unused. Remove it to allow the previous states to be reclaimed by the GC earlier.
This commit is contained in:
@@ -14,18 +14,14 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
sealed class StateMachine
|
||||
{
|
||||
IState currentState;
|
||||
IState previousState;
|
||||
|
||||
public void Update(Squad squad)
|
||||
{
|
||||
currentState?.Tick(squad);
|
||||
}
|
||||
|
||||
public void ChangeState(Squad squad, IState newState, bool rememberPrevious)
|
||||
public void ChangeState(Squad squad, IState newState)
|
||||
{
|
||||
if (rememberPrevious)
|
||||
previousState = currentState;
|
||||
|
||||
currentState?.Deactivate(squad);
|
||||
|
||||
if (newState != null)
|
||||
@@ -33,11 +29,6 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
|
||||
currentState?.Activate(squad);
|
||||
}
|
||||
|
||||
public void RevertToPreviousState(Squad squad, bool saveCurrentState)
|
||||
{
|
||||
ChangeState(squad, previousState, saveCurrentState);
|
||||
}
|
||||
}
|
||||
|
||||
interface IState
|
||||
|
||||
Reference in New Issue
Block a user