gui2/tgamestate_inspector: Include array subscripts for WML array elements

This commit is contained in:
Ignacio R. Morelle 2014-10-08 00:15:17 -03:00
parent 05bb335931
commit 28a84edba3
2 changed files with 12 additions and 1 deletions

View file

@ -96,6 +96,8 @@ Version 1.11.16:
WML in text form instead of a simplified version.
* Added a button to copy the currently displayed content from the :inspect
dialog to clipboard.
* WML array elements are now displayed with subscripts in the :inspect
dialog.
* Fixed the WML load error dialog not displaying an add-on name instead of
falling back to its directory name if the add-on contains an outdated
_info.cfg file lacking an [info]title= value.

View file

@ -238,12 +238,21 @@ public:
model_.add_row_to_stuff_list(a.first, a.first);
}
std::map<std::string, size_t> wml_array_sizes;
FOREACH(const AUTO & c, vars.all_children_range())
{
if (wml_array_sizes.find(c.key) == wml_array_sizes.end()) {
wml_array_sizes[c.key] = 0;
} else {
++wml_array_sizes[c.key];
}
unsigned int num_pages = model_.get_num_page(config_to_string(c.cfg));
for (unsigned int i = 0; i < num_pages; i++) {
std::ostringstream cur_str;
cur_str << "[" << c.key << "] " << (i + 1) << "/" << num_pages;
cur_str << "[" << c.key << "][" << wml_array_sizes[c.key] << "] "
<< (i + 1) << "/" << num_pages;
model_.add_row_to_stuff_list(cur_str.str(), cur_str.str());
}
}