More read/write test cases for monsters, especially monster abilities

Fixes:
- For radiate abilities, the pattern was not saved and defaulted to single instead of square on load
- For summon abilities, what to summon was not saved and chance was incorrectly saved
This commit is contained in:
2015-09-27 00:58:10 -04:00
parent ab232bb31a
commit 18bb16df9c
46 changed files with 1511 additions and 17 deletions

View File

@@ -572,17 +572,21 @@ void writeMonstersToXml(ticpp::Printer&& data, cScenario& scenario) {
case eMonstAbilCat::SUMMON:
data.OpenElement("summon");
data.PushAttribute("type", abil);
data.PushElement("type", param.summon.type);
if(param.summon.type == eMonstSummon::SPECIES)
data.PushElement("race", eRace(param.summon.what));
else data.PushElement(boost::lexical_cast<std::string>(param.summon.type), param.summon.what);
data.PushElement("min", param.summon.min);
data.PushElement("max", param.summon.max);
data.PushElement("duration", param.summon.len);
data.PushElement("chance", param.summon.chance);
str << std::fixed << std::setprecision(1) << float(param.summon.chance)/10;
data.PushElement("chance", str.str());
data.CloseElement("summon");
break;
case eMonstAbilCat::RADIATE:
data.OpenElement("radiate");
data.PushAttribute("type", abil);
data.PushElement("type", param.radiate.type);
data.PushElement("pattern", param.radiate.pat);
data.PushElement("chance", param.radiate.chance);
data.CloseElement("radiate");
break;