Use Evaluator for positioning; Refactoring; Position elements relative to parents; Broke clicks outside of parent rect

This commit is contained in:
Paul Chote
2010-03-15 19:56:29 +13:00
parent 9ecb0d57f1
commit b70420e373
5 changed files with 79 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -29,7 +29,6 @@ namespace OpenRA.FileFormats
default: s.Push(int.Parse(t)); break;
}
}
return s.Pop();
}
@@ -43,7 +42,6 @@ namespace OpenRA.FileFormats
static IEnumerable<string> ToPostfix(IEnumerable<string> toks, Dictionary<string, int> syms)
{
var s = new Stack<string>();
foreach (var t in toks)
{
if (t[0] == '(') s.Push(t);
@@ -53,14 +51,20 @@ namespace OpenRA.FileFormats
while ((temp = s.Pop()) != "(") yield return temp;
}
else if (char.IsNumber(t[0])) yield return t;
else if (char.IsLetter(t[0])) yield return syms[t].ToString();
else if (char.IsLetter(t[0]))
{
if (!syms.ContainsKey(t))
throw new InvalidOperationException("Substitution `{0}` undefined".F(t));
yield return syms[t].ToString();;
}
else
{
while (s.Count > 0 && Prec[t] <= Prec[s.Peek()]) yield return s.Pop();
s.Push(t);
}
}
while (s.Count > 0) yield return s.Pop();
}