--- a/hedgewars/uAI.pas Mon Oct 22 21:24:38 2012 +0400
+++ b/hedgewars/uAI.pas Mon Oct 22 23:35:12 2012 +0400
@@ -151,7 +151,7 @@
else if (ap.Angle < 0) then
AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0);
- if (ap.Time <> 0) then
+ if (Ammoz[a].Ammo.Propz and ammoprop_Timerable) <> 0 then
AddAction(BestActions, aia_Timer, ap.Time div 1000, 400, 0, 0);
if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
--- a/hedgewars/uAIAmmoTests.pas Mon Oct 22 21:24:38 2012 +0400
+++ b/hedgewars/uAIAmmoTests.pas Mon Oct 22 23:35:12 2012 +0400
@@ -287,7 +287,6 @@
begin
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level));
ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
- ap.Time:= TestTime;
ap.ExplR:= 100;
ap.ExplX:= EX;
ap.ExplY:= EY;
@@ -496,6 +495,7 @@
begin
TestMortar:= BadTurn;
ap.ExplR:= 0;
+
meX:= hwFloat2Float(Me^.X);
meY:= hwFloat2Float(Me^.Y);
--- a/hedgewars/uCommandHandlers.pas Mon Oct 22 21:24:38 2012 +0400
+++ b/hedgewars/uCommandHandlers.pas Mon Oct 22 23:35:12 2012 +0400
@@ -442,9 +442,11 @@
procedure chTimer(var s: shortstring);
begin
-if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then
+if CheckNoTeamOrHH then
exit;
+TryDo((s[0] = #1) and (s[1] >= '1') and (s[1] <= '5'), 'Malformed /timer', true);
+
if not CurrentTeam^.ExtDriven then
SendIPC(s);
bShowFinger:= false;
@@ -482,11 +484,10 @@
procedure chSetWeapon(var s: shortstring);
begin
- if (s[0] <> #1) or CheckNoTeamOrHH then
+ if CheckNoTeamOrHH then
exit;
- if TAmmoType(s[1]) > High(TAmmoType) then
- exit;
+ TryDo((s[0] = #1) and (s[1] <= char(High(TAmmoType))), 'Malformed /setweap', true);
if not CurrentTeam^.ExtDriven then
SendIPC('w' + s);