summaryrefslogtreecommitdiffstats
path: root/pokemod/Time.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-05-21 04:18:48 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-05-21 04:18:48 +0000
commit0fec318eac634e5465c30eb73d47ec82aaed9db8 (patch)
tree1851831cbcfce296aeabe7ad553ca936343d4a33 /pokemod/Time.cpp
parent42375a0129fdd57355764c58ed27fa3a0a3c5465 (diff)
downloadsigen-0fec318eac634e5465c30eb73d47ec82aaed9db8.tar.gz
sigen-0fec318eac634e5465c30eb73d47ec82aaed9db8.tar.xz
sigen-0fec318eac634e5465c30eb73d47ec82aaed9db8.zip
Added Time, Store, and PokemonItem
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@11 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Time.cpp')
-rw-r--r--pokemod/Time.cpp164
1 files changed, 164 insertions, 0 deletions
diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp
new file mode 100644
index 00000000..d18d826f
--- /dev/null
+++ b/pokemod/Time.cpp
@@ -0,0 +1,164 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: Time.cpp
+// Purpose: Define the start of a time of day in the PokéMod
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Wed Feb 28 21:00:46 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "Time.h"
+
+PokeGen::PokeMod::Time::Time(unsigned _id)
+{
+ LogCtor("Time", id);
+ name = "";
+ startHour = 0;
+ startMinute = 0;
+ id = _id;
+}
+
+PokeGen::PokeMod::Time::Time(Ini &ini, unsigned _id)
+{
+ LogCtorIni("Time", _id);
+ ImportIni(ini, _id);
+ if(_id == UINT_MAX)
+ LogIdError("Time");
+}
+
+PokeGen::PokeMod::Time::~Time()
+{
+ LogDtor("Time", id, name);
+}
+
+void PokeGen::PokeMod::Time::Validate()
+{
+ isValid = true;
+ LogValidateStart("Time", id, name);
+ if (name == "")
+ {
+ LogVarNotSet("Time", id, "name", name);
+ isValid = false;
+ }
+ if (23 < startHour)
+ {
+ LogVarNotValid("Time", id, "startHour", name);
+ isValid = false;
+ }
+ if (59 < startMinute)
+ {
+ LogVarNotValid("Time", id, "startMinute", name);
+ isValid = false;
+ }
+ LogValidateOver("Time", id, isValid, name);
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::Time::Validate(const wxListBox &output)
+{
+ isValid = true;
+ LogValidateStart("Time", id, name);
+ if (name == "")
+ {
+ LogVarNotSet("Time", id, "name", name);
+ output.Append(ConsoleLogVarNotSet("Time", id, "name", name));
+ isValid = false;
+ }
+ if (23 < startHour)
+ {
+ LogVarNotValid("Time", id, "startHour", name);
+ output.Append(ConsoleLogVarNotValid("Time", id, "startHour", name));
+ isValid = false;
+ }
+ if (59 < startMinute)
+ {
+ LogVarNotValid("Time", id, "startMinute", name);
+ output.Append(ConsoleLogVarNotValid("Time", id, "startMinute", name));
+ isValid = false;
+ }
+ LogValidateOver("Time", id, isValid, name);
+}
+#endif
+
+void PokeGen::PokeMod::Time::ImportIni(Ini &ini, unsigned _id)
+{
+ LogImportStart("Time");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("Time");
+ }
+ else
+ id = _id;
+ ini.GetValue("name", name, "");
+ ini.GetValue("startHour", startHour, 0);
+ ini.GetValue("startMinute", startMinute, 0);
+ LogImportOver("Time", id, name);
+}
+
+void PokeGen::PokeMod::Time::ExportIni(std::ofstream &fout) const
+{
+ LogExportStart("Time", id, name);
+ // Make elements
+ Ini exTime("time");
+ exTime.AddField("id", id);
+ exTime.AddField("name", name);
+ exTime.AddField("startHour", startHour);
+ exTime.AddField("startMinute", startMinute);
+ exTime.Export(fout);
+ LogExportOver("Time", id, name);
+}
+
+void PokeGen::PokeMod::Time::SetName(const String &n)
+{
+ LogSetVar("Time", id, "name", n, name);
+ name = n;
+}
+
+void PokeGen::PokeMod::Time::SetStartHour(unsigned h)
+{
+ LogSetVar("Time", id, "startHour", h, name);
+ if (h < 24)
+ startHour = h;
+}
+
+void PokeGen::PokeMod::Time::SetStartMinute(unsigned m)
+{
+ LogSetVar("Time", id, "startMinute", m, name);
+ if (m < 60)
+ startMinute = m;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::Time::GetName() const
+{
+ LogFetchVar("Time", id, "name", name, name);
+ return name;
+}
+
+unsigned PokeGen::PokeMod::Time::GetStartHour() const
+{
+ LogFetchVar("Time", id, "startHour", startHour, name);
+ return startHour;
+}
+
+unsigned PokeGen::PokeMod::Time::GetStartMinute() const
+{
+ LogFetchVar("Time", id, "startMinute", startMinute, name);
+ return startMinute;
+}