Symbolic I/O for more enums

- Nearly every enum that gets written to a file now uses a symbolic form rather than a numeric form. Input supports both forms.
- The special node type enum, however, no longer has a symbolic form output operator, as the only place it's output is in the special nodes file which uses the opcode.
- Collected some enums scattered around the files into one place in simpletypes.hpp
This commit is contained in:
2015-06-13 15:43:29 -04:00
parent a990921e90
commit 0798f98523
25 changed files with 849 additions and 926 deletions

View File

@@ -1085,10 +1085,11 @@ static void readMonstAbilFromXml(ticpp::Element& data, cMonster& monst) {
} else if(type == "range") {
elem->GetText(&general.range);
} else if(type == "extra") {
int n;
elem->GetText(&n);
// Even though it's cast to eFieldType here, it should work correctly if later retrieved as eDamageType or eStatus.
general.fld = eFieldType(n);
if(abil_type == eMonstAbil::DAMAGE || abil_type == eMonstAbil::DAMAGE2)
elem->GetText(&general.dmg);
else if(abil_type == eMonstAbil::FIELD)
elem->GetText(&general.fld);
else elem->GetText(&general.stat);
} else if(type == "chance") {
long double percent;
elem->GetText(&percent);

View File

@@ -244,7 +244,7 @@ void test_special_parse(std::string file) {
std::ofstream fout(file + ".out");
for(auto p : specials) {
fout << "Special node ID " << p.first << ":\n";
fout << " Type: " << p.second.type << '\n';
fout << " Type: " << (*p.second.type).opcode() << '\n';
fout << " SDF: (" << p.second.sd1 << ',' << p.second.sd2 << ")\n";
fout << " Message: (" << p.second.m1 << ',' << p.second.m2 << ',' << p.second.m3 << ")\n";
fout << " Pic: " << p.second.pic << '@' << p.second.pictype << '\n';