hedgewars/uCommandHandlers.pas
changeset 7790 040fc517fece
parent 7722 1518827049ed
child 7805 2a249a4faf5b
--- 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);