summaryrefslogtreecommitdiffstats
path: root/pokemod/Time.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-15 18:57:00 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-15 18:57:00 +0000
commite1b5d7bc705810ac15ed36924617af52abdc8e81 (patch)
tree0dae5af4e2737372ec479bb9ccdd2201edf684a8 /pokemod/Time.cpp
parent12d5161318a4d8d781f896812f5a95fa7b46d8a8 (diff)
[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/Time.cpp')
-rw-r--r--pokemod/Time.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp
index 6807903e..b87106df 100644
--- a/pokemod/Time.cpp
+++ b/pokemod/Time.cpp
@@ -32,10 +32,10 @@ Time::Time(const Pokemod* pokemod, const Time& time, const int id) :
*this = time;
}
-Time::Time(const Pokemod* pokemod, const QString& fileName, const int id) :
+Time::Time(const Pokemod* pokemod, const QDomElement& xml, const int id) :
Object("Time", pokemod, id)
{
- load(fileName, id);
+ load(xml, id);
}
bool Time::validate() const
@@ -60,25 +60,21 @@ bool Time::validate() const
return valid;
}
-void Time::load(const QString& fileName, int id) throw(Exception)
+void Time::load(const QDomElement& xml, int id)
{
- Ini ini(fileName);
- if (id == INT_MAX)
- ini.getValue("id", id);
- setId(id);
- ini.getValue("name", m_name);
- ini.getValue("hour", m_hour, 0);
- ini.getValue("minute", m_minute, 0);
+ LOAD_ID();
+ LOAD(QString, name);
+ LOAD(int, hour);
+ LOAD(int, minute);
}
-void Time::save() const throw(Exception)
+QDomElement Time::save() const
{
- Ini ini;
- ini.addField("id", id());
- ini.addField("name", m_name);
- ini.addField("hour", m_hour);
- ini.addField("minute", m_minute);
- ini.save(QString("%1/time/%2.pini").arg(pokemod()->path()).arg(m_name));
+ SAVE_CREATE();
+ SAVE(QString, name);
+ SAVE(int, hour);
+ SAVE(int, minute);
+ return xml;
}
void Time::setName(const QString& name)
@@ -119,8 +115,8 @@ Time& Time::operator=(const Time& rhs)
{
if (this == &rhs)
return *this;
- m_name = rhs.m_name;
- m_hour = rhs.m_hour;
- m_minute = rhs.m_minute;
+ COPY(name);
+ COPY(hour);
+ COPY(minute);
return *this;
}