]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
combine 2 ifs to shorten code a little
authorWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 14 Aug 2012 15:48:22 +0000 (17:48 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 14 Aug 2012 15:48:22 +0000 (17:48 +0200)
parser.c

index de6248571592deca59c10d5fdbbb1c027e9c3209..eedea46056ec378ec78e44fa3575b12349e3c235 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -613,13 +613,9 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy)
             break;
         case opid2('+','='):
         case opid2('-','='):
-            if (exprs[0]->expression.vtype != exprs[1]->expression.vtype) {
-                parseerror(parser, "invalid types used in expression: cannot add or subtract type %s and %s",
-                           type_name[exprs[0]->expression.vtype],
-                           type_name[exprs[1]->expression.vtype]);
-                return false;
-            }
-            if (exprs[0]->expression.vtype != TYPE_VECTOR && exprs[0]->expression.vtype != TYPE_FLOAT) {
+            if (exprs[0]->expression.vtype != exprs[1]->expression.vtype ||
+                (exprs[0]->expression.vtype != TYPE_VECTOR && exprs[0]->expression.vtype != TYPE_FLOAT) )
+            {
                 parseerror(parser, "invalid types used in expression: cannot add or subtract type %s and %s",
                            type_name[exprs[0]->expression.vtype],
                            type_name[exprs[1]->expression.vtype]);