- Fix 'and not' without parentheses webgl
authorunc0rr
Sat, 15 Jun 2013 23:45:53 +0400
branchwebgl
changeset 9166 3774ac58e65e
parent 9164 d923ba9d1145
child 9168 20ff80421736
- Fix 'and not' without parentheses - Better detection of such occasions
hedgewars/GSHandlers.inc
tools/pas2c/PascalParser.hs
--- a/hedgewars/GSHandlers.inc	Sat Jun 15 23:44:37 2013 +0400
+++ b/hedgewars/GSHandlers.inc	Sat Jun 15 23:45:53 2013 +0400
@@ -1593,7 +1593,7 @@
     if (Gear^.dY.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and (TestCollisionYwithGear(Gear, 1) = 0) then
         SetLittle(Gear^.dY);
     Gear^.State := Gear^.State or gstAnimation;
-    if Gear^.Health < cBarrelHealth then Gear^.State:= Gear^.State and not gstFrozen;
+    if Gear^.Health < cBarrelHealth then Gear^.State:= Gear^.State and (not gstFrozen);
 
     if ((Gear^.dX.QWordValue <> 0)
     or (Gear^.dY.QWordValue <> 0))  then
@@ -1679,7 +1679,7 @@
                 Gear^.Message := Gear^.Message and (not (gmLJump or gmHJump));
         exit
         end;
-    if (k = gtExplosives) and (Gear^.Health < cBarrelHealth) then Gear^.State:= Gear^.State and not gstFrozen;
+    if (k = gtExplosives) and (Gear^.Health < cBarrelHealth) then Gear^.State:= Gear^.State and (not gstFrozen);
 
     if ((k <> gtExplosives) and (Gear^.Damage > 0)) or ((k = gtExplosives) and (Gear^.Health<=0)) then
         begin
--- a/tools/pas2c/PascalParser.hs	Sat Jun 15 23:44:37 2013 +0400
+++ b/tools/pas2c/PascalParser.hs	Sat Jun 15 23:45:53 2013 +0400
@@ -24,9 +24,10 @@
     return u
 
 iD = do
-    i <- liftM (flip Identifier BTUnknown) (identifier pas)
+    i <- identifier pas
     comments
-    return i
+    when (i == "not") $ unexpected "'not' used as an identifier"
+    return $ Identifier i BTUnknown
 
 unit = do
     string "unit" >> comments