terminate engine and output fatal error message if hedgehogs are added incorrectly
authorsheepluva
Wed, 01 Apr 2015 02:42:37 +0200
changeset 10883 294ef49efdd2
parent 10882 ed7717f659ae
child 10884 7b76811fb689
terminate engine and output fatal error message if hedgehogs are added incorrectly
hedgewars/uTeams.pas
--- a/hedgewars/uTeams.pas	Tue Mar 31 23:14:09 2015 +0300
+++ b/hedgewars/uTeams.pas	Wed Apr 01 02:42:37 2015 +0200
@@ -549,10 +549,12 @@
     Gear: PGear;
 begin
 s:= '';
-if (not isDeveloperMode) or (CurrentTeam = nil) then
+if (not isDeveloperMode) then
     exit;
+TryDo((CurrentTeam <> nil), 'Can''t add hedgehogs yet, add a team first!', true);
 with CurrentTeam^ do
     begin
+    TryDo(HedgehogsNumber<=cMaxHHIndex, 'Can''t add hedgehog to "' + TeamName + '"! (already ' + intToStr(HedgehogsNumber) + ' hogs)', true);
     SplitBySpace(id, s);
     SwitchCurrentHedgehog(@Hedgehogs[HedgehogsNumber]);
     CurrentHedgehog^.BotLevel:= StrToInt(id);