Don't allow the last behavior to be removed from a pCampbot bot

If you want to stop existing behavious, add the None behaviour.
bullet-2.82
Justin Clark-Casey (justincc) 2014-08-15 22:43:55 +01:00
parent 1d2933ca51
commit 3a643e2456
2 changed files with 4 additions and 1 deletions

View File

@ -208,6 +208,9 @@ namespace pCampBot
public bool RemoveBehaviour(string abbreviatedName) public bool RemoveBehaviour(string abbreviatedName)
{ {
if (Behaviours.Count <= 0)
return false;
Dictionary<string, IBehaviour> updatedBehaviours = new Dictionary<string, IBehaviour>(Behaviours); Dictionary<string, IBehaviour> updatedBehaviours = new Dictionary<string, IBehaviour>(Behaviours);
IBehaviour behaviour; IBehaviour behaviour;

View File

@ -628,7 +628,7 @@ namespace pCampBot
} }
MainConsole.Instance.OutputFormat( MainConsole.Instance.OutputFormat(
"Removed behaviours {0} to bot {1}", "Removed behaviours {0} from bot {1}",
string.Join(", ", behavioursRemoved.ConvertAll<string>(b => b.Name).ToArray()), bot.Name); string.Join(", ", behavioursRemoved.ConvertAll<string>(b => b.Name).ToArray()), bot.Name);
} }
} }