diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2007-05-26 13:36:39 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2007-05-26 13:36:39 +0000 |
| commit | dc9682d704118840457aa3434711eba6e003eafc (patch) | |
| tree | 40ccccb7c4a220b656ec92d61277a44380cf30bd /pokemod/EggGroup.cpp | |
| parent | 75b7d5c767428f7061365a186cb17a22de4112cc (diff) | |
const arguments where possible, EggGroup, Move beginnings
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@15 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/EggGroup.cpp')
| -rw-r--r-- | pokemod/EggGroup.cpp | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/pokemod/EggGroup.cpp b/pokemod/EggGroup.cpp new file mode 100644 index 00000000..6c75ba59 --- /dev/null +++ b/pokemod/EggGroup.cpp @@ -0,0 +1,110 @@ +/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/EggGroup.cpp
+// Purpose: Define a type for a Pokémon
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:05:05 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 "EggGroup.h"
+
+PokeGen::PokeMod::EggGroup::EggGroup(const unsigned _id)
+{
+ LogCtor("EggGroup", _id);
+ name = "";
+ id = _id;
+}
+
+PokeGen::PokeMod::EggGroup::EggGroup(Ini &ini, const unsigned _id)
+{
+ LogCtorIni("EggGroup", _id);
+ ImportIni(ini, _id);
+ if (id == UINT_MAX)
+ LogIdError("EggGroup");
+}
+
+PokeGen::PokeMod::EggGroup::~EggGroup()
+{
+ LogDtor("EggGroup", id, name);
+}
+
+void PokeGen::PokeMod::Type::Validate()
+{
+ isValid = true;
+ LogValidateStart("EggGroup", id, name);
+ if (name == "")
+ {
+ LogVarNotSet("EggGroup", id, "name", name);
+ isValid = false;
+ }
+ LogValidateOver("EggGroup", id, isValid, name);
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::Type::Validate(const wxListBox &output)
+{
+ isValid = true;
+ LogValidateStart("EggGroup", id, name);
+ if (name == "")
+ {
+ LogVarNotSet("EggGroup", id, "name", name);
+ output.Append(ConsoleLogVarNotSet("EggGroup", id, "name", name));
+ isValid = false;
+ }
+ LogValidateOver("EggGroup", id, isValid, name);
+}
+#endif
+
+void PokeGen::PokeMod::EggGroup::ImportIni(Ini &ini, const unsigned _id)
+{
+ LogImportStart("EggGroup");
+ String curName;
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ if (id == UINT_MAX)
+ LogIdNotFound("EggGroup");
+ }
+ else
+ id = _id;
+ ini.GetValue("name", name, "");
+ LogImportOver("EggGroup", id, name);
+}
+
+void PokeGen::PokeMod::EggGroup::ExportIni(std::ofstream &fout) const
+{
+ LogExportStart("EggGroup", id, name);
+ // Declare the elements
+ Ini exType("eggGroup");
+ exType.AddField("id", id);
+ exType.AddField("name", name);
+ exType.Export(fout);
+ LogExportOver("EggGroup", id, name);
+}
+
+void PokeGen::PokeMod::EggGroup::SetName(const String &n)
+{
+ LogSetVar("EggGroup", id, "name", n, name);
+ name = n;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::EggGroup::GetName() const
+{
+ LogFetchVar("EggGroup", id, "name", name, name);
+ return name;
+}
|
