summaryrefslogtreecommitdiffstats
path: root/pokemod/Nature.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod/Nature.cpp')
-rw-r--r--pokemod/Nature.cpp43
1 files changed, 16 insertions, 27 deletions
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp
index 71a714fb..a38615ac 100644
--- a/pokemod/Nature.cpp
+++ b/pokemod/Nature.cpp
@@ -31,10 +31,10 @@ PokeGen::PokeMod::Nature::Nature(unsigned _id)
id = _id;
}
-PokeGen::PokeMod::Nature::Nature(XmlElement &xml, unsigned _id)
+PokeGen::PokeMod::Nature::Nature(Ini &ini, unsigned _id)
{
- LogCtorXml("Nature", _id);
- ImportXml(xml, _id);
+ LogCtorIni("Nature", _id);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("Nature");
}
@@ -100,44 +100,33 @@ void PokeGen::PokeMod::Nature::Validate(wxListBox &output)
}
#endif
-void PokeGen::PokeMod::Nature::ImportXml(XmlElement &xml, unsigned _id)
+void PokeGen::PokeMod::Nature::ImportIni(Ini &ini, unsigned _id)
{
- LogImport("Nature");
+ LogImportStart("Nature");
String curName;
if (_id == UINT_MAX)
{
- xml.GetValue(id);
- // Was there an id associated with the element?
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the section?
if (id == UINT_MAX)
LogIdNotFound("Nature");
}
else
id = _id;
- name = "";
effects.clear();
- xml.ClearCounter();
- for (XmlElement *child = xml.NextElement(); child; child = xml.NextElement())
- {
- curName = child->GetName();
- if (curName == "name")
- child->GetValue(name);
- else if (curName == "effect")
- effects.push_back(NatureEffect(*child));
- else
- LogUnknownXml("Nature", curName);
- }
+ ini.GetValue("name", name, "");
LogImportOver("Nature");
}
-PokeGen::PokeMod::XmlElement PokeGen::PokeMod::Nature::ExportXml()
+void PokeGen::PokeMod::Nature::ExportIni(const std::ofstream &fout)
{
LogExportStart("Nature");
- XmlElement exNature("nature", id, true);
- exNature.AddElement("name", name);
+ Ini exNature("nature");
+ exNature.AddField("name", name);
+ exNature.Export(fout);
for (std::vector<NatureEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
- exNature.AddElement(i->ExportXml());
+ i->ExportIni(fout, name);
LogExportOver("Nature");
- return exNature;
}
void PokeGen::PokeMod::Nature::SetName(const String &n)
@@ -170,7 +159,7 @@ unsigned PokeGen::PokeMod::Nature::GetNatureEffectCount()
return effects.size();
}
-void PokeGen::PokeMod::Nature::NewNatureEffect()
+void PokeGen::PokeMod::Nature::NewNatureEffect(Ini *ini)
{
unsigned i = 0;
// Find the first unused ID in the vector
@@ -180,8 +169,8 @@ void PokeGen::PokeMod::Nature::NewNatureEffect()
break;
}
NatureEffect newNatureEffect(i);
- if (xml)
- newNatureEffect.ImportXml(*xml);
+ if (ini)
+ newNatureEffect.ImportIni(*ini);
LogSubmoduleNew("Nature", "effect", i, id, name);
effects.push_back(newNatureEffect);
}