choice fields show only the highest level of choices in statistics panel

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@361 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-13 22:23:38 +00:00
parent b46db1f9c9
commit ff745244d3
7 changed files with 86 additions and 17 deletions
+4 -4
View File
@@ -13,7 +13,7 @@
// ----------------------------------------------------------------------------- : Variables
typedef map<String, unsigned int> Variables;
typedef map<String, Variable> Variables;
Variables variables;
DECLARE_TYPEOF(Variables);
#ifdef _DEBUG
@@ -21,13 +21,13 @@ DECLARE_TYPEOF(Variables);
#endif
/// Return a unique name for a variable to allow for faster loopups
unsigned int string_to_variable(const String& s) {
Variable string_to_variable(const String& s) {
map<String, unsigned int>::iterator it = variables.find(s);
if (it == variables.end()) {
#ifdef _DEBUG
variable_names.push_back(s);
#endif
unsigned int v = (unsigned int)variables.size();
Variable v = (Variable)variables.size();
variables.insert(make_pair(s,v));
return v;
} else {
@@ -38,7 +38,7 @@ unsigned int string_to_variable(const String& s) {
/// Get the name of a vaiable
/** Warning: this function is slow, it should only be used for error messages and such.
*/
String variable_to_string(unsigned int v) {
String variable_to_string(Variable v) {
FOR_EACH(vi, variables) {
if (vi.second == v) return vi.first;
}