diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-15 18:57:00 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-15 18:57:00 +0000 |
| commit | e1b5d7bc705810ac15ed36924617af52abdc8e81 (patch) | |
| tree | 0dae5af4e2737372ec479bb9ccdd2201edf684a8 /pokemod/Dialog.cpp | |
| parent | 12d5161318a4d8d781f896812f5a95fa7b46d8a8 (diff) | |
| download | sigen-e1b5d7bc705810ac15ed36924617af52abdc8e81.tar.gz sigen-e1b5d7bc705810ac15ed36924617af52abdc8e81.tar.xz sigen-e1b5d7bc705810ac15ed36924617af52abdc8e81.zip | |
[FIX] Object::mid -> m_id
[FIX] XML is now used
[FIX] Images are stored in the XML file and classes rather than relying on external images
[FIX] Frac no longer keeps track of its type; the class should do it
[ADD] pokemod/Object.cpp
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@97 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Dialog.cpp')
| -rw-r--r-- | pokemod/Dialog.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp index aae66688..01463a48 100644 --- a/pokemod/Dialog.cpp +++ b/pokemod/Dialog.cpp @@ -45,10 +45,10 @@ Dialog::Dialog(const Pokemod* pokemod, const Dialog& dialog, const int id) : *this = dialog; } -Dialog::Dialog(const Pokemod* pokemod, const QString& fileName, const int id) : +Dialog::Dialog(const Pokemod* pokemod, const QDomElement& xml, const int id) : Object("Dialog", pokemod, id) { - load(fileName, id); + load(xml, id); } bool Dialog::validate() const @@ -552,15 +552,17 @@ bool Dialog::validate() const case Music: if (numArgs == 1) { - if (!QFile(QString("%1/music/%2").arg(pokemod()->path()).arg(arg)).exists()) - invError = 1; + // FIXME: find sound files +// if (!QFile(QString("%1/music/%2").arg(pokemod()->path()).arg(arg)).exists()) +// invError = 1; } break; case SoundEffect: if (numArgs == 1) { - if (!QFile(QString("%1/sound/%2").arg(pokemod()->path()).arg(arg)).exists()) - invError = 1; + // FIXME: find sound files +// if (!QFile(QString("%1/sound/%2").arg(pokemod()->path()).arg(arg)).exists()) +// invError = 1; } else if (numArgs == 2) { @@ -657,21 +659,17 @@ bool Dialog::validate() const return valid; } -void Dialog::load(const QString& fileName, int id) throw(Exception) +void Dialog::load(const QDomElement& xml, int id) { - Ini ini(fileName); - if (id == INT_MAX) - ini.getValue("id", id); - setId(id); - ini.getValue("dialog", m_dialog); + LOAD_ID(); + LOAD(QString, dialog); } -void Dialog::save() const throw(Exception) +QDomElement Dialog::save() const { - Ini ini; - ini.addField("id", id()); - ini.addField("dialog", m_dialog); - ini.save(QString("%1/dialog/%2.pini").arg(pokemod()->path()).arg(id())); + SAVE_CREATE(); + SAVE(QString, dialog); + return xml; } void Dialog::setDialog(const QString& dialog) @@ -695,6 +693,6 @@ Dialog& Dialog::operator=(const Dialog& rhs) { if (this == &rhs) return *this; - m_dialog = rhs.m_dialog; + COPY(dialog); return *this; } |
