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:
@@ -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);
|
||||
|
@@ -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';
|
||||
|
Reference in New Issue
Block a user