Author: dragonking
Date: Thu Aug 21 20:01:14 2008
New Revision: 28829
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28829&view=rev
Log:
Attempt to fix formula operator problems
Modified:
trunk/src/formula.cpp
Modified: trunk/src/formula.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formula.cpp?rev=28829&r1=28828&r2=28829&view=diff
==============================================================================
--- trunk/src/formula.cpp (original)
+++ trunk/src/formula.cpp Thu Aug 21 20:01:14 2008
@@ -673,16 +673,20 @@
int parens = 0;
const token* op = NULL;
+ bool operator_group = false;
for(const token* i = i1; i != i2; ++i) {
if(i->type == TOKEN_LPARENS || i->type == TOKEN_LSQUARE) {
++parens;
} else if(i->type == TOKEN_RPARENS || i->type == TOKEN_RSQUARE)
{
--parens;
} else if(parens == 0 && i->type == TOKEN_OPERATOR) {
- if(op == NULL || operator_precedence(*op) >
-
operator_precedence(*i)) {
+ if( ( !operator_group ) && (op == NULL ||
operator_precedence(*op) >=
+
operator_precedence(*i)) ) {
op = i;
- }
+ operator_group = true;
+ }
+ } else {
+ operator_group = false;
}
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits