Author: dragonking
Date: Fri Apr 11 16:07:17 2008
New Revision: 25744
URL: http://svn.gna.org/viewcvs/wesnoth?rev=25744&view=rev
Log:
Improvement to the formula operator []
Modified:
trunk/src/formula.cpp
Modified: trunk/src/formula.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formula.cpp?rev=25744&r1=25743&r2=25744&view=diff
==============================================================================
--- trunk/src/formula.cpp (original)
+++ trunk/src/formula.cpp Fri Apr 11 16:07:17 2008
@@ -675,7 +675,13 @@
return parse_expression(i1+1,i2-1,symbols);
} else if( (i2-1)->type == TOKEN_RSQUARE) { //check if there is
[ ] : either a list definition, or a operator
const token* tok = i2-2;
- while (tok->type != TOKEN_LSQUARE && tok != i1)
{
+ int square_parens = 0;
+ while ( (tok->type != TOKEN_LSQUARE ||
square_parens) && tok != i1) {
+ if (tok->type == TOKEN_RSQUARE)
{
+ square_parens++;
+ } else if(tok->type ==
TOKEN_LSQUARE) {
+ square_parens--;
+ }
--tok;
}
if (tok->type == TOKEN_LSQUARE) {
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits