summaryrefslogtreecommitdiffstats
path: root/pokemod
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod')
-rw-r--r--pokemod/Ability.cpp51
-rw-r--r--pokemod/Ability.h3
-rw-r--r--pokemod/AbilityEffect.cpp188
-rw-r--r--pokemod/AbilityEffect.h3
-rw-r--r--pokemod/Author.cpp474
-rw-r--r--pokemod/Author.h9
-rw-r--r--pokemod/Badge.cpp55
-rw-r--r--pokemod/Badge.h7
-rw-r--r--pokemod/CoinItem.cpp42
-rw-r--r--pokemod/CoinItem.h3
-rw-r--r--pokemod/CoinList.cpp64
-rw-r--r--pokemod/CoinList.h3
-rw-r--r--pokemod/Debug.cpp98
-rw-r--r--pokemod/Debug.h292
-rw-r--r--pokemod/Dialog.cpp563
-rw-r--r--pokemod/Dialog.h3
-rw-r--r--pokemod/EggGroup.cpp14
-rw-r--r--pokemod/EggGroup.h3
-rw-r--r--pokemod/Frac.cpp36
-rw-r--r--pokemod/Item.cpp57
-rw-r--r--pokemod/Item.h3
-rw-r--r--pokemod/ItemEffect.cpp4
-rw-r--r--pokemod/ItemEffect.h3
-rw-r--r--pokemod/ItemStorage.cpp20
-rw-r--r--pokemod/ItemStorage.h2
-rw-r--r--pokemod/Map.cpp203
-rw-r--r--pokemod/Map.h3
-rw-r--r--pokemod/MapEffect.cpp82
-rw-r--r--pokemod/MapEffect.h3
-rw-r--r--pokemod/MapTrainer.cpp175
-rw-r--r--pokemod/MapTrainer.h18
-rw-r--r--pokemod/MapTrainerTeam.cpp183
-rw-r--r--pokemod/MapTrainerTeam.h20
-rw-r--r--pokemod/MapWarp.cpp72
-rw-r--r--pokemod/MapWarp.h12
-rw-r--r--pokemod/MapWildList.cpp4
-rw-r--r--pokemod/MapWildList.h3
-rw-r--r--pokemod/MapWildPokemon.cpp26
-rw-r--r--pokemod/MapWildPokemon.h3
-rw-r--r--pokemod/Matrix.h11
-rw-r--r--pokemod/Move.cpp242
-rw-r--r--pokemod/Move.h24
-rw-r--r--pokemod/MoveEffect.cpp4
-rw-r--r--pokemod/MoveEffect.h3
-rw-r--r--pokemod/Nature.cpp216
-rw-r--r--pokemod/Nature.h24
-rw-r--r--pokemod/NatureEffect.cpp15
-rw-r--r--pokemod/NatureEffect.h3
-rw-r--r--pokemod/Object.cpp10
-rw-r--r--pokemod/Object.h16
-rw-r--r--pokemod/Path.cpp11
-rw-r--r--pokemod/Path.h3
-rw-r--r--pokemod/Point.cpp6
-rw-r--r--pokemod/Pokemod.cpp877
-rw-r--r--pokemod/Pokemod.h17
-rw-r--r--pokemod/Pokemon.cpp288
-rw-r--r--pokemod/Pokemon.h3
-rw-r--r--pokemod/PokemonAbility.cpp20
-rw-r--r--pokemod/PokemonAbility.h2
-rw-r--r--pokemod/PokemonEvolution.cpp32
-rw-r--r--pokemod/PokemonEvolution.h3
-rw-r--r--pokemod/PokemonItem.cpp20
-rw-r--r--pokemod/PokemonItem.h3
-rw-r--r--pokemod/PokemonMove.cpp26
-rw-r--r--pokemod/PokemonMove.h3
-rw-r--r--pokemod/PokemonNature.cpp20
-rw-r--r--pokemod/PokemonNature.h3
-rw-r--r--pokemod/Ref.h11
-rw-r--r--pokemod/Status.cpp94
-rw-r--r--pokemod/Status.h3
-rw-r--r--pokemod/StatusEffect.cpp8
-rw-r--r--pokemod/StatusEffect.h3
-rw-r--r--pokemod/Store.cpp54
-rw-r--r--pokemod/Store.h3
-rw-r--r--pokemod/String.cpp2
-rw-r--r--pokemod/String.h2
-rw-r--r--pokemod/TODO13
-rw-r--r--pokemod/Tile.cpp106
-rw-r--r--pokemod/Tile.h8
-rw-r--r--pokemod/Time.cpp26
-rw-r--r--pokemod/Time.h3
-rw-r--r--pokemod/Type.cpp73
-rw-r--r--pokemod/Type.h17
-rw-r--r--pokemod/pokemod_inc.h19
84 files changed, 1348 insertions, 3809 deletions
diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp
index 8f4957a4..4ac6be09 100644
--- a/pokemod/Ability.cpp
+++ b/pokemod/Ability.cpp
@@ -91,57 +91,6 @@ void PokeGen::PokeMod::Ability::Validate()
LogValidateOver("Ability", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Ability::Validate(const wxListBox &output)
-{
- LogValidateStart("Ability", id, name);
- if (name == "")
- {
- LogVarNotSet("Ability", id, "name");
- output.Append(ConsoleLogVarNotSet("Ability", id, "name"));
- isValid = false;
- }
- if (GetAbilityEffectCount())
- {
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> effectChecker;
- for (std::vector<AbilityEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
- {
- LogSubmoduleIterate("Ability", id, "effect", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++effectChecker[i->GetEffectString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Ability", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateId("Ability", id, "effect", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = effectChecker.begin(); i != effectChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Ability", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Ability", id, "effect", i->first, name));
- isValid = false;
- }
- }
- }
- else
- {
- LogSubmoduleEmpty("Ability", id, "effect", id, name);
- output.Append(ConsoleLogSubmoduleEmpty("Ability", id, "effect", name));
- isValid = false;
- }
- LogValidateOver("Ability", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::Ability::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Ability");
diff --git a/pokemod/Ability.h b/pokemod/Ability.h
index d5e80b73..8bcca838 100644
--- a/pokemod/Ability.h
+++ b/pokemod/Ability.h
@@ -54,9 +54,6 @@ namespace PokeGen
void DeleteAbilityEffect(const unsigned _id);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp
index b483ce94..f91c21de 100644
--- a/pokemod/AbilityEffect.cpp
+++ b/pokemod/AbilityEffect.cpp
@@ -218,194 +218,6 @@ void PokeGen::PokeMod::AbilityEffect::Validate()
LogValidateOver("AbilityEffect", id, isValid);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::AbilityEffect::Validate(const wxListBox &output)
-{
- LogValidateStart("AbilityEffect", id);
- chance.Reduce();
- if (AE_END <= effect)
- {
- LogVarNotValid("AbilityEffect", id, "effect");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "effect"));
- isValid = false;
- }
- else
- {
- switch (effect)
- {
- case AE_STATS:
- if ((BST_END <= val1) || ((val1 == BST_SPECIAL_DEFENSE) && !pokemod->IsSpecialSplit()))
- {
- LogVarNotValid("AbilityEffect", id, "val1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val1"));
- isValid = false;
- }
- break;
- case AE_STATUS:
- if (!pokemod->GetStatus(val1))
- {
- LogVarNotValid("AbilityEffect", id, "val1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val1"));
- isValid = false;
- }
- break;
- case AE_ABILITY:
- if (!pokemod->GetAbility(val1))
- {
- LogVarNotValid("AbilityEffect", id, "val1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val1"));
- isValid = false;
- }
- break;
- case AE_ACC_POWER:
- if (PA_END <= val1)
- {
- LogVarNotValid("AbilityEffect", id, "val1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val1"));
- isValid = false;
- }
- break;
- case AE_ITEM_EFFECT:
- if (ABIT_END <= val1)
- {
- LogVarNotValid("AbilityEffect", id, "val1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val1"));
- isValid = false;
- }
- break;
- case AE_TYPE:
- if (!pokemod->GetType(val1))
- {
- LogVarNotValid("AbilityEffect", id, "val1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val1"));
- isValid = false;
- }
- break;
- case AE_WEATHER:
- if (W_END_ALL <= val1)
- {
- LogVarNotValid("AbilityEffect", id, "val1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val1"));
- isValid = false;
- }
- }
- switch (effect)
- {
- case AE_STATS:
- if (BM_END <= val2)
- {
- LogVarNotValid("AbilityEffect", id, "val2");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val2"));
- isValid = false;
- }
- break;
- case AE_STATUS:
- case AE_WEATHER:
- if (CA_END <= val2)
- {
- LogVarNotValid("AbilityEffect", id, "val2");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val2"));
- isValid = false;
- }
- break;
- case AE_ABILITY:
- if (ABI_END <= val2)
- {
- LogVarNotValid("AbilityEffect", id, "val2");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val2"));
- isValid = false;
- }
- break;
- case AE_TYPE:
- if (BO_END <= val2)
- {
- LogVarNotValid("AbilityEffect", id, "val2");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val2"));
- isValid = false;
- }
- }
- switch (effect)
- {
- case AE_DMG_TO_HP:
- case AE_PRV_DMG:
- case AE_AUTO_HEAL:
- case AE_DEAL_DMG:
- case AE_WILDS:
- case AE_ACC_POWER:
- case AE_TYPE:
- case AE_FAST_HATCH:
- if ((val3 < 0) || (100 < val3))
- {
- LogVarNotValid("AbilityEffect", id, "val3");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val3"));
- isValid = false;
- }
- break;
- case AE_STATS:
- if ((val3 < -6) || (6 < val3))
- {
- LogVarNotValid("AbilityEffect", id, "val3");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "val3"));
- isValid = false;
- }
- }
- }
- if (AT_END <= trigger)
- {
- LogVarNotValid("AbilityEffect", id, "trigger");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "trigger"));
- isValid = false;
- }
- else
- {
- switch (trigger)
- {
- case AT_WEATHER:
- if (W_END_ALL <= tval1)
- {
- LogVarNotValid("AbilityEffect", id, "tVal1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "tVal1"));
- isValid = false;
- }
- break;
- case AT_TYPE:
- if (!pokemod->GetType(tval1))
- {
- LogVarNotValid("AbilityEffect", id, "tVal1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "tVal1"));
- isValid = false;
- }
- break;
- case AT_HP_BOUND:
- if (SI_END <= tval1)
- {
- LogVarNotValid("AbilityEffect", id, "tVal1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "tVal1"));
- isValid = false;
- }
- break;
- case AT_STAT_CHANGE:
- if ((BST_END <= tval1) || ((tval1 == BST_SPECIAL_DEFENSE) && !pokemod->IsSpecialSplit()))
- {
- LogVarNotValid("AbilityEffect", id, "tVal1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "tVal1"));
- isValid = false;
- }
- break;
- case AT_STATUS:
- if (!pokemod->GetStatus(tval1))
- {
- LogVarNotValid("AbilityEffect", id, "tVal1");
- output.Append(OutputLogVarNotValid("AbilityEffect", id, "tVal1"));
- isValid = false;
- }
- }
- tval2.Reduce();
- }
- LogValidateOver("AbilityEffect", id, isValid);
-}
-#endif
-
void PokeGen::PokeMod::AbilityEffect::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("AbilityEffect");
diff --git a/pokemod/AbilityEffect.h b/pokemod/AbilityEffect.h
index 8ebfa520..e4f13d26 100644
--- a/pokemod/AbilityEffect.h
+++ b/pokemod/AbilityEffect.h
@@ -85,9 +85,6 @@ namespace PokeGen
unsigned GetTval2Denom() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
Frac chance;
unsigned effect;
diff --git a/pokemod/Author.cpp b/pokemod/Author.cpp
index 20d34db3..b2c2d912 100644
--- a/pokemod/Author.cpp
+++ b/pokemod/Author.cpp
@@ -1,253 +1,221 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokemod/Author.cpp
-// Purpose: Define an author of a PokéMod
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Wed Feb 28 20:42:17 2007
-// Copyright: ©2007 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 "Author.h"
-
-PokeGen::PokeMod::Author::Author(const unsigned _id) :
- name(""),
- email(""),
- role("")
-{
- LogCtor("Author", id);
- id = _id;
-}
-
-PokeGen::PokeMod::Author::Author(Ini &ini, const unsigned _id)
-{
- LogCtorIni("Author", id);
- ImportIni(ini, _id);
- if (id == UINT_MAX)
- LogIdError("Author");
-}
-
-PokeGen::PokeMod::Author::~Author()
-{
- LogDtor("Author", id, name);
-}
-
-void PokeGen::PokeMod::Author::Validate()
-{
- LogValidateStart("Author", id, name);
- if (name == "")
- {
- LogVarNotSet("Author", id, "name");
- isValid = false;
- }
- if (email == "")
- {
- LogVarNotSet("Author", id, "email", name);
- }
- else if (!IsValidEmail())
- {
- LogVarNotValid("Author", id, "email", name);
- isValid = false;
- }
- if (role == "")
- {
- LogVarNotSet("Author", id, "role", name);
- isValid = false;
- }
- LogValidateOver("Author", id, isValid, name);
-}
-
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Author::Validate(const wxListBox &output)
-{
- LogValidateStart("Author", id, name);
- if (name == "")
- {
- LogVarNotSet("Author", "name", id);
- output.Append(ConsoleLogVarNotSet("Author", "name", id)));
- isValid = false;
- }
- if (email == "")
- {
- LogVarNotSet("Author", "email", id, name);
- output.Append(ConsoleLogVarNotSetW("Author", "email", id)));
- }
- else if (!IsValidEmail())
- {
- LogVarNotValid("Author", "email", id, name);
- output.Append(ConsoleLogVarNotValid("Author", "email", id, name));
- isValid = false;
- }
- if (role == "")
- {
- LogValNotSet("Author", "role", id, name);
- output.Append(ConsoleLogValNotSet("Author", "role", id, name)));
- isValid = false;
- }
- LogValidateOver("Author", isValid, id, name);
- }
-#endif
-
- void PokeGen::PokeMod::Author::ImportIni(Ini &ini, const unsigned _id)
- {
- LogImportStart("Author");
- String curName;
- if (_id == UINT_MAX)
- {
- ini.GetValue("id", id);
- if (id == UINT_MAX)
- LogIdNotFound("Author");
- }
- else
- id = _id;
- ini.GetValue("name", name);
- ini.GetValue("email", email);
- ini.GetValue("role", role);
- LogImportOver("Author", id, name);
- }
-
- void PokeGen::PokeMod::Author::ExportIni(std::ofstream &fout) const
- {
- LogExportStart("Author", id, name);
- Ini exAuthor("author");
- exAuthor.AddField("id", id);
- exAuthor.AddField("name", name);
- exAuthor.AddField("email", email);
- exAuthor.AddField("role", role);
- exAuthor.Export(fout);
- LogExportOver("Author", id, name);
- }
-
- void PokeGen::PokeMod::Author::SetName(const String &n)
- {
- LogSetVar("Author", id, "name", n, name);
- name = n;
- }
-
- void PokeGen::PokeMod::Author::SetEmail(const String &e)
- {
- LogSetVar("Author", id, "email", e, name);
- email = e;
- }
-
- void PokeGen::PokeMod::Author::SetRole(const String &r)
- {
- LogSetVar("Author", id, "role", r, name);
- role = r;
- }
-
- PokeGen::PokeMod::String PokeGen::PokeMod::Author::GetName() const
- {
- LogFetchVar("Author", id, "name", name);
- return name;
- }
-
- PokeGen::PokeMod::String PokeGen::PokeMod::Author::GetEmail() const
- {
- LogFetchVar("Author", id, "email", email, name);
- return email;
- }
-
- PokeGen::PokeMod::String PokeGen::PokeMod::Author::GetRole() const
- {
- LogFetchVar("Author", id, "role", role, name);
- return role;
- }
-
- bool PokeGen::PokeMod::Author::IsValidEmail() const
- {
- bool valid = true;
- Log(String("Author: Validating email of %d (%s)", id, name.c_str()), PM_DEBUG_DEBUG);
- EmailCheck stage = EM_NAME;
- int count = 0;
- for (unsigned i = 0; (i < email.length()) && valid; ++i)
- {
- switch (stage)
- {
- case EM_NAME:
- switch (email[i])
- {
- // Only allow alphanumerics and '%-_.' in the name
- case 'a' ... 'z':
- case 'A' ... 'Z':
- case '0' ... '9':
- case '%':
- case '-':
- case '_':
- case '.':
- ++count;
- break;
- // Move to the next part if '@' is encountered
- case '@':
- if (!count)
- valid = false;
- count = 0;
- stage = EM_HOST;
- break;
- // Not valid if anything else is encountered
- default:
- valid = false;
- }
- break;
- case EM_HOST:
- switch (email[i])
- {
- // Only allow alphanumerics and '%-_.' in the host
- case 'a' ... 'z':
- case 'A' ... 'Z':
- case '0' ... '9':
- case '-':
- ++count;
- break;
- // Move to the next part if '.' is encountered
- case '.':
- if (!count)
- valid = false;
- count = 0;
- stage = EM_DOMAIN;
- break;
- // Not valid if anything else is encountered
- default:
- valid = false;
- }
- break;
- case EM_DOMAIN:
- switch (email[i])
- {
- // Only allow alphanumerics and '%-_.' in the host
- case 'a' ... 'z':
- case 'A' ... 'Z':
- ++count;
- break;
- // Move to the next domain extension if '.' is encountered
- case '.':
- if (!count)
- valid = false;
- count = 0;
- break;
- // Not valid if anything else is encountered
- default:
- valid = false;
- }
- }
- }
- // Make sure the domain was entered and the extension is in the valid range
- if ((stage != EM_DOMAIN) || (count < 2) || (4 < count))
- valid = false;
- Log(String("Author: Validated email of %d (%s) as %s", id, name.c_str(), valid ? "valid" : "invalid"), PM_DEBUG_DEBUG);
- return valid;
- }
-
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/Author.cpp
+// Purpose: Define an author of a PokéMod
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Wed Feb 28 20:42:17 2007
+// Copyright: ©2007 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 "Author.h"
+
+PokeGen::PokeMod::Author::Author(const unsigned _id) :
+ name(""),
+ email(""),
+ role("")
+{
+ LogCtor("Author", id);
+ id = _id;
+}
+
+PokeGen::PokeMod::Author::Author(Ini &ini, const unsigned _id)
+{
+ LogCtorIni("Author", id);
+ ImportIni(ini, _id);
+ if (id == UINT_MAX)
+ LogIdError("Author");
+}
+
+PokeGen::PokeMod::Author::~Author()
+{
+ LogDtor("Author", id, name);
+}
+
+void PokeGen::PokeMod::Author::Validate()
+{
+ LogValidateStart("Author", id, name);
+ if (name == "")
+ {
+ LogVarNotSet("Author", id, "name");
+ isValid = false;
+ }
+ if (email == "")
+ {
+ LogVarNotSet("Author", id, "email", name);
+ }
+ else if (!IsValidEmail())
+ {
+ LogVarNotValid("Author", id, "email", name);
+ isValid = false;
+ }
+ if (role == "")
+ {
+ LogVarNotSet("Author", id, "role", name);
+ isValid = false;
+ }
+ LogValidateOver("Author", id, isValid, name);
+}
+
+void PokeGen::PokeMod::Author::ImportIni(Ini &ini, const unsigned _id)
+{
+ LogImportStart("Author");
+ String curName;
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id);
+ if (id == UINT_MAX)
+ LogIdNotFound("Author");
+ }
+ else
+ id = _id;
+ ini.GetValue("name", name);
+ ini.GetValue("email", email);
+ ini.GetValue("role", role);
+ LogImportOver("Author", id, name);
+}
+
+void PokeGen::PokeMod::Author::ExportIni(std::ofstream &fout) const
+{
+ LogExportStart("Author", id, name);
+ Ini exAuthor("author");
+ exAuthor.AddField("id", id);
+ exAuthor.AddField("name", name);
+ exAuthor.AddField("email", email);
+ exAuthor.AddField("role", role);
+ exAuthor.Export(fout);
+ LogExportOver("Author", id, name);
+}
+
+void PokeGen::PokeMod::Author::SetName(const String &n)
+{
+ LogSetVar("Author", id, "name", n, name);
+ name = n;
+}
+
+void PokeGen::PokeMod::Author::SetEmail(const String &e)
+{
+ LogSetVar("Author", id, "email", e, name);
+ email = e;
+}
+
+void PokeGen::PokeMod::Author::SetRole(const String &r)
+{
+ LogSetVar("Author", id, "role", r, name);
+ role = r;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::Author::GetName() const
+{
+ LogFetchVar("Author", id, "name", name);
+ return name;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::Author::GetEmail() const
+{
+ LogFetchVar("Author", id, "email", email, name);
+ return email;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::Author::GetRole() const
+{
+ LogFetchVar("Author", id, "role", role, name);
+ return role;
+}
+
+bool PokeGen::PokeMod::Author::IsValidEmail() const
+{
+ bool valid = true;
+ Log::Write(String("Author: Validating email of %d (%s)", id, name.c_str()), PM_DEBUG_DEBUG | PM_DEBUG_VALIDATION);
+ EmailCheck stage = EM_NAME;
+ int count = 0;
+ for (unsigned i = 0; (i < email.length()) && valid; ++i)
+ {
+ switch (stage)
+ {
+ case EM_NAME:
+ switch (email[i])
+ {
+ // Only allow alphanumerics and '%-_.' in the name
+ case 'a' ... 'z':
+ case 'A' ... 'Z':
+ case '0' ... '9':
+ case '%':
+ case '-':
+ case '_':
+ case '.':
+ ++count;
+ break;
+ // Move to the next part if '@' is encountered
+ case '@':
+ if (!count)
+ valid = false;
+ count = 0;
+ stage = EM_HOST;
+ break;
+ // Not valid if anything else is encountered
+ default:
+ valid = false;
+ }
+ break;
+ case EM_HOST:
+ switch (email[i])
+ {
+ // Only allow alphanumerics and '%-_.' in the host
+ case 'a' ... 'z':
+ case 'A' ... 'Z':
+ case '0' ... '9':
+ case '-':
+ ++count;
+ break;
+ // Move to the next part if '.' is encountered
+ case '.':
+ if (!count)
+ valid = false;
+ count = 0;
+ stage = EM_DOMAIN;
+ break;
+ // Not valid if anything else is encountered
+ default:
+ valid = false;
+ }
+ break;
+ case EM_DOMAIN:
+ switch (email[i])
+ {
+ // Only allow alphanumerics and '%-_.' in the host
+ case 'a' ... 'z':
+ case 'A' ... 'Z':
+ ++count;
+ break;
+ // Move to the next domain extension if '.' is encountered
+ case '.':
+ if (!count)
+ valid = false;
+ count = 0;
+ break;
+ // Not valid if anything else is encountered
+ default:
+ valid = false;
+ }
+ }
+ }
+ // Make sure the domain was entered and the extension is in the valid range
+ if ((stage != EM_DOMAIN) || (count < 2) || (4 < count))
+ valid = false;
+ Log::Write(String("Author: Validated email of %d (%s) as %s", id, name.c_str(), valid ? "valid" : "invalid"), PM_DEBUG_DEBUG | PM_DEBUG_VALIDATION);
+ return valid;
+}
diff --git a/pokemod/Author.h b/pokemod/Author.h
index dacdb900..cd5cb2e6 100644
--- a/pokemod/Author.h
+++ b/pokemod/Author.h
@@ -26,7 +26,7 @@
#include "Object.h"
#include "String.h"
-
+
namespace PokeGen
{
namespace PokeMod
@@ -50,17 +50,14 @@ namespace PokeGen
String GetRole() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
enum EmailCheck
{
EM_NAME = 0,
EM_HOST = 1,
EM_DOMAIN = 2
- };
-
+ };
+
bool IsValidEmail() const;
String name;
diff --git a/pokemod/Badge.cpp b/pokemod/Badge.cpp
index 870ab46a..ec8e01d7 100644
--- a/pokemod/Badge.cpp
+++ b/pokemod/Badge.cpp
@@ -74,32 +74,6 @@ void PokeGen::PokeMod::Badge::Validate()
LogValidateOver("Badge", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Badge::Validate(const wxListBox &output)
-{
- LogValidateStart("Badge", id, name);
- if (name == "")
- {
- LogVarNotSet("Badge", id, "name");
- output.Append(ConsoleLogVarNotSet("Badge", id, "name"));
- isValid = false;
- }
- if (!Path(pokemod->GetPath() + "badge/face/" + name + ".png").DoesExist())
- {
- LogVarNotValid("Badge", id, "face sprite", name);
- output.Append(ConsoleLogVarNotValid("Badge", "face sprite", id, name));
- isValid = false;
- }
- if (!Path(pokemod->GetPath() + "badge/badge/" + name + ".png").DoesExist())
- {
- LogVarNotValid("Badge", id, "badge sprite", name);
- output.Append(ConsoleLogVarNotValid("Badge", "badge sprite", id, name));
- isValid = false;
- }
- LogValidateOver("Badge", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::Badge::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Badge");
@@ -171,19 +145,22 @@ void PokeGen::PokeMod::Badge::SetObey(const unsigned o)
void PokeGen::PokeMod::Badge::SetStat(const unsigned s, const unsigned n, const unsigned d)
{
LogSetVar("Badge", id, String("stats[%u]", s), n, d, name);
- stats[s].Set(n, d);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s].Set(n, d);
}
void PokeGen::PokeMod::Badge::SetStatNum(const unsigned s, const unsigned n)
{
LogSetVar("Badge", id, String("stat[%u] numerator", s), n, name);
- stats[s].SetNum(n);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s].SetNum(n);
}
void PokeGen::PokeMod::Badge::SetStatDenom(const unsigned s, const unsigned d)
{
LogSetVar("Badge", id, String("stat[%u] denominator", s), d, name);
- stats[s].SetDenom(d);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s].SetDenom(d);
}
void PokeGen::PokeMod::Badge::SetHm(const unsigned h, const bool hb)
@@ -219,12 +196,28 @@ unsigned PokeGen::PokeMod::Badge::GetObey() const
PokeGen::PokeMod::Frac PokeGen::PokeMod::Badge::GetStat(const unsigned s) const
{
- LogFetchVar("Badge", id, String("stats[%u]", s), stats[s].GetNum(), stats[s].GetDenom(), name);
- if (s < (pokemod->IsSpecialSplit() ? STH_END_RBY : STH_END_GSC))
+ LogFetchVar("Badge", id, String("stats[%u]", s), 0, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
return stats[s];
return Frac(1, 1);
}
+unsigned PokeGen::PokeMod::Badge::GetStatNum(const unsigned s) const
+{
+ LogFetchVar("Badge", id, String("stats[%u] numerator", s), 0, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ return stats[s].GetNum();
+ return 0;
+}
+
+unsigned PokeGen::PokeMod::Badge::GetStatDenom(const unsigned s) const
+{
+ LogFetchVar("Badge", id, String("stats[%u] denominator", s), 0, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ return stats[s].GetDenom();
+ return 0;
+}
+
bool PokeGen::PokeMod::Badge::GetHm(const unsigned h) const
{
LogFetchVar("Badge", id, String("hm[%u]", h), hm[h], name);
diff --git a/pokemod/Badge.h b/pokemod/Badge.h
index f2e1bd5f..f696a134 100644
--- a/pokemod/Badge.h
+++ b/pokemod/Badge.h
@@ -59,13 +59,12 @@ namespace PokeGen
bool GetFace() const;
bool GetBadge() const;
unsigned GetObey() const;
- Frac GetStat(const unsigned s) const;
+ Frac GetStat(const unsigned s) const;
+ unsigned GetStatNum(const unsigned s) const;
+ unsigned GetStatDenom(const unsigned s) const;
bool GetHm(const unsigned h) const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
unsigned obey;
diff --git a/pokemod/CoinItem.cpp b/pokemod/CoinItem.cpp
index 19e85f28..ecb67c57 100644
--- a/pokemod/CoinItem.cpp
+++ b/pokemod/CoinItem.cpp
@@ -72,51 +72,13 @@ void PokeGen::PokeMod::CoinItem::Validate()
LogVarNotValid("CoinItem", id, "type");
isValid = false;
}
- if (!amount)
+ if (!amount || ((1 < amount) && (type == CIT_POKEMON)))
{
LogVarNotValid("CoinItem", id, "amount", GetObjectString());
isValid = false;
- }
- LogValidateOver("CoinItem", id, isValid, GetObjectString());
-}
-
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::CoinItem::Validate(const wxListBox &output)
-{
- LogValidateStart("CoinItem", id);
- if (type == CIT_ITEM)
- {
- if (!pokemod->GetItem(object))
- {
- LogVarNotValid("CoinItem", id, "item", object);
- output.Append(ConsoleLogVarNotValid("CoinItem", id, "item", object));
- isValid = false;
- }
- }
- else if (type == CIT_POKEMON)
- {
- if (!pokemod->GetPokemon(object))
- {
- LogVarNotValid("CoinItem", id, "Pokémon", object);
- output.Append(ConsoleLogVarNotValid("CoinItem", id, "Pokémon", object));
- isValid = false;
- }
- }
- else
- {
- LogVarNotValid("CoinItem", id, "type", type);
- output.Append(ConsoleLogVarNotValid("CoinItem", id, "type", type));
- isValid = false;
- }
- if (!amount)
- {
- LogVarNotValid("CoinItem", id, "amount", amount, GetObjectString());
- output.Append(ConsoleLogVarNotValid("CoinItem", id, "amount", amount, GetObjectString()));
- isValid = false;
- }
+ }
LogValidateOver("CoinItem", id, isValid, GetObjectString());
}
-#endif
void PokeGen::PokeMod::CoinItem::ImportIni(Ini &ini, const unsigned _id)
{
diff --git a/pokemod/CoinItem.h b/pokemod/CoinItem.h
index bd6b3706..a4a98d83 100644
--- a/pokemod/CoinItem.h
+++ b/pokemod/CoinItem.h
@@ -55,9 +55,6 @@ namespace PokeGen
unsigned GetCost() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
unsigned type;
unsigned object;
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp
index 1471b528..73f611cb 100644
--- a/pokemod/CoinList.cpp
+++ b/pokemod/CoinList.cpp
@@ -104,70 +104,6 @@ void PokeGen::PokeMod::CoinList::Validate()
LogValidateOver("CoinList", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::CoinList::Validate(const wxListBox &output)
-{
- LogValidateStart("CoinList", id, name);
- if (name == "")
- {
- LogVarEmpty("CoinList", id, "name", name);
- output.Append(ConsoleLogVarEmpty("CoinList", id, "name", name));
- isValid = false;
- }
- if (GetCoinItemCount())
- {
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> itemChecker;
- std::map<String, unsigned> pokemonChecker;
- for (std::vector<CoinItem>::iterator i = items.begin(); i != items.end(); ++i)
- {
- LogSubmoduleIterate("CoinList", id, "item", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- if (i->GetType() == CIT_ITEM)
- ++itemChecker[i->GetObjectString()];
- else if (i->GetType() == CIT_POKEMON)
- ++pokemonChecker[i->GetObjectString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("CoinList", id, "coin item", i->first, name);
- output.Append(ConsoleLogDuplicateId("CoinList", id, "coin item", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = itemChecker.begin(); i != itemChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("CoinList", id, "item", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("CoinList", id, "item", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = pokemonChecker.begin(); i != pokemonChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("CoinList", id, "Pokémon", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("CoinList", id, "Pokémon", i->first, name));
- isValid = false;
- }
- }
- }
- else
- {
- LogSubmoduleEmpty("CoinList", id, "items", name);
- output.Append(ConsoleLogSubmoduleEmpty("CoinList", id, "items", name));
- isValid = false;
- }
- LogValidateOver("CoinList", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::CoinList::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("CoinList");
diff --git a/pokemod/CoinList.h b/pokemod/CoinList.h
index 5d7db128..be429f94 100644
--- a/pokemod/CoinList.h
+++ b/pokemod/CoinList.h
@@ -60,9 +60,6 @@ namespace PokeGen
void DeleteCoinItem(const String &n);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
unsigned value;
diff --git a/pokemod/Debug.cpp b/pokemod/Debug.cpp
index 389c3138..8790f13c 100644
--- a/pokemod/Debug.cpp
+++ b/pokemod/Debug.cpp
@@ -23,67 +23,61 @@
#include "Debug.h"
-#ifdef PM_DEBUG
-
-#ifdef PG_DEBUG_WINDOW
-extern debugWindow PokeModDebugWindow;
-#endif
-
-int PokeModDebugLevel;
-
-void PokeGen::PokeMod::Log(const char *msg, const int level)
+PokeGen::PokeMod::Log::~Log()
+{
+ flog.close();
+}
+
+
+void PokeGen::PokeMod::Log::Write(const char *msg, const unsigned l)
{
+#ifdef PM_DEBUG
// Actual strings of the debugging levels
const char *PokeModDebugStr[8] = {"Emergency", "Alert", "Critical Error", "Error", "Warning", "Notice", "Info", "Debug"};
// Only log if wanted
- if (level <= PokeModDebugLevel)
+ if (l & level)
{
// Get the current time
char path[21];
- char time[9];
+ char time[9];
+ short word = 0;
+ unsigned short temp = l;
+ while (temp >>= 1)
+ ++word;
time_t rawTime = std::time(NULL);
tm *curTime = std::localtime(&rawTime);
- strftime(path, 21, "%y/%m-%b/%d-%a", curTime);
+ strftime(path, 21, "%y/%m-%b/%d-%a", curTime);
+ if (lastDay != path)
+ {
+ if (flog.is_open())
+ flog.close();
+ flog.open(String(PM_DEF_DIR ".pokegen" PM_DEF_SEP "log" PM_DEF_SEP "pokemod" PM_DEF_SEP "%s.log", path), std::ios::app);
+ }
strftime(time, 9, "%X", curTime);
// Get the actual output message
- String output("%s (%s): %s", PokeModDebugStr[level], time, msg);
- // Output to the command window
-# ifdef PM_DEBUG_OUTPUT_CONSOLE
- std::cout << output << std::endl;
-# endif
- // Output to the debugging console
-# ifdef PM_DEBUG_OUTPUT_DEBUG
- if (PokeModDebugWindow.m_Show[level].IsChecked())
- PokeModDebugWindow.m_Debug.Append(output);
-# endif
- // Output to the debugging log
-# ifdef PM_DEBUG_OUTPUT_FILE
- std::ofstream flog(String("/log/pokemod/%s.log", path), std::ios::app);
- // Output erros if the file fails
- if (!flog)
- {
-# ifdef PM_DEBUG_OUTPUT_CONSOLE
- std::cout << "Alert (" << curTime << "): Unable to open log file!\n";
-# endif
-# ifdef PM_DEBUG_OUTPUT_DEBUG
- PokeModDebugWindow.m_Debug.Append(String("Alert (%s): Unable to open log file!", curTime));
-# endif
- }
- else
- {
- flog << output << '\n';
- flog.close();
- }
-# endif
- }
-}
-
-#else
-
-// Empty function if debugging isn't wanted
-void PokeGen::PokeMod::Log(const String &msg, const int level)
-{
- return;
-}
-
+ String output("%s (%s): %s", PokeModDebugStr[word], time, msg);
+ String validate("%s: %s", PokeModDebugStr[word], time, msg);
+ // Output to the command window
+ if (consoleOutput)
+ std::cout << output << std::endl;
+ // Output to other streams (if wanted)
+ if (useOtherOutput && otherOutput->good())
+ *otherOutput << output << std::endl;
+ if ((l & PM_DEBUG_VALIDATION) && useOtherOutputV && otherOutputV->good())
+ *otherOutputV << validate << std::endl;
+ if (fileOutput)
+ {
+ // Output errors if the file fails
+ if (!flog)
+ {
+ if (consoleOutput)
+ std::cout << "Alert (" << curTime << "): Unable to open log file!" << std::endl;
+ if (useOtherOutput && otherOutput->good())
+ *otherOutput << "Alert (" << curTime << "): Unable to open log file!" << std::endl;
+ }
+ else
+ flog << output << '\n';
+ }
+ }
#endif
+}
diff --git a/pokemod/Debug.h b/pokemod/Debug.h
index b212426a..2fab73c2 100644
--- a/pokemod/Debug.h
+++ b/pokemod/Debug.h
@@ -23,388 +23,432 @@
#ifndef __POKEMOD_DEBUG__
#define __POKEMOD_DEBUG__
-
-#define PM_DEBUG
-
-#ifdef PM_DEBUG
-
-# define PM_DEBUG_OUTPUT_FILE
-# define PM_DEBUG_OUTPUT_CONSOLE
-
-# include <ctime>
-
-# ifdef PM_DEBUG_OUTPUT_FILE
-# include <fstream>
-# endif
-
-# ifdef PM_DEBUG_OUTPUT_CONSOLE
-# include <cstdio>
-# endif
-
-# if !defined(PM_DEBUG_OUTPUT_FILE) && !defined(PM_DEBUG_OUTPUT_CONSOLE) && !defined(PG_DEBUG_WINDOW)
-# error "Debugging turned on, but no output specified!"
-# endif
-
-#include "String.h"
+
+#include <fstream>
+#include "String.h"
namespace PokeGen
{
namespace PokeMod
- {
+ {
enum PokeModDebug
{
- PM_DEBUG_EMERGENCY = 0,
- PM_DEBUG_ALERT = 1,
- PM_DEBUG_CRITICAL_ERROR = 2,
- PM_DEBUG_ERROR = 3,
- PM_DEBUG_WARNING = 4,
- PM_DEBUG_NOTICE = 5,
- PM_DEBUG_INFO = 6,
- PM_DEBUG_DEBUG = 7
+ PM_DEBUG_EMERGENCY = 0x0001,
+ PM_DEBUG_ALERT = 0x0002,
+ PM_DEBUG_CRITICAL_ERROR = 0x0004,
+ PM_DEBUG_ERROR = 0x0008,
+ PM_DEBUG_WARNING = 0x0010,
+ PM_DEBUG_NOTICE = 0x0020,
+ PM_DEBUG_INFO = 0x0040,
+ PM_DEBUG_DEBUG = 0x0080,
+
+ PM_DEBUG_VALIDATION = 0x8000
};
-
- void Log(const char *msg, const int level);
+
+ class Log
+ {
+ public:
+ ~Log();
+
+ static void Write(const char *msg, const unsigned l);
+
+ inline static void SetLevel(const unsigned short l)
+ {
+ if (l <= PM_DEBUG_DEBUG)
+ level = l;
+ }
+ inline unsigned short GetLevel() const
+ {
+ return level;
+ }
+
+ inline static void SetFileOutput(const bool f)
+ {
+ fileOutput = f;
+ }
+ inline bool GetFileOutput() const
+ {
+ return fileOutput;
+ }
+
+ inline static void SetConsoleOutput(const bool c)
+ {
+ consoleOutput = c;
+ }
+ inline bool GetConsoleOutput() const
+ {
+ return consoleOutput;
+ }
+
+ inline static void SetOtherOutput(std::ostream &o)
+ {
+ otherOutput = &o;
+ }
+ inline static void SetUseOtherOutput(const bool u)
+ {
+ useOtherOutput = u;
+ if (!u)
+ otherOutput = NULL;
+ }
+ inline bool GetOtherOutputOutput() const
+ {
+ return useOtherOutput;
+ }
+
+ inline static void SetOtherOutputV(std::ostream &o)
+ {
+ otherOutputV = &o;
+ }
+ inline static void SetUseOtherOutputV(const bool u)
+ {
+ useOtherOutputV = u;
+ if (!u)
+ otherOutputV = NULL;
+ }
+ inline bool GetOtherOutputOutputV() const
+ {
+ return useOtherOutputV;
+ }
+ private:
+ Log()
+ {
+ }
+ Log(const Log &cp)
+ {
+ }
+
+ static unsigned short level;
+ static bool fileOutput;
+ static bool consoleOutput;
+ static std::ostream *otherOutput;
+ static bool useOtherOutput;
+ static std::ostream *otherOutputV;
+ static bool useOtherOutputV;
+
+ static std::ofstream flog;
+ static String lastDay;
+ };
+ unsigned short Log::level = 0xFF;
+ bool Log::fileOutput = false;
+ bool Log::consoleOutput = false;
+ bool Log::useOtherOutput = false;
+ std::ostream *otherOutput = NULL;
+ bool Log::useOtherOutputV = false;
+ std::ostream *otherOutputV = NULL;
+ String Log::lastDay("");
inline void LogCtor(const char *module, const unsigned id)
{
- Log(String("%s: Initializing %u", module, id), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Initializing %u", module, id), PM_DEBUG_DEBUG);
}
inline void LogCtorIni(const char *module, const unsigned id)
{
- Log(String("%s: Initializing by INI (%u)", module, id), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Initializing by INI (%u)", module, id), PM_DEBUG_DEBUG);
}
inline void LogIdError(const char *module)
{
- Log(String("%s: id not set", module), PM_DEBUG_ALERT);
+ Log::Write(String("%s: id not set", module), PM_DEBUG_ALERT);
}
// Destruction
inline void LogDtor(const char *module, const unsigned id, const char *name = NULL)
{
- Log(String("%s: Destroying %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Destroying %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
// Validation
inline void LogValidateStart(const char *module, const unsigned id, const char *name = NULL)
{
- Log(String("%s Validation: Starting to validate %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_INFO);
+ Log::Write(String("%s Validation: Starting to validate %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_INFO);
}
inline void LogVarNotSet(const char *module, const unsigned id, const char *var, const char *name = NULL)
{
- Log(String("%s Validation: %s of %u%s isn\'t set", module, var, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ALERT);
- }
-
-# ifdef PG_DEBUG_WINDOW
- inline String ConsoleLogVarNotSet(const char *module, const unsigned id, const char *var, const char *name = NULL)
- {
- return String("Error (%s): %s of %u%s isn\'t set", module, var, id, name ? String(" (%s)", name).c_str() : "");
+ Log::Write(String("%s Validation: %s of %u%s isn\'t set", module, var, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ALERT | PM_DEBUG_VALIDATION);
}
- inline String ConsoleLogVarNotSetW(const char *module, const unsigned id, const char *var, const char *name = NULL)
- {
- return String("Warning (%s): %s of %u%s isn\'t set", module, var, id, name ? String(" (%s)", name).c_str() : "");
- }
-# endif
-
inline void LogVarNotValid(const char *module, const unsigned id, const char *var, const char *name = NULL)
{
- Log(String("%s Validation: %s of %u%s isn\'t valid", module, var, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ALERT);
- }
-
-# ifdef PG_DEBUG_WINDOW
- inline String ConsoleLogVarNotValid(const char *module, const unsigned id, const char *var, const char *name = NULL)
- {
- return String("Error (%s): %s of %u%s isn\'t valid", module, var, id, name ? String(" (%s)", name).c_str() : "");
+ Log::Write(String("%s Validation: %s of %u%s isn\'t valid", module, var, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ALERT | PM_DEBUG_VALIDATION);
}
-# endif
inline void LogSubmoduleIterate(const char *module, const unsigned id, const char *subName, const unsigned subId, const char *name = NULL)
{
- Log(String("%s Validation: Validating %s %u of %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s Validation: Validating %s %u of %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG | PM_DEBUG_VALIDATION);
}
inline void LogSubmoduleEmpty(const char *module, const unsigned id, const char *subName, const char *name = NULL)
{
- Log(String("%s Validation: No %s of %u%s defined", module, subName, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ALERT);
+ Log::Write(String("%s Validation: No %s of %u%s defined", module, subName, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ALERT | PM_DEBUG_VALIDATION);
}
-# ifdef PG_DEBUG_WINDOW
- inline String ConsoleLogSubmoduleEmpty(const char *module, const unsigned id, const char *subName, const char *name = NULL)
- {
- return String("Error (%s): No %s of %u%s defined", module, subName, id, name ? String(" (%s)", name).c_str() : "");
- }
-# endif
-
inline void LogValidateOver(const char *module, const unsigned id, bool valid, const char *name = NULL)
{
- Log(String("%s Validation: %u%s %s", module, id, name ? String(" (%s)", name).c_str() : "", valid ? "Passed" : "Failed"), PM_DEBUG_INFO);
+ Log::Write(String("%s Validation: %u%s %s", module, id, name ? String(" (%s)", name).c_str() : "", valid ? "Passed" : "Failed"), PM_DEBUG_INFO);
}
// Importing
inline void LogImportStart(const char *module)
{
- Log(String("%s Import: Starting", module), PM_DEBUG_INFO);
+ Log::Write(String("%s Import: Starting", module), PM_DEBUG_INFO);
}
inline void LogIdNotFound(const char *module)
{
- Log(String("%s Import: id not found", module), PM_DEBUG_ALERT);
+ Log::Write(String("%s Import: id not found", module), PM_DEBUG_ALERT);
}
inline void LogImportOver(const char *module, const unsigned id, const char *name = NULL)
{
- Log(String("%s Import: Imported %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_INFO);
+ Log::Write(String("%s Import: Imported %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_INFO);
}
inline void LogImportOver(const char *module)
{
- Log(String("%s Import: Imported", module), PM_DEBUG_INFO);
+ Log::Write(String("%s Import: Imported", module), PM_DEBUG_INFO);
}
// Exporting
inline void LogExportStart(const char *module, const unsigned id, const char *name = NULL)
{
- Log(String("%s Export: Starting %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_INFO);
+ Log::Write(String("%s Export: Starting %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_INFO);
}
inline void LogExportOver(const char *module, const unsigned id, const char *name = NULL)
{
- Log(String("%s Export: Finished %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_INFO);
+ Log::Write(String("%s Export: Finished %u%s", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_INFO);
}
// Setting Variable Values
inline void LogSetVar(const char *module, const unsigned id, const char *var, const bool valBool, const char *name = NULL)
{
- Log(String("%s: Setting %s of %u%s to %s", module, var, id, name ? String(" (%s)", name).c_str() : "", valBool ? "true" : "false"), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Setting %s of %u%s to %s", module, var, id, name ? String(" (%s)", name).c_str() : "", valBool ? "true" : "false"), PM_DEBUG_DEBUG);
}
inline void LogSetVar(const char *module, const unsigned id, const char *var, const int valInt, const char *name = NULL)
{
- Log(String("%s: Setting %s of %u%s to %d", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Setting %s of %u%s to %d", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt), PM_DEBUG_DEBUG);
}
inline void LogSetVar(const char *module, const unsigned id, const char *var, const unsigned valInt, const char *name = NULL)
{
- Log(String("%s: Setting %s of %u%s to %u", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Setting %s of %u%s to %u", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt), PM_DEBUG_DEBUG);
}
inline void LogSetVar(const char *module, const unsigned id, const char *var, const char *valStr, const char *name = NULL)
{
- Log(String("%s: Setting %s of %u%s to %s", module, var, id, name ? String(" (%s)", name).c_str() : "", valStr), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Setting %s of %u%s to %s", module, var, id, name ? String(" (%s)", name).c_str() : "", valStr), PM_DEBUG_DEBUG);
}
inline void LogSetVar(const char *module, const unsigned id, const char *var, const long valInt, const char *valStr, const char *name = NULL)
{
- Log(String("%s: Setting %s of %u%s to %l (%s)", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, valStr), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Setting %s of %u%s to %l (%s)", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, valStr), PM_DEBUG_DEBUG);
}
inline void LogSetVar(const char *module, const unsigned id, const char *var, const unsigned n, const unsigned d, const char *name = NULL)
{
- Log(String("%s: Setting %s of %u%s to %u/%u", module, var, id, name ? String(" (%s)", name).c_str() : "", n, d), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Setting %s of %u%s to %u/%u", module, var, id, name ? String(" (%s)", name).c_str() : "", n, d), PM_DEBUG_DEBUG);
}
inline void LogOutOfRange(const char *module, const unsigned id, const char *var, int valInt, const char *regVal, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %d of %u%s out-of-range (%s)", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", regVal), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Attempting to set %s to %d of %u%s out-of-range (%s)", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", regVal), PM_DEBUG_DEBUG);
}
inline void LogNotSet(const char *module, const unsigned id, const char *var, const int valInt, const char *reg, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %d of %u%s without %s being set", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %d of %u%s without %s being set", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
}
inline void LogNotSet(const char *module, const unsigned id, const char *var, const unsigned valInt, const char *reg, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %u of %u%s without %s being set", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %u of %u%s without %s being set", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
}
inline void LogNotSet(const char *module, const unsigned id, const char *var, const char *valStr, const char *reg, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %s of %u%s without %s being set", module, var, valStr, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %s of %u%s without %s being set", module, var, valStr, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
}
inline void LogNotSet(const char *module, const unsigned id, const char *var, const int valInt, const char *valStr, const char *reg, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %d (%s) of %u%s without %s being set", module, var, valInt, valStr, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %d (%s) of %u%s without %s being set", module, var, valInt, valStr, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
}
inline void LogNotSet(const char *module, const unsigned id, const char *var, const unsigned valInt, const char *valStr, const char *reg, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %u (%s) of %u%s without %s being set", module, var, valInt, valStr, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %u (%s) of %u%s without %s being set", module, var, valInt, valStr, id, name ? String(" (%s)", name).c_str() : "", reg), PM_DEBUG_ERROR);
}
inline void LogNoUse(const char *module, const unsigned id, const char *var, const int valInt, const char *reg, const char *regVal, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %d of %u%s without %s needing it (%s)", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %d of %u%s without %s needing it (%s)", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
}
inline void LogNoUse(const char *module, const unsigned id, const char *var, const unsigned valInt, const char *reg, const char *regVal, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %u of %u%s without %s needing it (%s)", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %u of %u%s without %s needing it (%s)", module, var, valInt, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
}
inline void LogNoUse(const char *module, const unsigned id, const char *var, const char *valStr, const char *reg, const char *regVal, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %s of %u%s without %s needing it (%s)", module, var, valStr, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %s of %u%s without %s needing it (%s)", module, var, valStr, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
}
inline void LogNoUse(const char *module, const unsigned id, const char *var, const int valInt, const char *valStr, const char *reg, const char *regVal, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %d (%s) of %u%s without %s needing it (%s)", module, var, valInt, valStr, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %d (%s) of %u%s without %s needing it (%s)", module, var, valInt, valStr, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
}
inline void LogNoUse(const char *module, const unsigned id, const char *var, const unsigned valInt, const char *valStr, const char *reg, const char *regVal, const char *name = NULL)
{
- Log(String("%s: Attempting to set %s to %u (%s) of %u%s without %s needing it (%s)", module, var, valInt, valStr, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Attempting to set %s to %u (%s) of %u%s without %s needing it (%s)", module, var, valInt, valStr, id, name ? String(" (%s)", name).c_str() : "", reg, regVal), PM_DEBUG_ERROR);
}
// Fetching variable values
inline void LogFetchVar(const char *module, const unsigned id, const char *var, const bool valBool, const char *name = NULL)
{
- Log(String("%s: Fetching %s from %u%s (%s)", module, var, id, name ? String(" (%s)", name).c_str() : "", valBool ? "true" : "false"), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s from %u%s (%s)", module, var, id, name ? String(" (%s)", name).c_str() : "", valBool ? "true" : "false"), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const unsigned id, const char *var, const int valInt, const char *name = NULL)
{
- Log(String("%s: Fetching %s from %u%s (%d)", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s from %u%s (%d)", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const unsigned id, const char *var, const unsigned valInt, const char *name = NULL)
{
- Log(String("%s: Fetching %s from %u%s (%u)", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s from %u%s (%u)", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const unsigned id, const char *var, const long valInt, const long valInt2, const char *name = NULL)
{
- Log(String("%s: Fetching %s from %u%s (%l/%l)", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, valInt2), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s from %u%s (%l/%l)", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, valInt2), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const unsigned id, const char *var, const char *valStr, const char *name = NULL)
{
- Log(String("%s: Fetching %s from %u%s (%s)", module, var, id, name ? String(" (%s)", name).c_str() : "", valStr), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s from %u%s (%s)", module, var, id, name ? String(" (%s)", name).c_str() : "", valStr), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const unsigned id, const char *var, const long valInt, const char *valStr, const char *name = NULL)
{
- Log(String("%s: Fetching %s from %u%s (%l (%s))", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, valStr), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s from %u%s (%l (%s))", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, valStr), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const unsigned id, const char *var, const long valInt, const char *reg, const char *regVal, const char *name = NULL)
{
- Log(String("%s: Fetching %s from %u%s (%l - %s (%s))", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, reg, regVal), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s from %u%s (%l - %s (%s))", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, reg, regVal), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const unsigned id, const char *var, const char *valStr, const char *reg, const char *regVal, const char *name = NULL)
{
- Log(String("%s: Fetching %s from %u%s (%s - %s (%s))", module, var, id, name ? String(" (%s)", name).c_str() : "", valStr, reg, regVal), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s from %u%s (%s - %s (%s))", module, var, id, name ? String(" (%s)", name).c_str() : "", valStr, reg, regVal), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const unsigned id, const char *var, const long valInt, const char *valStr, const char *reg, const char *regVal, const char *name = NULL)
{
- Log(String("%s: Fetching %s from %u%s (%l (%s) - %s (%s))", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, valStr, reg, regVal), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s from %u%s (%l (%s) - %s (%s))", module, var, id, name ? String(" (%s)", name).c_str() : "", valInt, valStr, reg, regVal), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const char *var, const unsigned valInt)
{
- Log(String("%s: Fetching %s (%u)", module, var, valInt), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s (%u)", module, var, valInt), PM_DEBUG_DEBUG);
}
inline void LogFetchVar(const char *module, const unsigned id, const char *var)
{
- Log(String("%s: Fetching %s of %u", module, var, id), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s of %u", module, var, id), PM_DEBUG_DEBUG);
}
// Submodule logging
inline void LogSubmoduleFetch(const char *module, const unsigned id, const char *subName, const unsigned subId, const char *name = NULL)
{
- Log(String("%s: Fetching %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
inline void LogSubmoduleFetch(const char *module, const unsigned id, const char *subName, const char *subStr, const char *name = NULL)
{
- Log(String("%s: Fetching %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
inline void LogSubmoduleFetchFail(const char *module, const unsigned id, const char *subName, const unsigned subId, const char *name = NULL)
{
- Log(String("%s: Fetching %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Fetching %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
}
inline void LogSubmoduleFetchFail(const char *module, const unsigned id, const char *subName, const char *subStr, const char *name = NULL)
{
- Log(String("%s: Fetching %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Fetching %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
}
inline void LogSubmoduleCount(const char *module, const unsigned id, const char *subName, const char *name = NULL)
{
- Log(String("%s: Fetching %s count of %u%s", module, subName, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Fetching %s count of %u%s", module, subName, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
inline void LogSubmoduleNew(const char *module, const unsigned id, const char *subName, const unsigned subId, const char *name = NULL)
{
- Log(String("%s: Creating a new %s (%u) in %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Creating a new %s (%u) in %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
inline void LogSubmoduleNew(const char *module, const unsigned id, const char *subName, const char *subStr, const char *name = NULL)
{
- Log(String("%s: Creating a new %s (%s) in %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Creating a new %s (%s) in %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
inline void LogSubmoduleRemoveStart(const char *module, const unsigned id, const char *subName, const unsigned subId, const char *name = NULL)
{
- Log(String("%s: Attempting to remove %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Attempting to remove %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
inline void LogSubmoduleRemoveStart(const char *module, const unsigned id, const char *subName, const char *subStr, const char *name = NULL)
{
- Log(String("%s: Attempting to remove %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Attempting to remove %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
inline void LogSubmoduleRemoved(const char *module, const unsigned id, const char *subName, const unsigned subId, const char *name = NULL)
{
- Log(String("%s: Removed %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Removed %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
inline void LogSubmoduleRemoved(const char *module, const unsigned id, const char *subName, const char *subStr, const char *name = NULL)
{
- Log(String("%s: Removed %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
+ Log::Write(String("%s: Removed %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_DEBUG);
}
inline void LogSubmoduleRemoveFail(const char *module, const unsigned id, const char *subName, const unsigned subId, const char *name = NULL)
{
- Log(String("%s: Failed to remove %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Failed to remove %s %u from %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
}
inline void LogSubmoduleRemoveFail(const char *module, const unsigned id, const char *subName, const char *subStr, const char *name = NULL)
{
- Log(String("%s: Failed to remove %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Failed to remove %s %s from %u%s", module, subName, subStr, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
}
inline void LogDuplicateId(const char *module, const unsigned id, const char *subName, const unsigned subId, const char *name = NULL)
{
- Log(String("%s: Duplicate ID for %s of %u found in %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Duplicate ID for %s of %u found in %u%s", module, subName, subId, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ALERT | PM_DEBUG_VALIDATION);
}
inline void LogDuplicateSubmodule(const char *module, const unsigned id, const char *subName, const unsigned subVal, const char *name = NULL)
{
- Log(String("%s: Duplicate %s of %u found in %u%s", module, subName, subVal, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Duplicate %s of %u found in %u%s", module, subName, subVal, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ALERT | PM_DEBUG_VALIDATION);
}
inline void LogDuplicateSubmodule(const char *module, const unsigned id, const char *subName, const char *subVal, const char *name = NULL)
{
- Log(String("%s: Duplicate %s of %s found in %u%s", module, subName, subVal, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ERROR);
+ Log::Write(String("%s: Duplicate %s of %s found in %u%s", module, subName, subVal, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_ALERT | PM_DEBUG_VALIDATION);
}
- /* inline void Log(const char *module, const unsigned id, const char *name = NULL)
+ /* inline void Log::Write(const char *module, const unsigned id, const char *name = NULL)
{
- Log(String("%s: ", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_);
+ Log::Write(String("%s: ", module, id, name ? String(" (%s)", name).c_str() : ""), PM_DEBUG_);
}*/
}
}
#endif
-
-#endif
diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp
index 53e3afc0..6f7210d9 100644
--- a/pokemod/Dialog.cpp
+++ b/pokemod/Dialog.cpp
@@ -45,11 +45,7 @@ PokeGen::PokeMod::Dialog::~Dialog()
LogDtor("Dialog", id);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Dialog::Validate(const wxListBox &output)
-#else
void PokeGen::PokeMod::Dialog::Validate()
-#endif
{
LogValidateStart("Dialog", id);
if (dialog == "")
@@ -59,7 +55,7 @@ void PokeGen::PokeMod::Dialog::Validate()
}
if (dialog.Count('%') % 2)
{
- Log(String("Dialog: Command delimiter mismatch in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Command delimiter mismatch in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
else
@@ -76,14 +72,14 @@ void PokeGen::PokeMod::Dialog::Validate()
case DC_FLIP_FLAG ... DC_EXIT:
if (numArgs != DialogCommandNumArgs[curCmd])
{
- Log(String("Dialog: Invalid number of arguments (%u) for %s (%u wanted) in %u", numArgs, DialogCommandStr[curCmd], DialogCommandNumArgs[curCmd], id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid number of arguments (%u) for %s (%u wanted) in %u", numArgs, DialogCommandStr[curCmd], DialogCommandNumArgs[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
case DC_MENU:
if (!(numArgs % 2))
{
- Log(String("Dialog: Argument mismatch for Menu in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Argument mismatch for Menu in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
@@ -95,13 +91,14 @@ void PokeGen::PokeMod::Dialog::Validate()
{
if (curCmdStr != "")
{
- Log(String("Dialog: Invalid command \"%s\" in %u", curCmdStr.c_str(), id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid command \"%s\" in %u", curCmdStr.c_str(), id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
curCmd = DC_END;
}
numArgs = 0;
}
+ break;
case '#':
if (curCmd != DC_END)
{
@@ -112,7 +109,6 @@ void PokeGen::PokeMod::Dialog::Validate()
for (; (dialog[i] != '%') && (dialog[i] != '#'); ++i)
arg.append(1, dialog[i]);
++numArgs;
- // TODO (Ben#1#): Argument parsing checks
switch (curCmd)
{
case DC_FLIP_FLAG:
@@ -123,73 +119,53 @@ void PokeGen::PokeMod::Dialog::Validate()
{
if (!arg.Convert(tempUL))
{
- Log(String("Dialog: Bad flag in \"%s\" on %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Bad flag in \"%s\" on %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
- else
- {
- Log(String("Dialog: Too many arguments (%u) for \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
- isValid = false;
- }
break;
case DC_TEST_FLAG:
switch (numArgs)
{
case 1:
- if ((arg != "Call") || (arg != "Goto") || (arg != "0") || (arg != "1"))
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
{
- Log(String("Dialog: Invalid argument #1 in \"Test Flag\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Test Flag\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
case 2:
- if ((arg != "Unset") || (arg != "Set") || (arg != "0") || (arg != "1"))
- {
- Log(String("Dialog: Invalid argument #2 in \"Test Flag\" in %u", id), PM_DEBUG_ERROR);
- isValid = false;
- }
- break;
- case 3:
if (!arg.Convert(tempUL))
{
- Log(String("Dialog: Bad flag in \"Test Flag\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Bad flag in \"Test Flag\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
+ case 3:
case 4:
- case 5:
if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
{
- Log(String("Dialog: Invalid argument #%u in \"Test Flag\" in %u", numArgs, id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Test Flag\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
- break;
- default:
- Log(String("Dialog: Too many arguments (%u) for \"Test Flag\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
}
break;
case DC_DIALOG:
- switch (numArgs)
+ if (numArgs == 1)
{
- case 1:
- if ((arg != "Call") || (arg != "Goto") || (arg != "0") || (arg != "1"))
- {
- Log(String("Dialog: Invalid argument #1 in \"Dialog\" in %u", id), PM_DEBUG_ERROR);
- isValid = false;
- }
- break;
- case 2:
- if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
- {
- Log(String("Dialog: Invalid argument #%u in \"Dialog\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
- }
- break;
- default:
- Log(String("Dialog: Too many arguments (%u) for \"Dialog\" in %u", numArgs, id), PM_DEBUG_ERROR);
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Dialog\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
+ else if (numArgs == 2)
+ {
+ if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Dialog\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
+ }
}
break;
case DC_YES_NO:
@@ -197,9 +173,9 @@ void PokeGen::PokeMod::Dialog::Validate()
switch (numArgs)
{
case 1:
- if ((arg != "Call") || (arg != "Goto") || (arg != "0") || (arg != "1"))
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
{
- Log(String("Dialog: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
@@ -207,13 +183,9 @@ void PokeGen::PokeMod::Dialog::Validate()
case 3:
if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
{
- Log(String("Dialog: Invalid argument #%u in \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
- break;
- default:
- Log(String("Dialog: Too many arguments (%u) for \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
- isValid = false;
}
break;
case DC_ITEM_SHOP:
@@ -221,15 +193,10 @@ void PokeGen::PokeMod::Dialog::Validate()
{
if (!(arg.Convert(tempU) ? pokemod->GetStore(tempU) : pokemod->GetStore(arg)))
{
- Log(String("Dialog: Invalid argument #1 in \"Test Flag\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Test Flag\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
- else
- {
- Log(String("Dialog: Too many arguments (%u) for \"Test Flag\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
- }
break;
case DC_GIVE_ITEM:
case DC_TAKE_ITEM:
@@ -237,16 +204,16 @@ void PokeGen::PokeMod::Dialog::Validate()
switch (numArgs)
{
case 1:
- if ((arg != "Call") || (arg != "Goto") || (arg != "0") || (arg != "1"))
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
{
- Log(String("Dialog: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
case 2:
if (!(arg.Convert(tempU) ? pokemod->GetItem(tempU) : pokemod->GetItem(arg)))
{
- Log(String("Dialog: Invalid argument #2 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
@@ -254,13 +221,9 @@ void PokeGen::PokeMod::Dialog::Validate()
case 4:
if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
{
- Log(String("Dialog: Invalid argument #%u in \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
- break;
- default:
- Log(String("Dialog: Too many arguments (%u) for \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
- isValid = false;
}
break;
case DC_COIN_LIST:
@@ -268,30 +231,25 @@ void PokeGen::PokeMod::Dialog::Validate()
{
if (!(arg.Convert(tempU) ? pokemod->GetCoinList(tempU) : pokemod->GetCoinList(arg)))
{
- Log(String("Dialog: Invalid argument #1 in \"Coin List\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Coin List\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
- else
- {
- Log(String("Dialog: Too many arguments (%u) for \"Coin List\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
- }
break;
case DC_TEACH_MOVE:
switch (numArgs)
{
case 1:
- if ((arg != "Call") || (arg != "Goto") || (arg != "0") || (arg != "1"))
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
{
- Log(String("Dialog: Invalid argument #1 in \"Teach Move\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Teach Move\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
case 2:
if (!(arg.Convert(tempU) ? pokemod->GetMove(tempU) : pokemod->GetMove(arg)))
{
- Log(String("Dialog: Invalid argument #2 in \"Teach Move\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"Teach Move\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
@@ -300,36 +258,32 @@ void PokeGen::PokeMod::Dialog::Validate()
case 5:
if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
{
- Log(String("Dialog: Invalid argument #%u in \"Teach Move\" in %u", numArgs, id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Teach Move\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
- break;
- default:
- Log(String("Dialog: Too many arguments (%u) for \"Teach Move\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
}
break;
case DC_CHECK_MOVE:
switch (numArgs)
{
case 1:
- if ((arg != "Call") || (arg != "Goto") || (arg != "0") || (arg != "1"))
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
{
- Log(String("Dialog: Invalid argument #1 in \"Check Move\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Check Move\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
case 2:
- if ((arg != "Lead") || (arg != "All") || (arg != "0") || (arg != "1"))
+ if ((arg != "Lead") && (arg != "All") && (arg != "0") && (arg != "1"))
{
- Log(String("Dialog: Invalid argument #2 in \"Check Move\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"Check Move\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
case 3:
if (!(arg.Convert(tempU) ? pokemod->GetMove(tempU) : pokemod->GetMove(arg)))
{
- Log(String("Dialog: Invalid argument #3 in \"Check Move\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #3 in \"Check Move\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
@@ -337,22 +291,103 @@ void PokeGen::PokeMod::Dialog::Validate()
case 5:
if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
{
- Log(String("Dialog: Invalid argument #%u in \"Check Move\" in %u", numArgs, id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Check Move\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
- break;
- default:
- Log(String("Dialog: Too many arguments (%u) for \"Check Move\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
}
break;
case DC_GIVE_POKEMON:
+ switch (numArgs)
+ {
+ case 1:
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Give Pokémon\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 2:
+ if (!(arg.Convert(tempU) ? pokemod->GetPokemon(tempU) : pokemod->GetPokemon(arg)))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #3 in \"Give Pokémon\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 3:
+ if ((arg != "false") && (arg != "true") && (arg != "0") && (arg != "1"))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #3 in \"Give Pokémon\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 4:
+ if (arg.Convert(tempUL))
+ {
+ if (pokemod->GetMaxLevel() < tempUL)
+ {
+ Log::Write(String("Dialog Validation: Higher level than allowed in \"Give Pokémon\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
+ else
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #4 in \"Give Pokémon\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 5:
+ if (!arg.Convert(tempUL))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #5 in \"Give Pokémon\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 6:
+ case 7:
+ if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Give Pokémon\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_TAKE_POKEMON:
+ case DC_VIEW_POKEMON:
+ case DC_CHECK_SPECIES:
+ switch (numArgs)
+ {
+ case 1:
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 2:
+ if (!(arg.Convert(tempU) ? pokemod->GetPokemon(tempU) : pokemod->GetPokemon(arg)))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 3:
+ case 4:
+ if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_SHOW_POKEMON:
- break;
- case DC_VIEW_POKEMON:
+ if (numArgs == 1)
+ {
+ if (!(arg.Convert(tempU) ? pokemod->GetPokemon(tempU) : pokemod->GetPokemon(arg)))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"Show Pokémon\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_GIVE_MONEY:
if (numArgs == 1)
@@ -361,29 +396,24 @@ void PokeGen::PokeMod::Dialog::Validate()
{
if (pokemod->GetMaxMoney() < tempUL)
{
- Log(String("Dialog: More money given than can be held in \"Give Money\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: More money given than can be held in \"Give Money\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
else
{
- Log(String("Dialog: Invalid argument #1 in \"Give Money\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Give Money\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
- else
- {
- Log(String("Dialog: Too many arguments (%u) for \"Give Money\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
- }
break;
case DC_TAKE_MONEY:
switch (numArgs)
{
case 1:
- if ((arg != "Call") || (arg != "Goto") || (arg != "0") || (arg != "1"))
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
{
- Log(String("Dialog: Invalid argument #1 in \"Take Money\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Take Money\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
@@ -392,13 +422,13 @@ void PokeGen::PokeMod::Dialog::Validate()
{
if (pokemod->GetMaxMoney() < tempUL)
{
- Log(String("Dialog: More money taken than can be held in \"Take Money\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: More money taken than can be held in \"Take Money\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
else
{
- Log(String("Dialog: Invalid argument #2 in \"Take Money\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"Take Money\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
@@ -406,58 +436,118 @@ void PokeGen::PokeMod::Dialog::Validate()
case 4:
if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
{
- Log(String("Dialog: Invalid argument #%u in \"Take Money\" in %u", numArgs, id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Take Money\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
- break;
- default:
- Log(String("Dialog: Too many arguments (%u) for \"Take Money\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
}
break;
case DC_MOVE_EFFECT:
+ case DC_CHECK_DIRECTION:
+ switch (numArgs)
+ {
+ case 1:
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 2:
+ if (!(map = (arg.Convert(tempU) ? (Map *)pokemod->GetMap(tempU) : (Map *)pokemod->GetMap(arg))))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 3:
+ if (map)
+ {
+ if (!(arg.Convert(tempU) ? map->GetMapEffect(tempU) : map->GetMapEffect(arg)))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #3 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
+ else if ((arg != "Player") && (arg != "-1"))
+ Log::Write(String("Dialog Validation: Unable to validate argument #3 in \"%s\" in %u", id), PM_DEBUG_ERROR);
+ break;
+ case 4:
+ if ((arg != "Up") && (arg != "Down") && (arg != "Left") && (arg != "Right") && ((arg != "Random") || (curCmd == DC_CHECK_DIRECTION)) && (arg != "0") && (arg != "1") && (arg != "2") && (arg != "3") && ((arg != "4") || (curCmd == DC_CHECK_DIRECTION)))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #4 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 5:
+ case 6:
+ if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_TURN_EFFECT:
- break;
- case DC_CHECK_DIRECTION:
+ switch (numArgs)
+ {
+ case 1:
+ if (!(map = (arg.Convert(tempU) ? (Map *)pokemod->GetMap(tempU) : (Map *)pokemod->GetMap(arg))))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Turn Effect\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 2:
+ if (map)
+ {
+ if (!(arg.Convert(tempU) ? map->GetMapEffect(tempU) : map->GetMapEffect(arg)))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"Turn Effect\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
+ else if ((arg != "Player") && (arg != "-1"))
+ Log::Write(String("Dialog Validation: Unable to validate argument #2 in \"Turn Effect\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ break;
+ case 4:
+ if ((arg != "Up") && (arg != "Down") && (arg != "Left") && (arg != "Right") && (arg != "Random") && (arg != "0") && (arg != "1") && (arg != "2") && (arg != "3") && (arg != "4"))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #3 in \"Turn Effect\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_CHECK_ROSTER:
- break;
case DC_CHECK_LEVELS:
- break;
- case DC_CHECK_SPECIES:
- break;
- case DC_CHECK_HELD_ITEMS:
- break;
case DC_CHECK_MONEY:
switch (numArgs)
{
case 1:
- if ((arg != "Call") || (arg != "Goto") || (arg != "0") || (arg != "1"))
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
{
- Log(String("Dialog: Invalid argument #1 in \"Check Money\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
case 2:
- if ((arg != "<") || (arg != ">") || (arg != "="))
+ if ((arg != "<") && (arg != ">") && (arg != "="))
{
- Log(String("Dialog: Invalid argument #2 in \"Check Money\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
case 3:
if (arg.Convert(tempUL))
{
- if (pokemod->GetMaxMoney() < tempUL)
+ if (((curCmd == DC_CHECK_ROSTER) ? pokemod->GetMaxParty() : ((curCmd == DC_CHECK_LEVELS) ? pokemod->GetMaxLevel() : pokemod->GetMaxMoney())) < tempUL)
{
- Log(String("Dialog: More money than can be held in \"Check Money\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: More %s than can be carried in \"%s\" in %u", (curCmd == DC_CHECK_ROSTER) ? "party members" : ((curCmd == DC_CHECK_LEVELS) ? "level" : "money"), DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
else
{
- Log(String("Dialog: Invalid argument #3 in \"Check Money\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #3 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
@@ -465,63 +555,140 @@ void PokeGen::PokeMod::Dialog::Validate()
case 5:
if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
{
- Log(String("Dialog: Invalid argument #%u in \"Check Money\" in %u", numArgs, id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
+ break;
+ case DC_CHECK_HELD_ITEMS:
+ switch (numArgs)
+ {
+ case 1:
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Check Held Items\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
break;
- default:
- Log(String("Dialog: Too many arguments (%u) for \"Check Money\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
+ case 2:
+ case 3:
+ case 4:
+ if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Check Held Items\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
}
break;
case DC_TRADE:
+ switch (numArgs)
+ {
+ case 1:
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Trade\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 2:
+ case 3:
+ if (!(arg.Convert(tempU) ? pokemod->GetPokemon(tempU) : pokemod->GetPokemon(arg)))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Trade\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ case 4:
+ if (!arg.Convert(tempUL))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #4 in \"Trade\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 5:
+ case 6:
+ if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Trade\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_DAYCARE:
+ if (numArgs == 1)
+ {
+ if (!arg.Convert(tempUL))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #4 in \"Daycare\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_BATTLE:
+ if (numArgs == 1)
+ {
+ if (!(map = (arg.Convert(tempU) ? (Map *)pokemod->GetMap(tempU) : (Map *)pokemod->GetMap(arg))))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Battle\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
+ else if (numArgs == 2)
+ {
+ if (map)
+ {
+ if (!(arg.Convert(tempU) ? map->GetMapTrainer(tempU) : map->GetMapTrainer(arg)))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"Battle\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
+ else
+ Log::Write(String("Dialog Validation: Unable to validate argument #2 in \"Battle\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ }
break;
case DC_BADGE:
+ if (numArgs == 1)
+ {
+ if (!(arg.Convert(tempU) ? pokemod->GetBadge(tempU) : pokemod->GetBadge(arg)))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Badge\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_WARP:
if (numArgs == 1)
{
- if (!(map = (arg.Convert(tempU) ? (Map *)pokemod->GetMap(tempU) : (Map *)pokemod->GetMap(arg)))
+ if (!(map = (arg.Convert(tempU) ? (Map *)pokemod->GetMap(tempU) : (Map *)pokemod->GetMap(arg))))
{
- Log(String("Dialog: Invalid argument #1 in \"Warp\" in %u", id), PM_DEBUG_ERROR);
- isValid = false;
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Warp\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
}
}
else if (numArgs == 2)
{
if (map)
{
- if (!(arg.Convert(tempU) ? map->GetWarp(tempU) : map->GetWarp(arg)))
+ if (!(arg.Convert(tempU) ? map->GetMapWarp(tempU) : map->GetMapWarp(arg)))
{
- Log(String("Dialog: Invalid argument #3 in \"Warp\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"Warp\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
else
- Log(String("Dialog: Unable to validate argument #2 in \"Warp\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Unable to validate argument #2 in \"Warp\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
}
- else
- Log(String("Dialog: Too many arguments (%u) for \"Warp\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
break;
case DC_NAME:
+ case DC_MAP_SIGN:
if (numArgs == 1)
{
if (arg == "")
{
- Log(String("Dialog: Invalid argument #1 in \"Name\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
- else
- {
- Log(String("Dialog: Too many arguments (%u) for \"Name\" in %u", numArgs, id), PM_DEBUG_ERROR);
- isValid = false;
- }
break;
case DC_MUSIC:
case DC_SOUND_EFFECT:
@@ -529,39 +696,97 @@ void PokeGen::PokeMod::Dialog::Validate()
{
if (!Path(pokemod->GetPath() + "sound/" + arg).DoesExist())
{
- Log(String("Dialog: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"%s\" in %u", DialogCommandStr[curCmd], id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
- else
- {
- Log(String("Dialog: Too many arguments (%u) for \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
- isValid = false;
- }
break;
case DC_TIMER:
- break;
- case DC_MAP_SIGN:
+ switch (numArgs)
+ {
+ case 1:
+ if ((arg != "Time") && (arg != "Step") && (arg != "0") && (arg != "1"))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Timer\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 2:
+ if (!arg.Convert(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"Timer\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 3:
+ if (!arg.Convert(tempU) || !pokemod->GetDialog(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #3 in \"Timer\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_WILD_SCOPE:
+ if (numArgs == 1)
+ {
+ if (!arg.Convert(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Wild Scope\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_SAFARI:
- break;
- case DC_HEAL_PARTY:
- case DC_REFRESH:
- case DC_CLEAR:
- case DC_PAUSE:
- case DC_NEW_LINE:
- case DC_EXIT:
- Log(String("Dialog: Too many arguments (%u) for \"%s\" in %u", numArgs, DialogCommandStr[curCmd], id), PM_DEBUG_ERROR);
- isValid = false;
+ switch (numArgs)
+ {
+ case 1:
+ if (const Item *item = (arg.Convert(tempU) ? pokemod->GetItem(tempU) : pokemod->GetItem(arg)))
+ {
+ unsigned i = 0;
+ unsigned j = 0;
+ bool temp = false;
+ while ((i < item->GetItemEffectCount()) || !temp)
+ {
+ if (const ItemEffect *e = item->GetItemEffect(j++))
+ {
+ ++i;
+ if (e->GetEffect() == IE_BALL)
+ temp = true;
+ }
+ }
+ if (!temp)
+ {
+ Log::Write(String("Dialog Validation: Item in argument #1 in \"Safari\" in %u isn\'t a PokéBall", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
+ else
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Safari\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 2:
+ if (!arg.Convert(tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #2 in \"Safari\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ break;
+ case 3:
+ if (!arg.Convert(tempU) || (pokemod->GetMaxParty() < tempU))
+ {
+ Log::Write(String("Dialog Validation: Invalid argument #3 in \"Safari\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
break;
case DC_MENU:
if (numArgs == 1)
{
- if ((arg != "Call") || (arg != "Goto") || (arg != "0") || (arg != "1"))
+ if ((arg != "Call") && (arg != "Goto") && (arg != "0") && (arg != "1"))
{
- Log(String("Dialog: Invalid argument #1 in \"Menu\" in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #1 in \"Menu\" in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
@@ -571,19 +796,19 @@ void PokeGen::PokeMod::Dialog::Validate()
{
if (!pokemod->GetDialog(tempU))
{
- Log(String("Dialog: Invalid argument #%u in \"Menu\" in %u", numArgs, id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Menu\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
else
{
- Log(String("Dialog: Invalid argument #%u in \"Menu\" in %u", numArgs, id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Menu\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
else if (arg == "")
{
- Log(String("Dialog: Invalid argument #%u in \"Menu\" in %u", numArgs, id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog Validation: Invalid argument #%u in \"Menu\" in %u", numArgs, id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
isValid = false;
}
}
@@ -633,10 +858,10 @@ PokeGen::PokeMod::String PokeGen::PokeMod::Dialog::GetDialog() const
void PokeGen::PokeMod::Dialog::InsertDialogCommand(const String &cmd, const unsigned pos)
{
- Log(String("Dialog: Inserting dialog command %s into %u at %u", cmd.c_str(), id, pos), PM_DEBUG_INFO);
+ Log::Write(String("Dialog: Inserting dialog command %s into %u at %u", cmd.c_str(), id, pos), PM_DEBUG_INFO);
if (dialog.length() < pos)
{
- Log(String("Dialog: Position out-of-range in %u", id), PM_DEBUG_ERROR);
+ Log::Write(String("Dialog: Position out-of-range in %u", id), PM_DEBUG_ERROR);
return;
}
dialog.insert(pos, cmd);
diff --git a/pokemod/Dialog.h b/pokemod/Dialog.h
index 28f879cf..0869245e 100644
--- a/pokemod/Dialog.h
+++ b/pokemod/Dialog.h
@@ -51,9 +51,6 @@ namespace PokeGen
void InsertDialogCommand(const String &cmd, const unsigned pos);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String dialog;
};
diff --git a/pokemod/EggGroup.cpp b/pokemod/EggGroup.cpp
index 8556fd77..bf88a915 100644
--- a/pokemod/EggGroup.cpp
+++ b/pokemod/EggGroup.cpp
@@ -54,20 +54,6 @@ void PokeGen::PokeMod::EggGroup::Validate()
LogValidateOver("EggGroup", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::EggGroup::Validate(const wxListBox &output)
-{
- 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");
diff --git a/pokemod/EggGroup.h b/pokemod/EggGroup.h
index cde1846c..6774eb15 100644
--- a/pokemod/EggGroup.h
+++ b/pokemod/EggGroup.h
@@ -46,9 +46,6 @@ namespace PokeGen
String GetName() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
};
diff --git a/pokemod/Frac.cpp b/pokemod/Frac.cpp
index 9341e6a5..d252d416 100644
--- a/pokemod/Frac.cpp
+++ b/pokemod/Frac.cpp
@@ -28,12 +28,12 @@ PokeGen::PokeMod::Frac::Frac(const bool i) :
denom(1),
improper(i)
{
- Log("Frac: Initializing", PM_DEBUG_DEBUG);
+ Log::Write("Frac: Initializing", PM_DEBUG_DEBUG);
}
PokeGen::PokeMod::Frac::Frac(const unsigned n, const unsigned d, const bool i)
{
- Log(String("Frac: Initializing as %u/%u (%u)", n, d, i), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Initializing as %u/%u (%u)", n, d, i), PM_DEBUG_DEBUG);
Set(n, d, i);
}
@@ -43,24 +43,24 @@ void PokeGen::PokeMod::Frac::ImportIni(Ini &ini)
ini.GetValue("improper", improper, false);
ini.GetValue("num", num, 1);
ini.GetValue("denom", denom, 1);
- Log(String("Frac Import: Imported %u/%u", num, denom), PM_DEBUG_INFO);
+ Log::Write(String("Frac Import: Imported %u/%u", num, denom), PM_DEBUG_INFO);
}
void PokeGen::PokeMod::Frac::ExportIni(std::ofstream &fout, const String &val)
{
- Log(String("Frac Export: Starting %u/%u as %s", num, denom, val.c_str()), PM_DEBUG_INFO);
+ Log::Write(String("Frac Export: Starting %u/%u as %s", num, denom, val.c_str()), PM_DEBUG_INFO);
Reduce();
Ini exFrac(val);
exFrac.AddField("num", num);
exFrac.AddField("denom", denom);
exFrac.AddField("improper", improper);
exFrac.Export(fout);
- Log(String("Frac Export: Finished %u/%u as %s", num, denom, val.c_str()), PM_DEBUG_INFO);
+ Log::Write(String("Frac Export: Finished %u/%u as %s", num, denom, val.c_str()), PM_DEBUG_INFO);
}
void PokeGen::PokeMod::Frac::Set(const unsigned n, const unsigned d)
{
- Log(String("Frac: Setting to %u/%u", n, d), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Setting to %u/%u", n, d), PM_DEBUG_DEBUG);
SetDenom(d);
SetNum(n);
Reduce();
@@ -76,63 +76,63 @@ void PokeGen::PokeMod::Frac::SetNum(const unsigned n)
{
if ((n <= denom) || improper)
{
- Log(String("Frac: Setting numerator to %u (%u/%u)", n, n, denom), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Setting numerator to %u (%u/%u)", n, n, denom), PM_DEBUG_DEBUG);
num = n;
}
else
- Log(String("Frac: Setting tried to set numerator to %u when denominator is %u", n, denom), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Setting tried to set numerator to %u when denominator is %u", n, denom), PM_DEBUG_DEBUG);
}
void PokeGen::PokeMod::Frac::SetDenom(const unsigned d)
{
if (d)
{
- Log(String("Frac: Setting denominator to %u", d), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Setting denominator to %u", d), PM_DEBUG_DEBUG);
denom = d;
}
else
- Log("Frac: Attempting to set denominator to 0", PM_DEBUG_DEBUG);
+ Log::Write("Frac: Attempting to set denominator to 0", PM_DEBUG_DEBUG);
if ((num <= denom) && !improper)
{
- Log(String("Frac: Setting numerator to 1 after denominator reset to (%u)", d), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Setting numerator to 1 after denominator reset to (%u)", d), PM_DEBUG_DEBUG);
num = denom % num;
}
}
void PokeGen::PokeMod::Frac::SetImproper(const bool i)
{
- Log(String("Frac: Setting as %s", i ? "improper" : "proper"), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Setting as %s", i ? "improper" : "proper"), PM_DEBUG_DEBUG);
improper = i;
Set(num, denom);
}
unsigned PokeGen::PokeMod::Frac::GetNum() const
{
- Log(String("Frac: Fetching the numerator (%u)", num), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Fetching the numerator (%u)", num), PM_DEBUG_DEBUG);
return num;
}
unsigned PokeGen::PokeMod::Frac::GetDenom() const
{
- Log(String("Frac: Fetching the denominator (%u)", denom), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Fetching the denominator (%u)", denom), PM_DEBUG_DEBUG);
return denom;
}
bool PokeGen::PokeMod::Frac::GetImproper() const
{
- Log(String("Frac: Fetching improper (%u)", improper), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Fetching improper (%u)", improper), PM_DEBUG_DEBUG);
return improper;
}
float PokeGen::PokeMod::Frac::GetValue() const
{
- Log(String("Frac: Fetching the value (%f)", num / denom), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Fetching the value (%f)", num / denom), PM_DEBUG_DEBUG);
return (num / denom);
}
void PokeGen::PokeMod::Frac::Reduce()
{
- Log(String("Frac: Reducing %u/%u", num, denom), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Reducing %u/%u", num, denom), PM_DEBUG_DEBUG);
for (unsigned i = 2; i <= (num < denom ? num : denom); ++i)
{
while (!((num % i) || (denom % i)))
@@ -141,7 +141,7 @@ void PokeGen::PokeMod::Frac::Reduce()
denom /= i;
}
}
- Log(String("Frac: Reduced to %u/%u", num, denom), PM_DEBUG_DEBUG);
+ Log::Write(String("Frac: Reduced to %u/%u", num, denom), PM_DEBUG_DEBUG);
}
PokeGen::PokeMod::Frac::operator float() const
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp
index 8e123239..452f3deb 100644
--- a/pokemod/Item.cpp
+++ b/pokemod/Item.cpp
@@ -99,63 +99,6 @@ void PokeGen::PokeMod::Item::Validate()
LogValidateOver("Item", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Item::Validate(const wxListBox &output)
-{
- LogValidateStart("Item", id, name);
- if (name == "")
- {
- LogVarEmpty("Item", id, "name");
- output.Append(ConsoleLogVarEmpty("Item", id, "name"));
- isValid = false;
- }
- if (!pokemod->GetItemStorage(type))
- {
- LogVarNotValid("Item", id, "type", type, name);
- output.Append(ConsoleLogVarNotValid("Item", id, "type", type, name));
- isValid = false;
- }
- if (GetItemEffectCount())
- {
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> effectChecker;
- for (std::vector<ItemEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
- {
- LogSubmoduleIterate("Item", id, "effect", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++effectChecker[i->GetEffectString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Item", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateId("Item", id, "effect", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = effectChecker.begin(); i != effectChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Item", id, "effect", i->first, name);
- output.Append(LogDuplicateSubmodule("Item", id, "effect", i->first, name));
- isValid = false;
- }
- }
- }
- else
- {
- LogSubmoduleEmpty("Item", id, "effect", name);
- output.Append(ConsoleLogSubmoduleEmpty("Item", id, "effect", name));
- isValid = false;
- }
- LogValidateOver("Item", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::Item::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Item");
diff --git a/pokemod/Item.h b/pokemod/Item.h
index 4af8a4fa..7dbfea2c 100644
--- a/pokemod/Item.h
+++ b/pokemod/Item.h
@@ -65,9 +65,6 @@ namespace PokeGen
void DeleteItemEffect(const unsigned _id);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
bool sellable;
diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp
index b5f2fa6e..8e544778 100644
--- a/pokemod/ItemEffect.cpp
+++ b/pokemod/ItemEffect.cpp
@@ -53,11 +53,7 @@ PokeGen::PokeMod::ItemEffect::~ItemEffect()
LogDtor("ItemEffect", id);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::ItemEffect::Validate(const wxListBox &output)
-#else
void PokeGen::PokeMod::ItemEffect::Validate()
-#endif
{
LogValidateStart("ItemEffect", id);
// TODO (Validation#1#): ItemEffect Validation
diff --git a/pokemod/ItemEffect.h b/pokemod/ItemEffect.h
index 2ed2b09e..f9cfa3d1 100644
--- a/pokemod/ItemEffect.h
+++ b/pokemod/ItemEffect.h
@@ -74,9 +74,6 @@ namespace PokeGen
String GetVal5String() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
bool overworld;
bool battle;
diff --git a/pokemod/ItemStorage.cpp b/pokemod/ItemStorage.cpp
index 591f4d8d..4ce72cdd 100644
--- a/pokemod/ItemStorage.cpp
+++ b/pokemod/ItemStorage.cpp
@@ -61,26 +61,6 @@ void PokeGen::PokeMod::ItemStorage::Validate()
LogValidateOver("ItemStorage", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::ItemStorage::Validate(const wxListBox &output)
-{
- LogValidateStart("ItemStorage", id, name);
- if (name == "")
- {
- LogVarNotSet("ItemStorage", id, "name");
- output.Append(ConsoleLogVarNotSet("ItemStorage", id, "name"));
- isValid = false;
- }
- if (!player)
- {
- LogVarNotValid("ItemStorage", id, "player", name);
- output.Append(ConsoleLogVarNotValid("ItemStorage", id, "player", name));
- isValid = false;
- }
- LogValidateOver("ItemStorage", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::ItemStorage::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("ItemStorage");
diff --git a/pokemod/ItemStorage.h b/pokemod/ItemStorage.h
index 7e785224..722fc440 100644
--- a/pokemod/ItemStorage.h
+++ b/pokemod/ItemStorage.h
@@ -51,7 +51,7 @@ namespace PokeGen
private:
void Validate();
# ifdef POKEMODR
- void Validate(const wxListBox &output);
+ void Validate(wxListBox &output);
# endif
String name;
diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp
index 7e4eead6..42793c8d 100644
--- a/pokemod/Map.cpp
+++ b/pokemod/Map.cpp
@@ -228,209 +228,6 @@ void PokeGen::PokeMod::Map::Validate()
LogValidateOver("Map", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Map::Validate(const wxListBox &output)
-{
- LogValidateStart("Map", id, name);
- if (name == "")
- {
- LogVarNotSet("Map", id, "Name", name);
- output.Append(ConsoleLogVarNotSet("Map", id, "name", name));
- isValid = false;
- }
- if (!GetWarp(flyWarp))
- {
- LogVarNotValid("Map", id, "flyWarp", name);
- output.Append(ConsoleLogVarNotValid("Map", id, "flyWarp", name));
- isValid = false;
- }
- if ((MTY_NONE < type) && (type < MTY_END))
- {
- LogVarNotValid("Map", id, "type", name);
- output.Append(ConsoleLogVarNotValid("Map", id, "type", name));
- isValid = false;
- }
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> nameChecker;
- if (GetMapEffectCount())
- {
- for (std::vector<MapEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
- {
- LogSubmoduleIterate("Map", id, "effect", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- if (GetWidth() <= i->GetCoordinateX())
- {
- LogVarNotValid("MapEffect", i->GetId(), "x", i->GetName());
- isValid = false;
- }
- if (GetHeight() <= i->GetCoordinateY())
- {
- LogVarNotValid("MapEffect", i->GetId(), "y", i->GetName());
- isValid = false;
- }
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Map", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateId("Map", id, "effect", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Map", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Map", id, "effect", i->first, name));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Map", id, "effect", id, name);
- output.Append(ConsoleLogSubmoduleEmptyW("Map", id, "effect", name));
- }
- if (GetMapTrainerCount())
- {
- for (std::vector<MapTrainer>::iterator i = trainers.begin(); i != trainers.end(); ++i)
- {
- LogSubmoduleIterate("Map", id, "trainer", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- if (GetWidth() <= i->GetCoordinateX())
- {
- LogVarNotValid("MapTrainer", i->GetId(), "x", i->GetName());
- isValid = false;
- }
- if (GetHeight() <= i->GetCoordinateY())
- {
- LogVarNotValid("MapTrainer", i->GetId(), "y", i->GetName());
- isValid = false;
- }
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Map", id, "trainer", i->first, name);
- output.Append(ConsoleLogDuplicateId("Map", id, "trainer", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Map", id, "trainer", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Map", id, "trainer", i->first, name));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Map", id, "trainer", id, name);
- output.Append(ConsoleLogSubmoduleEmptyW("Map", id, "trainer", name));
- }
- if (GetMapWarpCount())
- {
- for (std::vector<MapWarp>::iterator i = warps.begin(); i != warps.end(); ++i)
- {
- LogSubmoduleIterate("Map", id, "warp", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- if (GetWidth() <= i->GetCoordinateX())
- {
- LogVarNotValid("MapWarp", i->GetId(), "x", i->GetName());
- isValid = false;
- }
- if (GetHeight() <= i->GetCoordinateY())
- {
- LogVarNotValid("MapWarp", i->GetId(), "y", i->GetName());
- isValid = false;
- }
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Map", id, "warp", i->first, name);
- output.Append(ConsoleLogDuplicateId("Map", id, "warp", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Map", id, "warp", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Map", id, "warp", i->first, name));
- isValid = false;
- }
- }
- idChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Map", id, "warp", id, name);
- output.Append(ConsoleLogSubmoduleEmpty("Map", id, "warp", name));
- isValid = false;
- }
- if (GetMapWildListCount())
- {
- for (std::vector<MapWildList>::iterator i = wildLists.begin(); i != wildLists.end(); ++i)
- {
- LogSubmoduleIterate("Map", id, "wild list", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Map", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateId("Map", id, "effect", i->first, name));
- isValid = false;
- }
- }
- idChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Map", id, "wild list", id, name);
- output.Append(ConsoleLogSubmoduleEmptyW("Map", id, "wild list", name));
- }
- for (unsigned i = 0; i < GetWidth(); ++i)
- {
- for (unsigned j = 0; j < GetHeight(); ++j)
- {
- if (!pokemod->GetTile(tiles[i][j]))
- {
- LogVarNotValid("Map", id, String("tiles[%u][%u]", i, j), name);
- output.Append(ConsoleLogVarNotValid("Map", id, String("tiles[%u][%u]", i, j), name));
- isValid = false;
- }
- }
- }
- LogValidateOver("Map", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::Map::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Map");
diff --git a/pokemod/Map.h b/pokemod/Map.h
index 5e738999..77b507b9 100644
--- a/pokemod/Map.h
+++ b/pokemod/Map.h
@@ -100,9 +100,6 @@ namespace PokeGen
void DeleteMapWildList(const unsigned _id);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
unsigned flyWarp;
diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp
index bcafce8d..92d8089e 100644
--- a/pokemod/MapEffect.cpp
+++ b/pokemod/MapEffect.cpp
@@ -121,88 +121,6 @@ void PokeGen::PokeMod::MapEffect::Validate()
LogValidateOver("MapEffect", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::MapEffect::Validate(const wxListBox &output)
-{
- LogValidateStart("MapEffect", id, name);
- if (name == "")
- {
- LogVarNotSet("MapEffect", id, "name");
- output.Append(ConsoleLogVarNotSet("MapEffect", id, "name"));
- isValid = false;
- }
- if (FV_END <= existFlag.GetStatus())
- {
- LogVarNotValid("MapEffect", id, "existFlag value", name);
- output.Append(ConsoleLogVarNotValid("MapEffect", id, "existFlag value", name));
- isValid = false;
- }
- if (!skin.DoesExist())
- {
- if (skin == "")
- {
- LogVarNotSet("MapEffect", id, "skin", name);
- output.Append(ConsoleLogVarNotSet("MapEffect", id, "skin", name));
- }
- else
- {
- LogVarNotValid("MapEffect", id, "skin", name);
- output.Append(ConsoleLogVarNotValid("MapEffect", id, "skin", name));
- }
- isValid = false;
- }
- if (MAPE_END <= effect)
- {
- LogVarNotValid("MapEffect", id, "effect", name);
- output.Append(ConsoleLogVarNotValid("MapEffect", id, "effect", name));
- isValid = false;
- }
- else
- {
- switch (effect)
- {
- case MAPE_ITEM:
- if (!pokemod->GetItem(val2))
- {
- LogVarNotValid("MapEffect", id, "val2", name);
- output.Append(ConsoleLogVarNotValid("MapEffect", id, "val2", name));
- isValid = false;
- }
- break;
- case MAPE_PC:
- if (PCT_END <= val2)
- {
- LogVarNotValid("MapEffect", id, "val2", name);
- output.Append(ConsoleLogVarNotValid("MapEffect", id, "val2", name));
- isValid = false;
- }
- break;
- case MAPE_STRENGTH_BLOCK:
- case MAPE_BUTTON:
- if (FV_END <= val2)
- {
- LogVarNotValid("MapEffect", id, "val2", name);
- output.Append(ConsoleLogVarNotValid("MapEffect", id, "val2", name));
- isValid = false;
- }
- }
- }
- if (DIR_END <= direction)
- {
- LogVarNotValid("MapEffect", id, "direction", name);
- output.Append(ConsoleLogVarNotValid("MapEffect", id, "direction", name));
- isValid = false;
- }
- if (!pokemod->GetDialog(dialog))
- {
- LogVarNotValid("MapEffect", id, "dialog", name);
- output.Append(ConsoleLogVarNotValid("MapEffect", id, "dialog", name));
- isValid = false;
- }
- LogValidateOver("MapEffect", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::MapEffect::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("MapEffect");
diff --git a/pokemod/MapEffect.h b/pokemod/MapEffect.h
index 09723529..12475956 100644
--- a/pokemod/MapEffect.h
+++ b/pokemod/MapEffect.h
@@ -89,9 +89,6 @@ namespace PokeGen
String GetDialogString() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
Point coordinate;
diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp
index 6c35a9f6..e1bbeab6 100644
--- a/pokemod/MapTrainer.cpp
+++ b/pokemod/MapTrainer.cpp
@@ -28,7 +28,8 @@ PokeGen::PokeMod::MapTrainer::MapTrainer(const Pokemod *par, const unsigned _id)
coordinate(0, 0),
skin(""),
sight(0),
- direction(UINT_MAX),
+ direction(UINT_MAX),
+ numFight(1),
ai(""),
appearFlag(0, 0),
overworldDialog(UINT_MAX),
@@ -63,25 +64,24 @@ void PokeGen::PokeMod::MapTrainer::Validate()
LogVarNotSet("MapTrainer", id, "name");
isValid = false;
}
- if (!skin.DoesExist())
- {
- if (skin == "")
- LogVarNotSet("MapTrainer", id, "skin", name);
- else
- LogVarNotValid("MapTrainer", id, "skin", name);
- isValid = false;
- }
+ if (!Path(pokemod->GetPath() + "skins/" + skin).DoesExist())
+ {
+ LogVarNotValid("MapTrainer", id, "skin", name);
+ isValid = false;
+ }
if (DIR_END_NONE <= direction)
{
LogVarNotValid("MapTrainer", id, "direction", name);
isValid = false;
+ }
+ if (!numFight || (pokemod->GetMaxFight() < numFight))
+ {
+ LogVarNotValid("MapTrainer", id, "maxFight", name);
+ isValid = false;
}
- if (!ai.DoesExist())
+ if (!Path(pokemod->GetPath() + "ai/" + ai).DoesExist())
{
- if (ai == "")
- LogVarNotSet("MapTrainer", id, "ai", name);
- else
- LogVarNotValid("MapTrainer", id, "ai", name);
+ LogVarNotValid("MapTrainer", id, "ai", name);
isValid = false;
}
if (!pokemod->GetDialog(overworldDialog))
@@ -131,104 +131,6 @@ void PokeGen::PokeMod::MapTrainer::Validate()
LogValidateOver("MapTrainer", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::MapTrainer::Validate(const wxListBox &output)
-{
- LogValidateStart("MapTrainer", id, name);
- if (name == "")
- {
- LogVarNotSet("MapTrainer", id, "name");
- output.Append(ConsoleLogVarNotSet("MapTrainer", id, "name"));
- isValid = false;
- }
- if (!skin.DoesExist())
- {
- if (skin == "")
- {
- LogVarNotSet("MapTrainer", id, "skin", name);
- output.Append(ConsoleLogVarNotSet("MapTrainer", id, "skin", name));
- }
- else
- {
- LogVarNotValid("MapTrainer", id, "skin", name);
- output.Append(ConsoleLogVarNotValid("MapTrainer", id, "skin", name));
- }
- isValid = false;
- }
- if (DIR_END_NONE <= direction)
- {
- LogVarNotValid("MapTrainer", id, "direction", name);
- output.Append(ConsoleLogVarNotValid("MapTrainer", id, "direction", name));
- isValid = false;
- }
- if (!ai.DoesExist())
- {
- if (ai == "")
- {
- LogVarNotSet("MapTrainer", id, "ai", name);
- output.Append(ConsoleLogVarNotSet("MapTrainer", id, "ai", name));
- }
- else
- {
- LogVarNotValid("MapTrainer", id, "ai", name);
- output.Append(ConsoleLogVarNotValid("MapTrainer", id, "ai", name));
- }
- isValid = false;
- }
- if (!pokemod->GetDialog(overworldDialog))
- {
- LogVarNotValid("MapTrainer", id, "overworldDialog", name);
- output.Append(ConsoleLogVarNotValid("MapTrainer", id, "overworldDialog", name));
- isValid = false;
- }
- if (!pokemod->GetDialog(winDialog))
- {
- LogVarNotValid("MapTrainer", id, "winDialog", name);
- output.Append(ConsoleLogVarNotValid("MapTrainer", id, "winDialog", name));
- isValid = false;
- }
- if (!pokemod->GetDialog(loseDialog))
- {
- LogVarNotValid("MapTrainer", id, "loseDialog", name);
- output.Append(ConsoleLogVarNotValid("MapTrainer", id, "loseDialog", name));
- isValid = false;
- }
- if (!GetMapTrainerTeam(leadPokemon))
- {
- LogVarNotValid("MapTrainer", id, "leadPokemon", name);
- output.Append(ConsoleLogVarNotValid("MapTrainer", id, "leadPokemon", name));
- isValid = false;
- }
- if (GetMapTrainerTeamCount())
- {
- std::map<unsigned, unsigned> idChecker;
- for (std::vector<MapTrainerTeam>::iterator i = team.begin(); i != team.end(); ++i)
- {
- LogSubmoduleIterate("MapTrainer", id, "team Pokémon", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecekr.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("MapTrainer", id, "team Pokémon", i->first, name);
- output.Append(ConsoleLogDuplicateId("MapTrainer", id, "team Pokémon", i->first, name));
- isValid = false;
- }
- }
- }
- else
- {
- LogSubmoduleEmpty("MapTrainer", id, "team Pokémon", name);
- output.Append(ConsoleLogSubmoduleEmpty("MapTrainer", id, "team Pokémon", name));
- isValid = false;
- }
- LogValidateOver("MapTrainer", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::MapTrainer::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("MapTrainer");
@@ -248,7 +150,8 @@ void PokeGen::PokeMod::MapTrainer::ImportIni(Ini &ini, const unsigned _id)
coordinate.Set(i, j);
ini.GetValue("skin", skin);
ini.GetValue("sight", sight, 0);
- ini.GetValue("direction", direction);
+ ini.GetValue("direction", direction);
+ ini.GetValue("numFight", numFight, 1);
ini.GetValue("ai", ai);
ini.GetValue("appearFlag-f", i, 0);
ini.GetValue("appearFlag-s", j, 0);
@@ -271,7 +174,8 @@ void PokeGen::PokeMod::MapTrainer::ExportIni(std::ofstream &fout, const String &
exMapTrainer.AddField("coordinate-y", coordinate.GetY());
exMapTrainer.AddField("skin", skin);
exMapTrainer.AddField("sight", sight);
- exMapTrainer.AddField("direction", direction);
+ exMapTrainer.AddField("direction", direction);
+ exMapTrainer.AddField("numFight", numFight);
exMapTrainer.AddField("ai", ai);
exMapTrainer.AddField("appearFlag-f", appearFlag.GetFlag());
exMapTrainer.AddField("appearFlag-s", appearFlag.GetStatus());
@@ -318,7 +222,8 @@ void PokeGen::PokeMod::MapTrainer::SetCoordinateY(const unsigned y)
void PokeGen::PokeMod::MapTrainer::SetSkin(const Path &s)
{
LogSetVar("MapTrainer", id, "skin", s, name);
- skin = s;
+ skin = s.GetFilename();
+ s.CopyTo(pokemod->GetPath() + "skins/" + skin);
}
void PokeGen::PokeMod::MapTrainer::SetSight(const unsigned s)
@@ -332,6 +237,13 @@ void PokeGen::PokeMod::MapTrainer::SetDirection(const unsigned d)
LogSetVar("MapTrainer", id, "direction", d, name);
if (d < DIR_END_NONE)
direction = d;
+}
+
+void PokeGen::PokeMod::MapTrainer::SetNumFight(const unsigned m)
+{
+ LogSetVar("MapTrainer", id, "maxFight", m, name);
+ if (m && (m <= pokemod->GetMaxFight()))
+ numFight = m;
}
void PokeGen::PokeMod::MapTrainer::SetDirection(const String &d)
@@ -342,7 +254,8 @@ void PokeGen::PokeMod::MapTrainer::SetDirection(const String &d)
void PokeGen::PokeMod::MapTrainer::SetAI(const Path &a)
{
LogSetVar("MapTrainer", id, "ai", a, name);
- ai = a;
+ ai = a.GetFilename();
+ a.CopyTo(pokemod->GetPath() + "ai/" + ai);
}
void PokeGen::PokeMod::MapTrainer::SetAppearFlag(const Flag &a)
@@ -413,11 +326,17 @@ unsigned PokeGen::PokeMod::MapTrainer::GetCoordinateY() const
return coordinate.GetY();
}
-PokeGen::PokeMod::Path PokeGen::PokeMod::MapTrainer::GetSkin() const
-{
- LogFetchVar("MapTrainer", id, "skin", skin, name);
- return skin;
-}
+bool PokeGen::PokeMod::MapTrainer::GetSkinExists() const
+{
+ LogFetchVar("MapTrainer", id, "skin exists", skin, name);
+ return GetSkin().DoesExist();
+}
+
+PokeGen::PokeMod::Path PokeGen::PokeMod::MapTrainer::GetSkin() const
+{
+ LogFetchVar("MapTrainer", id, "skins", skin, name);
+ return Path(pokemod->GetPath() + "skins/" + skin);
+}
unsigned PokeGen::PokeMod::MapTrainer::GetSight() const
{
@@ -430,6 +349,12 @@ unsigned PokeGen::PokeMod::MapTrainer::GetDirection() const
LogFetchVar("MapTrainer", id, "direction", direction, name);
return direction;
}
+
+unsigned PokeGen::PokeMod::MapTrainer::GetNumFight() const
+{
+ LogFetchVar("MapTrainer", id, "numFight", numFight, name);
+ return numFight;
+}
PokeGen::PokeMod::String PokeGen::PokeMod::MapTrainer::GetDirectionString() const
{
@@ -439,10 +364,16 @@ PokeGen::PokeMod::String PokeGen::PokeMod::MapTrainer::GetDirectionString() cons
return "";
}
+bool PokeGen::PokeMod::MapTrainer::GetAIExists() const
+{
+ LogFetchVar("MapTrainer", id, "ai exists", ai, name);
+ return GetAI().DoesExist();
+}
+
PokeGen::PokeMod::Path PokeGen::PokeMod::MapTrainer::GetAI() const
{
LogFetchVar("MapTrainer", id, "ai", ai, name);
- return ai;
+ return Path(pokemod->GetPath() + "ai/" + ai);
}
PokeGen::PokeMod::Flag PokeGen::PokeMod::MapTrainer::GetAppearFlag() const
diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h
index 2a5b3241..8d9cb782 100644
--- a/pokemod/MapTrainer.h
+++ b/pokemod/MapTrainer.h
@@ -56,7 +56,8 @@ namespace PokeGen
void SetSkin(const Path &s);
void SetSight(const unsigned s);
void SetDirection(const unsigned d);
- void SetDirection(const String &d);
+ void SetDirection(const String &d);
+ void SetNumFight(const unsigned n);
void SetAI(const Path &a);
void SetAppearFlag(const Flag &e);
void SetAppearFlag(const unsigned f, const unsigned s);
@@ -72,10 +73,13 @@ namespace PokeGen
Point GetCoordinate() const;
unsigned GetCoordinateX() const;
unsigned GetCoordinateY() const;
+ bool GetSkinExists() const;
Path GetSkin() const;
unsigned GetSight() const;
unsigned GetDirection() const;
- String GetDirectionString() const;
+ String GetDirectionString() const;
+ unsigned GetNumFight() const;
+ bool GetAIExists() const;
Path GetAI() const;
Flag GetAppearFlag() const;
unsigned GetAppearFlagFlag() const;
@@ -96,16 +100,14 @@ namespace PokeGen
void DeleteMapTrainerTeam(const unsigned _id);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
Point coordinate;
- Path skin;
+ String skin;
unsigned sight;
- unsigned direction;
- Path ai;
+ unsigned direction;
+ unsigned numFight;
+ String ai;
Flag appearFlag;
unsigned overworldDialog;
unsigned winDialog;
diff --git a/pokemod/MapTrainerTeam.cpp b/pokemod/MapTrainerTeam.cpp
index 6cdd8e03..2c9d42c4 100644
--- a/pokemod/MapTrainerTeam.cpp
+++ b/pokemod/MapTrainerTeam.cpp
@@ -25,8 +25,7 @@
PokeGen::PokeMod::MapTrainerTeam::MapTrainerTeam(const Pokemod *par, const unsigned _id) :
species(UINT_MAX),
- level(1),
- item(UINT_MAX)
+ level(1)
{
LogCtor("MapTrainerTeam", _id);
id = _id;
@@ -60,39 +59,46 @@ void PokeGen::PokeMod::MapTrainerTeam::Validate()
LogOutOfRange("MapTrainerTeam", id, "level", level, GetSpeciesString());
isValid = false;
}
- if (!pokemod->GetItem(item))
- {
- LogVarNotValid("MapTrainerTeam", id, "item");
- isValid = false;
- }
- LogValidateOver("MapTrainerTeam", id, isValid, GetSpeciesString());
-}
-
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::MapTrainerTeam::Validate(const wxListBox &output)
-{
- LogValidateStart("MapTrainerTeam", id);
- if (!pokemod->GetPokemon(species))
- {
- LogVarNotValid("MapTrainerTeam", id, "species", species);
- output.Append(ConsoleLogVarNotValid("MapTrainerTeam", id, "species", species));
- isValid = false;
- }
- if (pokemod->GetMaxLevel() <= level)
- {
- LogVarOutOfRange("MapTrainerTeam", id, "level", level, GetSpeciesString());
- output.Append(ConsoleLogVarOutOfRange("MapTrainerTeam", id, "level", level, GetSpeciesString()));
- isValid = false;
- }
- if (!pokemod->GetItem(item))
- {
- LogVarNotValid("MapTrainerTeam", id, "item", item);
- output.Append(ConsoleLogVarNotValid("MapTrainerTeam", id, "item", item));
- isValid = false;
- }
+ if (GetItemCount() <= pokemod->GetHoldItems())
+ {
+ std::map<unsigned, unsigned> idChecker;
+ std::map<String, unsigned> itemChecker;
+ for (std::vector<unsigned>::const_iterator i = items.begin(); i != items.end(); ++i)
+ {
+ if (!pokemod->GetItem(*i))
+ {
+ LogVarNotValid("MapTrainerTeam", id, "item");
+ isValid = false;
+ }
+ ++idChecker[*i];
+ ++itemChecker[pokemod->GetItem(*i)->GetName()];
+ }
+ for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
+ {
+ if (1 < i->second)
+ {
+ LogDuplicateId("MapTrainerTeam", id, "item", i->first);
+ isValid = false;
+ }
+ }
+ for (std::map<String, unsigned>::const_iterator i = itemChecker.begin(); i != itemChecker.end(); ++i)
+ {
+ if (1 < i->second)
+ {
+ LogDuplicateSubmodule("MapTrainerTeam", id, "item", i->first);
+ isValid = false;
+ }
+ }
+ }
+ else if (GetItemCount())
+ {
+ Log::Write(String("MapTrainerTeam Validation: Too many held items in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ else
+ LogSubmoduleEmpty("MapTrainerTeam", id, "item");
LogValidateOver("MapTrainerTeam", id, isValid, GetSpeciesString());
}
-#endif
void PokeGen::PokeMod::MapTrainerTeam::ImportIni(Ini &ini, const unsigned _id)
{
@@ -104,10 +110,19 @@ void PokeGen::PokeMod::MapTrainerTeam::ImportIni(Ini &ini, const unsigned _id)
LogIdNotFound("MapTrainerTeam");
}
else
- id = _id;
+ id = _id;
+ unsigned i;
+ unsigned j;
+ items.clear();
ini.GetValue("species", species);
- ini.GetValue("level", level, 1);
- ini.GetValue("item", item);
+ ini.GetValue("level", level, 1);
+ ini.GetValue("numItems", i, 0);
+ for (unsigned k = 0; k < i; ++k)
+ {
+ ini.GetValue(String("item-%u", k), j);
+ if (k != UINT_MAX)
+ items.push_back(j);
+ }
LogImportOver("MapTrainerTeam", id);
}
@@ -117,8 +132,10 @@ void PokeGen::PokeMod::MapTrainerTeam::ExportIni(std::ofstream &fout, const Stri
Ini exMapTrainerTeam(String("MapTrainerTeam %u ", trainerId) + map);
exMapTrainerTeam.AddField("id", id);
exMapTrainerTeam.AddField("species", species);
- exMapTrainerTeam.AddField("level", level);
- exMapTrainerTeam.AddField("item", item);
+ exMapTrainerTeam.AddField("level", level);
+ exMapTrainerTeam.AddField("numItems", GetItemCount());
+ for (unsigned i = 0; i < GetItemCount(); ++i)
+ exMapTrainerTeam.AddField(String("item-%u", i), items[i]);
exMapTrainerTeam.Export(fout);
LogExportOver("MapTrainerTeam", id);
}
@@ -144,20 +161,6 @@ void PokeGen::PokeMod::MapTrainerTeam::SetLevel(const unsigned l)
level = l;
}
-void PokeGen::PokeMod::MapTrainerTeam::SetItem(const unsigned i)
-{
- LogSetVar("MapTrainerTeam", id, "item", i, GetSpeciesString());
- if (pokemod->GetItem(i))
- item = i;
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::SetItem(const String &i)
-{
- LogSetVar("MapTrainerTeam", id, "item string", i, GetSpeciesString());
- if (const Item *temp = pokemod->GetItem(i))
- item = temp->GetId();
-}
-
unsigned PokeGen::PokeMod::MapTrainerTeam::GetSpecies() const
{
LogFetchVar("MapTrainerTeam", id, "speceis", species);
@@ -178,16 +181,66 @@ unsigned PokeGen::PokeMod::MapTrainerTeam::GetLevel() const
return level;
}
-unsigned PokeGen::PokeMod::MapTrainerTeam::GetItem() const
-{
- LogFetchVar("MapTrainerTeam", id, "item", item, GetSpeciesString());
- return item;
-}
-
-PokeGen::PokeMod::String PokeGen::PokeMod::MapTrainerTeam::GetItemString() const
-{
- LogFetchVar("MapTrainerTeam", id, "item string", item, GetSpeciesString());
- if (const Item *i = pokemod->GetItem(item))
- i->GetName();
- return "";
-}
+unsigned PokeGen::PokeMod::MapTrainerTeam::GetItem(const unsigned i) const
+{
+ LogSubmoduleFetch("MapTrainerTeam", id, "item", i);
+ if (i < GetItemCount() <= i)
+ return items[i];
+ LogSubmoduleFetchFail("MapTrainerTeam", id, "item", i);
+ return UINT_MAX;
+}
+
+unsigned PokeGen::PokeMod::MapTrainerTeam::GetItemCount() const
+{
+ LogSubmoduleCount("MapTrainerTeam", id, "item");
+ return items.size();
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::NewItem(const unsigned i)
+{
+ LogSubmoduleNew("MapTrainerTeam", id, "item", i);
+ if ((GetItemCount() < pokemod->GetHoldItems()) && pokemod->GetItem(i))
+ items.push_back(i);
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::NewItem(const String &n)
+{
+ LogSubmoduleNew("MapTrainerTeam", id, "item", n);
+ if (GetItemCount() < pokemod->GetHoldItems())
+ {
+ if (const Item *i = pokemod->GetItem(n))
+ items.push_back(i->GetId());
+ }
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::DeleteItem(const unsigned i)
+{
+ LogSubmoduleRemoveStart("MapTrainerTeam", id, "item", i);
+ if (i < GetItemCount())
+ DeleteItemByID(items[i]);
+ else
+ LogSubmoduleRemoveFail("MapTrainerTeam", id, "item", i);
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::DeleteItem(const String &n)
+{
+ LogSubmoduleRemoveStart("MapTrainerTeam", id, "item", n);
+ if (const Item *i = pokemod->GetItem(n))
+ DeleteItemByID(i->GetId());
+ else
+ LogSubmoduleRemoveFail("MapTrainerTeam", id, "item", n);
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::DeleteItemByID(const unsigned _id)
+{
+ LogSubmoduleRemoveStart("MapTrainerTeam", id, "item", _id);
+ for (std::vector<unsigned>::iterator i = items.begin(); i != items.end(); ++i)
+ {
+ if (*i == _id)
+ {
+ LogSubmoduleRemoved("MapTrainerTeam", id, "item", _id);
+ items.erase(i);
+ }
+ }
+ LogSubmoduleRemoveFail("MapTrainerTeam", id, "item", _id);
+}
diff --git a/pokemod/MapTrainerTeam.h b/pokemod/MapTrainerTeam.h
index fdf5fe4f..80fdc014 100644
--- a/pokemod/MapTrainerTeam.h
+++ b/pokemod/MapTrainerTeam.h
@@ -23,7 +23,8 @@
#ifndef __POKEMOD_MAPTRAINERTEAM__
#define __POKEMOD_MAPTRAINERTEAM__
-
+
+#include <vector>
#include "Object.h"
#include "String.h"
#include "Pokemod.h"
@@ -47,23 +48,24 @@ namespace PokeGen
void SetSpecies(const unsigned s);
void SetSpecies(const String &s);
void SetLevel(const unsigned l);
- void SetItem(const unsigned i);
- void SetItem(const String &i);
unsigned GetSpecies() const;
String GetSpeciesString() const;
unsigned GetLevel() const;
- unsigned GetItem() const;
- String GetItemString() const;
+
+ unsigned GetItem(const unsigned i) const;
+ unsigned GetItemCount() const;
+ void NewItem(const unsigned i);
+ void NewItem(const String &n);
+ void DeleteItem(const unsigned i);
+ void DeleteItem(const String &n);
+ void DeleteItemByID(const unsigned i);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
unsigned species;
unsigned level;
- unsigned item;
+ std::vector<unsigned> items;
};
}
}
diff --git a/pokemod/MapWarp.cpp b/pokemod/MapWarp.cpp
index eb366464..5098a86d 100644
--- a/pokemod/MapWarp.cpp
+++ b/pokemod/MapWarp.cpp
@@ -33,7 +33,8 @@ PokeGen::PokeMod::MapWarp::MapWarp(const Pokemod *par, const unsigned _id) :
directionOut(UINT_MAX),
warpType(UINT_MAX),
isBiking(false),
- isFlash(false),
+ isFlash(false),
+ isFoggy(false),
toMap(UINT_MAX),
toWarp(UINT_MAX),
workingFlag(0, 0),
@@ -102,59 +103,6 @@ void PokeGen::PokeMod::MapWarp::Validate()
LogValidateOver("MapWarp", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::MapWarp::Validate(const wxListBox &output)
-{
- LogValidateStart("MapWarp", id, name);
- if (name == "")
- {
- LogVarNotSet("MapWarp", id, "name");
- output.Append(ConsoleLogVarNotSet("MapWarp", id, "name"));
- isValid = false;
- }
- if (!fromUp && !fromDown && !fromLeft && !fromRight)
- {
- LogVarNotSet("MapWarp", id, "directions", name);
- output.Append(ConsoleLogVarNotSet("MapWarp", id, "directions", name));
- isValid = false;
- }
- if (DIR_END_NONE <= directionOut)
- {
- LogVarNotValid("MapWarp", id, "directionOut", name);
- output.Append(ConsoleLogVarNotValid("MapWarp", id, "directionOut", name));
- isValid = false;
- }
- if (WT_END <= warpType)
- {
- LogVarNotValid("MapWarp", id, "warpType", name);
- output.Append(ConsoleLogVarNotValid("MapWarp", id, "warpType", name));
- isValid = false;
- }
- if (const Map *m = pokemod->GetMap(toMap))
- {
- if (!m->GetMapWarp(toWarp))
- {
- LogVarNotValid("MapWarp", id, "toWarp");
- output.Append(ConsoleLogVarNotValid("MapWarp", id, "toWarp"));
- isValid = false;
- }
- }
- else
- {
- LogVarNotValid("MapWarp", id, "toMap");
- output.Append(ConsoleLogVarNotValid("MapWarp", id, "toMap"));
- isValid = false;
- }
- if (!pokemod->GetDialog(dialog))
- {
- LogVarNotValid("MapWarp", id, "dialog");
- output.Append(ConsoleLogVarNotValid("MapWarp", id, "dialog"));
- isValid = false;
- }
- LogValidateOver("MapWarp", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::MapWarp::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("MapWarp");
@@ -180,6 +128,7 @@ void PokeGen::PokeMod::MapWarp::ImportIni(Ini &ini, const unsigned _id)
ini.GetValue("warpType", warpType);
ini.GetValue("isBiking", isBiking, false);
ini.GetValue("isFlash", isFlash, false);
+ ini.GetValue("isFoggy", isFoggy, false);
ini.GetValue("toMap", toMap);
ini.GetValue("toWarp", toWarp);
ini.GetValue("workingFlag-f", i, 0);
@@ -203,7 +152,8 @@ void PokeGen::PokeMod::MapWarp::ExportIni(std::ofstream &fout, const String &map
exMapWarp.AddField("directionOut", directionOut);
exMapWarp.AddField("warpType", warpType);
exMapWarp.AddField("isBiking", isBiking);
- exMapWarp.AddField("isFlash", isFlash);
+ exMapWarp.AddField("isFlash", isFlash);
+ exMapWarp.AddField("isFoggy", isFoggy);
exMapWarp.AddField("toMap", toMap);
exMapWarp.AddField("toWarp", toWarp);
exMapWarp.AddField("workingFlag-f", workingFlag.GetFlag());
@@ -303,6 +253,12 @@ void PokeGen::PokeMod::MapWarp::SetIsFlash(const bool i)
isFlash = i;
}
+void PokeGen::PokeMod::MapWarp::SetIsFoggy(const bool i)
+{
+ LogSetVar("MapWarp", id, "isFoggy", i, name);
+ isFoggy = i;
+}
+
void PokeGen::PokeMod::MapWarp::SetToMap(const unsigned t)
{
LogSetVar("MapWarp", id, "toMap", t, name);
@@ -467,6 +423,12 @@ bool PokeGen::PokeMod::MapWarp::GetIsFlash() const
return isFlash;
}
+bool PokeGen::PokeMod::MapWarp::GetIsFoggy() const
+{
+ LogFetchVar("MapWarp", id, "isFoggy", isFoggy, name);
+ return isFoggy;
+}
+
unsigned PokeGen::PokeMod::MapWarp::GetToMap() const
{
LogFetchVar("MapWarp", id, "toMap", toMap, name);
diff --git a/pokemod/MapWarp.h b/pokemod/MapWarp.h
index f3336b11..220057ad 100644
--- a/pokemod/MapWarp.h
+++ b/pokemod/MapWarp.h
@@ -59,7 +59,8 @@ namespace PokeGen
void SetWarpType(const unsigned w);
void SetWarpType(const String &w);
void SetIsBiking(const bool i);
- void SetIsFlash(const bool i);
+ void SetIsFlash(const bool i);
+ void SetIsFoggy(const bool i);
void SetToMap(const unsigned t);
void SetToMap(const String &t);
void SetToWarp(const unsigned t);
@@ -84,7 +85,8 @@ namespace PokeGen
unsigned GetWarpType() const;
String GetWarpTypeString() const;
bool GetIsBiking() const;
- bool GetIsFlash() const;
+ bool GetIsFlash() const;
+ bool GetIsFoggy() const;
unsigned GetToMap() const;
String GetToMapString() const;
unsigned GetToWarp() const;
@@ -97,9 +99,6 @@ namespace PokeGen
String GetDialogString() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
Point coordinate;
@@ -110,7 +109,8 @@ namespace PokeGen
unsigned directionOut;
unsigned warpType;
bool isBiking;
- bool isFlash;
+ bool isFlash;
+ bool isFoggy;
unsigned toMap;
unsigned toWarp;
Flag workingFlag;
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
index 2be529f0..ff66134e 100644
--- a/pokemod/MapWildList.cpp
+++ b/pokemod/MapWildList.cpp
@@ -47,11 +47,7 @@ PokeGen::PokeMod::MapWildList::~MapWildList()
LogDtor("MapWildList", id);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::MapWildList::Validate(const wxListBox &output)
-#else
void PokeGen::PokeMod::MapWildList::Validate()
-#endif
{
LogValidateStart("MapWildList", id);
unsigned i = 0;
diff --git a/pokemod/MapWildList.h b/pokemod/MapWildList.h
index 82e20f6d..762d455b 100644
--- a/pokemod/MapWildList.h
+++ b/pokemod/MapWildList.h
@@ -65,9 +65,6 @@ namespace PokeGen
void DeleteMapWildPokemon(const unsigned _id);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
unsigned control;
unsigned value;
diff --git a/pokemod/MapWildPokemon.cpp b/pokemod/MapWildPokemon.cpp
index ef77ad0e..11b12708 100644
--- a/pokemod/MapWildPokemon.cpp
+++ b/pokemod/MapWildPokemon.cpp
@@ -68,32 +68,6 @@ void PokeGen::PokeMod::MapWildPokemon::Validate()
LogValidateOver("MapWildPokemon", id, isValid, GetPokemonString());
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::MapWildPokemon::Validate(const wxListBox &output)
-{
- LogValidateStart("MapWildPokemon", id, GetPokemonString());
- if (!pokemod->GetPokemon(pokemon))
- {
- LogVarNotValid("MapWildPokemon", id, "pokemon");
- output.Append(ConsoleLogVarNotValid("MapWildPokemon", id, "pokemon"));
- isValid = false;
- }
- if (pokemod->GetMaxLevel() <= level)
- {
- LogVarNotValid("MapWildPokemon", id, "level", GetPokemonString());
- output.Append(ConsoleLogVarNotValid("MapWildPokemon", id, "level", GetPokemonString()));
- isValid = false;
- }
- if (!weight)
- {
- LogVarNotValid("MapWildPokemon", id, "weight", GetPokemonString());
- output.Append(ConsoleLogVarNotValid("MapWildPokemon", id, "weight", GetPokemonString()));
- isValid = false;
- }
- LogValidateOver("MapWildPokemon", id, isValid, GetPokemonString());
-}
-#endif
-
void PokeGen::PokeMod::MapWildPokemon::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("MapWildPokemon");
diff --git a/pokemod/MapWildPokemon.h b/pokemod/MapWildPokemon.h
index 3563497e..d6e02e98 100644
--- a/pokemod/MapWildPokemon.h
+++ b/pokemod/MapWildPokemon.h
@@ -54,9 +54,6 @@ namespace PokeGen
unsigned GetWeight() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
unsigned pokemon;
unsigned level;
diff --git a/pokemod/Matrix.h b/pokemod/Matrix.h
index 7b78bcec..427f946c 100644
--- a/pokemod/Matrix.h
+++ b/pokemod/Matrix.h
@@ -24,7 +24,8 @@
#ifndef __POKEMOD_MATRIX__
#define __POKEMOD_MATRIX__
-#include <vector>
+#include <vector>
+#include "Debug.h"
#include "Point.h"
#include "Frac.h"
#include "Ini.h"
@@ -197,7 +198,7 @@ namespace PokeGen
}
void ExportIni(std::ofstream &fout, const String &val) const
{
- Log(String("Matrix Export: Starting %s", val.c_str()), PM_DEBUG_INFO);
+ Log::Write(String("Matrix Export: Starting %s", val.c_str()), PM_DEBUG_INFO);
// Declare the elements
Ini exMatrix(val);
exMatrix.AddField("height", MatrixBase<T>::height);
@@ -207,7 +208,7 @@ namespace PokeGen
for (unsigned j = 0; j < MatrixBase<T>::height; ++j)
exMatrix.AddField(String("Element-%d-%d", i, j), MatrixBase<T>::matrix[i][j]);
}
- Log(String("Matrix Export: Finished %s", val.c_str()), PM_DEBUG_INFO);
+ Log::Write(String("Matrix Export: Finished %s", val.c_str()), PM_DEBUG_INFO);
}
};
@@ -255,7 +256,7 @@ namespace PokeGen
}
void ExportIni(std::ofstream &fout, const String &val) const
{
- Log(String("Matrix Export: Starting %s", val.c_str()), PM_DEBUG_INFO);
+ Log::Write(String("Matrix Export: Starting %s", val.c_str()), PM_DEBUG_INFO);
// Declare the elements
Ini exMatrix(val);
exMatrix.AddField("height", MatrixBase<Frac>::height);
@@ -270,7 +271,7 @@ namespace PokeGen
}
}
exMatrix.Export(fout);
- Log(String("Matrix Export: Finished %s", val.c_str()), PM_DEBUG_INFO);
+ Log::Write(String("Matrix Export: Finished %s", val.c_str()), PM_DEBUG_INFO);
}
};
}
diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp
index 8634ddb0..43b0b062 100644
--- a/pokemod/Move.cpp
+++ b/pokemod/Move.cpp
@@ -35,11 +35,6 @@ PokeGen::PokeMod::Move::Move(const Pokemod *par, const unsigned _id) :
ignoreFlinch(false),
sound(false),
description(""),
- contestType(UINT_MAX),
- contestPoints(0),
- jamPoints(0),
- contestEffect(UINT_MAX),
- contestTarget(UINT_MAX)
{
LogCtor("Move", _id);
id = _id;
@@ -94,29 +89,6 @@ void PokeGen::PokeMod::Move::Validate()
LogVarNotValid("Move", id, "targetChoice", name);
isValid = false;
}
- if (pokemod->IsContestAllowed())
- {
- if (COTY_END <= contestType)
- {
- LogVarNotValid("Move", id, "contestType", name);
- isValid = false;
- }
- if (!contestPoints)
- {
- LogVarNotValid("Move", id, "contestPoints", name);
- isValid = false;
- }
- if (CONE_END <= contestEffect)
- {
- LogVarNotValid("Move", id, "contestEffect", name);
- isValid = false;
- }
- if (CONT_END <= contestTarget)
- {
- LogVarNotValid("Move", id, "contestTarget", name);
- isValid = false;
- }
- }
if (GetMoveEffectCount())
{
std::map<unsigned, unsigned> idChecker;
@@ -154,114 +126,6 @@ void PokeGen::PokeMod::Move::Validate()
LogValidateOver("Move", id, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Move::Validate(const wxListBox &output)
-{
- LogValidateStart("Move", id, name);
- if (name == "")
- {
- LogVarNotSet("Move", id, "name");
- output.Append(ConsoleLogVarNotSet("Move", id, "name"););
- isValid = "";
- }
- if (!pokemod->GetType(type))
- {
- LogVarNotValid("Move", id, "type", name);
- output.Append(ConsoleLogVarNotValid("Move", id, "type", name));
- isValid = false;
- }
- if (!powerPoints)
- {
- LogVarNotValid("Move", id, "powerPoints", name);
- output.Append(ConsoleLogVarNotValid("Move", id, "powerPoints", name));
- isValid = false;
- }
- if (TAR_END <= target)
- {
- LogVarNotValid("Move", id, "target", name);
- output.Append(ConsoleLogVarNotValid("Move", id, "target", name));
- isValid = false;
- }
- if (!targets || (pokemod->GetMaxFight() << 1) < numTargets)
- {
- LogVarNotValid("Move", id, "numTargets", name);
- output.Append(ConsoleLogVarNotValid("Move", id, "numTargets", name));
- isValid = false;
- }
- if (CHC_END <= targetChoice)
- {
- LogVarNotValid("Move", id, "targetChoice", name);
- output.Append(ConsoleLogVarNotValid("Move", id, "targetChoice", name));
- isValid = false;
- }
- if (pokemod->IsContestAllowed())
- {
- if (COTY_END <= contestType)
- {
- LogVarNotValid("Move", id, "contestType", name);
- output.Append(ConsoleLogVarNotValid("Move", id, "contestType", name));
- isValid = false;
- }
- if (!contestPoints)
- {
- LogVarNotValid("Move", id, "contestPoints", name);
- output.Append(ConsoleLogVarNotValid("Move", id, "contestPoints", name));
- isValid = false;
- }
- if (CONE_END <= contestEffect)
- {
- LogVarNotValid("Move", id, "contestEffect", name);
- output.Append(ConsoleLogVarNotValid("Move", id, "contestEffect", name));
- isValid = false;
- }
- if (CONT_END <= contestTarget)
- {
- LogVarNotValid("Move", id, "contestTarget", name);
- output.Append(ConsoleLogVarNotValid("Move", id, "contestTarget", name));
- isValid = false;
- }
- }
- if (GetMoveEffectCount())
- {
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> effectChecker;
- for (std::vector<MoveEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
- {
- LogSubmoduleIterate("Move", id, "effect", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++effectChecker[i->GetEffectString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Move", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateId("Move", id, "effect", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = effectChecker.begin(); i != effectChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Move", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Move", id, "effect", i->first, name));
- isValid = false;
- }
- }
- }
- else
- {
- LogSubmoduleEmpty("Move", id, "effect", name);
- output.Append(ConsoleLogSubmoduleEmpty("Move", id, "effect", name));
- isValid = false;
- }
- LogValidateOver("Move", id, move);
-}
-#endif
-
void PokeGen::PokeMod::Move::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Move");
@@ -290,11 +154,6 @@ void PokeGen::PokeMod::Move::ImportIni(Ini &ini, const unsigned _id)
ini.GetValue("ignoreFlinch", ignoreFlinch, false);
ini.GetValue("sound", sound, false);
ini.GetValue("description", description, "");
- ini.GetValue("contestType", contestType);
- ini.GetValue("contestPoints", contestPoints, 0);
- ini.GetValue("jamPoints", jamPoints, 0);
- ini.GetValue("contestEffect", contestEffect);
- ini.GetValue("contestTarget", contestTarget);
LogImportOver("Move", id, name);
}
@@ -317,11 +176,6 @@ void PokeGen::PokeMod::Move::ExportIni(std::ofstream &fout) const
exMove.AddField("ignoreFlinch", ignoreFlinch);
exMove.AddField("sound", sound);
exMove.AddField("description", description);
- exMove.AddField("contestType", contestPoints);
- exMove.AddField("contestPoints", contestPoints);
- exMove.AddField("jamPoints", jamPoints);
- exMove.AddField("contestEffect", contestEffect);
- exMove.AddField("contestTarget", contestTarget);
for (std::vector<MoveEffect>::const_iterator i = effects.begin(); i != effects.end(); ++i)
i->ExportIni(fout, name);
LogExportOver("Move", id, name);
@@ -446,48 +300,6 @@ void PokeGen::PokeMod::Move::SetContestType(const unsigned c)
contestType = c;
}
-void PokeGen::PokeMod::Move::SetContestType(const String &c)
-{
- SetContestType(FindIn(COTY_END, c, ContestTypeStr));
-}
-
-void PokeGen::PokeMod::Move::SetContestPoints(const int c)
-{
- LogSetVar("Move", id, "contestPoints", c, name);
- if (c)
- contestPoints = c;
-}
-
-void PokeGen::PokeMod::Move::SetJamPoints(const int j)
-{
- LogSetVar("Move", id, "jamPoints", j, name);
- jamPoints = j;
-}
-
-void PokeGen::PokeMod::Move::SetContestEffect(const unsigned c)
-{
- LogSetVar("Move", id, "contestEffect", c, name);
- if (c < CONE_END)
- contestEffect = c;
-}
-
-void PokeGen::PokeMod::Move::SetContestEffect(const String &c)
-{
- SetContestEffect(FindIn(CONE_END, c, ContestEffectStr));
-}
-
-void PokeGen::PokeMod::Move::SetContestTarget(const unsigned c)
-{
- LogSetVar("Move", id, "contestTarget", c, name);
- if (c < CONT_END)
- contestTarget = c;
-}
-
-void PokeGen::PokeMod::Move::SetContestTarget(const String &c)
-{
- SetContestTarget(FindIn(CONT_END, c, ContestTargetStr));
-}
-
PokeGen::PokeMod::String PokeGen::PokeMod::Move::GetName() const
{
LogFetchVar("Move", id, "name", name);
@@ -596,60 +408,6 @@ PokeGen::PokeMod::String PokeGen::PokeMod::Move::GetDescription() const
return description;
}
-unsigned PokeGen::PokeMod::Move::GetContestType() const
-{
- LogFetchVar("Move", id, "contestType", contestType, name);
- return contestType;
-}
-
-PokeGen::PokeMod::String PokeGen::PokeMod::Move::GetContestTypeString() const
-{
- LogFetchVar("Move", id, "contestType string", contestType, name);
- if (contestType < COTY_END)
- return ContestTypeStr[contestType];
- return "";
-}
-
-int PokeGen::PokeMod::Move::GetContestPoints() const
-{
- LogFetchVar("Move", id, "contestPoints", contestPoints, name);
- return contestPoints;
-}
-
-int PokeGen::PokeMod::Move::GetJamPoints() const
-{
- LogFetchVar("Move", id, "jamPoints", jamPoints, name);
- return jamPoints;
-}
-
-unsigned PokeGen::PokeMod::Move::GetContestEffect() const
-{
- LogFetchVar("Move", id, "contestEffect", contestEffect, name);
- return contestEffect;
-}
-
-PokeGen::PokeMod::String PokeGen::PokeMod::Move::GetContestEffectString() const
-{
- LogFetchVar("Move", id, "contestEffect string", contestEffect, name);
- if (contestEffect < CONE_END)
- return ContestEffectStr[contestEffect];
- return "";
-}
-
-unsigned PokeGen::PokeMod::Move::GetContestTarget() const
-{
- LogFetchVar("Move", id, "contestTarget", contestTarget, name);
- return contestTarget;
-}
-
-PokeGen::PokeMod::String PokeGen::PokeMod::Move::GetContestTargetString() const
-{
- LogFetchVar("Move", id, "contestTarget string", contestTarget, name);
- if (contestTarget < CONT_END)
- return ContestTargetStr[contestTarget];
- return "";
-}
-
const PokeGen::PokeMod::MoveEffect *PokeGen::PokeMod::Move::GetMoveEffect(unsigned _id) const
{
LogSubmoduleFetch("Move", id, "effect", _id, name);
diff --git a/pokemod/Move.h b/pokemod/Move.h
index 1509a496..fa28261c 100644
--- a/pokemod/Move.h
+++ b/pokemod/Move.h
@@ -62,14 +62,6 @@ namespace PokeGen
void SetIgnoreFlinch(const bool i);
void SetSound(const bool s);
void SetDescription(const String &d);
- void SetContestType(const unsigned c);
- void SetContestType(const String &c);
- void SetContestPoints(const int c);
- void SetJamPoints(const int j);
- void SetContestEffect(const unsigned c);
- void SetContestEffect(const String &c);
- void SetContestTarget(const unsigned c);
- void SetContestTarget(const String &c);
String GetName() const;
Frac GetAccuracy() const;
@@ -88,14 +80,6 @@ namespace PokeGen
bool GetIgnoreFlinch() const;
bool GetSound() const;
String GetDescription() const;
- unsigned GetContestType() const;
- String GetContestTypeString() const;
- int GetContestPoints() const;
- int GetJamPoints() const;
- unsigned GetContestEffect() const;
- String GetContestEffectString() const;
- unsigned GetContestTarget() const;
- String GetContestTargetString() const;
const MoveEffect *GetMoveEffect(unsigned _id) const;
unsigned GetMoveEffectCount() const;
@@ -103,9 +87,6 @@ namespace PokeGen
void DeleteMoveEffect(unsigned _id);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
Frac accuracy;
@@ -120,11 +101,6 @@ namespace PokeGen
bool ignoreFlinch;
bool sound;
String description;
- unsigned contestType;
- int contestPoints;
- int jamPoints;
- unsigned contestEffect;
- unsigned contestTarget;
std::vector<MoveEffect> effects;
};
diff --git a/pokemod/MoveEffect.cpp b/pokemod/MoveEffect.cpp
index e3dc82f6..388ed6c3 100644
--- a/pokemod/MoveEffect.cpp
+++ b/pokemod/MoveEffect.cpp
@@ -46,11 +46,7 @@ PokeGen::PokeMod::MoveEffect::~MoveEffect()
LogDtor("MoveEffect", id);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::MoveEffect::Validate(const wxListBox &output)
-#else
void PokeGen::PokeMod::MoveEffect::Validate()
-#endif
{
LogValidateStart("MoveEffect", id);
// TODO (Validation#1#): MoveEffect Validation
diff --git a/pokemod/MoveEffect.h b/pokemod/MoveEffect.h
index 3f64a6ce..4dcc7576 100644
--- a/pokemod/MoveEffect.h
+++ b/pokemod/MoveEffect.h
@@ -63,9 +63,6 @@ namespace PokeGen
String GetVal2String() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
Frac chance;
unsigned effect;
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp
index 519a9e1c..fdc724a5 100644
--- a/pokemod/Nature.cpp
+++ b/pokemod/Nature.cpp
@@ -24,9 +24,11 @@
#include "Nature.h"
PokeGen::PokeMod::Nature::Nature(const Pokemod *par, const unsigned _id) :
- name("")
+ name("")
{
- LogCtor("Nature", _id);
+ LogCtor("Nature", _id);
+ for (unsigned i = 0; i < STH_END_GSC; ++i)
+ stats[i].Set(1, 1, true);
id = _id;
pokemod = par;
}
@@ -52,95 +54,10 @@ void PokeGen::PokeMod::Nature::Validate()
{
LogVarNotSet("Nature", id, "name");
isValid = false;
- }
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> effectChecker;
- if (GetNatureEffectCount())
- {
- for (std::vector<NatureEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
- {
- LogSubmoduleIterate("Nature", id, "effect", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++effectChecker[i->GetStatString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Nature", id, "effect", i->first, name);
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = effectChecker.begin(); i != effectChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Nature", id, "effect", i->first, name);
- isValid = false;
- }
- }
- }
- else
- {
- LogSubmoduleEmpty("Nature", id, "effects", name);
- isValid = false;
- }
+ }
LogValidateOver("Nature", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Nature::Validate(const wxListBox &output)
-{
- LogValidateStart("Nature", id, name);
- if (name == "")
- {
- LogVarNotSet("Nature", id, "name");
- output.Append(ConsoleLogVarNotSet("Nature", id, "name"));
- isValid = false;
- }
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> effectChecker;
- if (GetNatureEffectCount())
- {
- for (std::vector<NatureEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
- {
- LogSubmoduleIterate("Nature", id, "effect", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++effectChecker[i->GetEffectString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Nature", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateId("Nature", id, "effect", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = effectChecker.begin(); i != effectChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Nature", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Nature", id, "effect", i->first, name));
- isValid = false;
- }
- }
- }
- else
- {
- LogSubmoduleEmpty("Nature", id, "effects", name);
- output.Append(ConsoleLogSubmoduleEmpty("Nature", id, "effects", name));
- isValid = false;
- }
- LogValidateOver("Nature", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::Nature::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Nature");
@@ -152,9 +69,16 @@ void PokeGen::PokeMod::Nature::ImportIni(Ini &ini, const unsigned _id)
LogIdNotFound("Nature");
}
else
- id = _id;
+ id = _id;
+ unsigned i;
+ unsigned j;
ini.GetValue("name", name);
- effects.clear();
+ for (unsigned k = 0; k < STH_END_GSC; ++k)
+ {
+ ini.GetValue(String("stat-%u-n", k), i, 1);
+ ini.GetValue(String("stat-%u-n", k), j, 1);
+ stats[k].Set(1, 1, true);
+ }
LogImportOver("Nature");
}
@@ -162,10 +86,13 @@ void PokeGen::PokeMod::Nature::ExportIni(std::ofstream &fout) const
{
LogExportStart("Nature", id, name);
Ini exNature("nature");
- exNature.AddField("name", name);
- exNature.Export(fout);
- for (std::vector<NatureEffect>::const_iterator i = effects.begin(); i != effects.end(); ++i)
- i->ExportIni(fout, name);
+ exNature.AddField("name", name);
+ for (unsigned i = 0; i < STH_END_GSC; ++i)
+ {
+ exNature.AddField(String("stat-%u-n", i), stats[i].GetNum());
+ exNature.AddField(String("stat-%u-d", i), stats[i].GetNum());
+ }
+ exNature.Export(fout);
LogExportOver("Nature", id, name);
}
@@ -173,57 +100,62 @@ void PokeGen::PokeMod::Nature::SetName(const String &n)
{
LogSetVar("Nature", id, "name", n);
name = n;
-}
-
+}
+
+void PokeGen::PokeMod::Nature::SetStat(const unsigned s, const Frac &m)
+{
+ LogSetVar("Nature", id, String("stat[%u]", s), m.GetNum(), m.GetDenom(), name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s] = m;
+}
+
+void PokeGen::PokeMod::Nature::SetStat(const unsigned s, const unsigned n, const unsigned d)
+{
+ LogSetVar("Nature", id, String("stat[%u]", s), n, d, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s].Set(n, d);
+}
+
+void PokeGen::PokeMod::Nature::SetStatNum(const unsigned s, const unsigned n)
+{
+ LogSetVar("Nature", id, String("stat[%u] numerator", s), n, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s].SetNum(n);
+}
+
+void PokeGen::PokeMod::Nature::SetStatDenom(const unsigned s, const unsigned d)
+{
+ LogSetVar("Nature", id, String("stat[%u] denominator", s), d, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s].SetDenom(d);
+}
+
PokeGen::PokeMod::String PokeGen::PokeMod::Nature::GetName() const
{
LogFetchVar("Nature", id, "name", name);
return name;
}
-const PokeGen::PokeMod::NatureEffect *PokeGen::PokeMod::Nature::GetNatureEffect(const unsigned _id) const
-{
- LogSubmoduleFetch("Nature", id, "effect", _id, name);
- for (unsigned i = 0; i < GetNatureEffectCount(); ++i)
- {
- if (effects[i].GetId() == _id)
- return &effects[i];
- }
- LogSubmoduleFetchFail("Nature", id, "effect", _id, name);
- return NULL;
-}
-
-unsigned PokeGen::PokeMod::Nature::GetNatureEffectCount() const
-{
- LogSubmoduleCount("Nature", id, "effects", name);
- return effects.size();
-}
-
-void PokeGen::PokeMod::Nature::NewNatureEffect(Ini *const ini)
-{
- unsigned i = 0;
- for (; i < GetNatureEffectCount(); ++i)
- {
- if (!GetNatureEffect(i))
- break;
- }
- NatureEffect newNatureEffect(pokemod, i);
- if (ini)
- newNatureEffect.ImportIni(*ini);
- LogSubmoduleNew("Nature", id, "effect", i, name);
- effects.push_back(newNatureEffect);
-}
-
-void PokeGen::PokeMod::Nature::DeleteNatureEffect(const unsigned _id)
-{
- LogSubmoduleRemoveStart("Nature", id, "effect", _id, name);
- for (std::vector<NatureEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
- {
- if (i->GetId() == _id)
- {
- LogSubmoduleRemoved("Nature", id, "effect", _id, name);
- effects.erase(i);
- }
- }
- LogSubmoduleRemoveFail("Nature", id, "effect", _id, name);
-}
+PokeGen::PokeMod::Frac PokeGen::PokeMod::Nature::GetStat(const unsigned s) const
+{
+ LogFetchVar("Nature", id, String("stat[%u]", s), 0, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ return stats[s];
+ return Frac(1, 1, true);
+}
+
+unsigned PokeGen::PokeMod::Nature::GetStatNum(const unsigned s) const
+{
+ LogFetchVar("Nature", id, String("stat[%u] numerator", s), 0, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ return stats[s].GetNum();
+ return 1;
+}
+
+unsigned PokeGen::PokeMod::Nature::GetStatDenom(const unsigned s) const
+{
+ LogFetchVar("Nature", id, String("stat[%u] denominator", s), 0, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ return stats[s].GetDenom();
+ return 1;
+}
diff --git a/pokemod/Nature.h b/pokemod/Nature.h
index 252e0b3c..716e3a97 100644
--- a/pokemod/Nature.h
+++ b/pokemod/Nature.h
@@ -24,10 +24,10 @@
#ifndef __POKEMOD_NATURE__
#define __POKEMOD_NATURE__
-#include <vector>
#include "Object.h"
#include "String.h"
-#include "NatureEffect.h"
+#include "Frac.h"
+#include "Ref.h"
namespace PokeGen
{
@@ -43,23 +43,21 @@ namespace PokeGen
void ImportIni(Ini &ini, const unsigned _id = UINT_MAX);
void ExportIni(std::ofstream &fout) const;
- void SetName(const String &n);
+ void SetName(const String &n);
+ void SetStat(const unsigned s, const Frac &m);
+ void SetStat(const unsigned s, const unsigned n, const unsigned d);
+ void SetStatNum(const unsigned s, const unsigned n);
+ void SetStatDenom(const unsigned s, const unsigned d);
String GetName() const;
-
- const NatureEffect *GetNatureEffect(const unsigned _id) const;
- unsigned GetNatureEffectCount() const;
- void NewNatureEffect(Ini *const ini = NULL);
- void DeleteNatureEffect(const unsigned _id);
+ Frac GetStat(const unsigned s) const;
+ unsigned GetStatNum(const unsigned s) const;
+ unsigned GetStatDenom(const unsigned s) const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
-
- std::vector<NatureEffect> effects;
+ Frac stats[STH_END_GSC];
};
}
}
diff --git a/pokemod/NatureEffect.cpp b/pokemod/NatureEffect.cpp
index 9d043ac8..ce3ba264 100644
--- a/pokemod/NatureEffect.cpp
+++ b/pokemod/NatureEffect.cpp
@@ -58,21 +58,6 @@ void PokeGen::PokeMod::NatureEffect::Validate()
LogValidateOver("NatureEffect", id, isValid);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::NatureEffect::Validate(const wxListBox &output)
-{
- LogValidateStart("NatureEffect", id);
- if ((pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY) <= stat)
- {
- LogVarNotValid("NatureEffect", id, "stat");
- output.Append(ConsoleLogVarNotValid("NatureEffect", id, "stat"));
- isValid = false;
- }
- multipler.Reduce();
- LogValidateOver("NatureEffect", id, isValid);
-}
-#endif
-
void PokeGen::PokeMod::NatureEffect::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("NatureEffect");
diff --git a/pokemod/NatureEffect.h b/pokemod/NatureEffect.h
index 4fa61443..155c3482 100644
--- a/pokemod/NatureEffect.h
+++ b/pokemod/NatureEffect.h
@@ -57,9 +57,6 @@ namespace PokeGen
unsigned GetMultiplierDenom() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
unsigned stat;
Frac multiplier;
diff --git a/pokemod/Object.cpp b/pokemod/Object.cpp
index d2d9c315..5fe480c9 100644
--- a/pokemod/Object.cpp
+++ b/pokemod/Object.cpp
@@ -36,13 +36,3 @@ bool PokeGen::PokeMod::Object::IsValid()
Validate();
return isValid;
}
-
-#ifdef PG_DEBUG_WINDOW
-bool PokeGen::PokeMod::Object::IsValid(const wxListBox &output)
-{
- isValid = (id != UINT_MAX);
- if (isValid)
- Validate(output);
- return isValid;
-}
-#endif
diff --git a/pokemod/Object.h b/pokemod/Object.h
index 50b5d0dd..4cd88bbc 100644
--- a/pokemod/Object.h
+++ b/pokemod/Object.h
@@ -24,19 +24,15 @@
#ifndef __POKEMOD_OBJECT__
#define __POKEMOD_OBJECT__
-#ifdef PM_DEBUG_OUTPUT_DEBUG
-# include <wx/listbox.h>
-#endif
-
-#include <fstream>
+#include <fstream>
#include "Debug.h"
#include "Ini.h"
namespace PokeGen
{
namespace PokeMod
- {
- class Pokemod;
+ {
+ class Pokemod;
class Object
{
@@ -46,14 +42,8 @@ namespace PokeGen
unsigned GetId() const;
bool IsValid();
-# ifdef PG_DEBUG_WINDOW
- bool IsValid(const wxListBox &output);
-# endif
protected:
virtual void Validate();
-# ifdef PG_DEBUG_WINDOW
- virtual void Validate(const wxListBox &output);
-# endif
bool isValid;
unsigned id;
diff --git a/pokemod/Path.cpp b/pokemod/Path.cpp
index 2e7e8a20..244e71e2 100644
--- a/pokemod/Path.cpp
+++ b/pokemod/Path.cpp
@@ -57,7 +57,7 @@ bool PokeGen::PokeMod::Path::DoesExist()
return true;
}
-bool PokeGen::PokeMod::Path::HasExtension(const String &ext)
+bool PokeGen::PokeMod::Path::HasExtension(const String &ext) const
{
size_t pos = rfind('.');
bool ret = true;
@@ -69,6 +69,15 @@ bool PokeGen::PokeMod::Path::HasExtension(const String &ext)
return ret;
}
+PokeGen::PokeMod::String PokeGen::PokeMod::Path::GetFilename() const
+{
+ size_t pos = rfind('/');
+ String fileName(substr(pos + 1));
+ if ((pos == npos) || (pos + 1 == length()))
+ return "";
+ return fileName;
+}
+
bool PokeGen::PokeMod::Path::CopyTo(const String &dest)
{
if (!DoesExist())
diff --git a/pokemod/Path.h b/pokemod/Path.h
index e27b0781..6e97f8c4 100644
--- a/pokemod/Path.h
+++ b/pokemod/Path.h
@@ -41,7 +41,8 @@ namespace PokeGen
void Update();
bool DoesExist();
- bool HasExtension(const String &ext);
+ bool HasExtension(const String &ext) const;
+ String GetFilename() const;
bool CopyTo(const String &dest);
Path &operator=(const char *path_);
diff --git a/pokemod/Point.cpp b/pokemod/Point.cpp
index 40c97050..0e910be9 100644
--- a/pokemod/Point.cpp
+++ b/pokemod/Point.cpp
@@ -28,16 +28,16 @@ void PokeGen::PokeMod::Point::ImportIni(Ini &ini)
LogImportStart("Point");
ini.GetValue("x", x, 0);
ini.GetValue("y", y, 0);
- Log(String("Point Import: Imported (%u, %u)", x, y), PM_DEBUG_INFO);
+ Log::Write(String("Point Import: Imported (%u, %u)", x, y), PM_DEBUG_INFO);
}
void PokeGen::PokeMod::Point::ExportIni(std::ofstream &fout, const String &val) const
{
- Log(String("Point Export: Starting (%u, %u) as %s", x, y, val.c_str()), PM_DEBUG_INFO);
+ Log::Write(String("Point Export: Starting (%u, %u) as %s", x, y, val.c_str()), PM_DEBUG_INFO);
Ini exPoint(val);
exPoint.AddField("x", x);
exPoint.AddField("y", y);
exPoint.Export(fout);
- Log(String("Point Export: Finished (%u, %u) as %s", x, y, val.c_str()), PM_DEBUG_INFO);
+ Log::Write(String("Point Export: Finished (%u, %u) as %s", x, y, val.c_str()), PM_DEBUG_INFO);
}
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index 80182f00..5d27d819 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -30,12 +30,10 @@ PokeGen::PokeMod::Pokemod::Pokemod(const String &f) :
genderAllowed(false),
breedingAllowed(false),
eggSpecies(UINT_MAX),
- holdItems(false),
+ holdItems(0),
criticalDomains(false),
- contestAllowed(false),
abilityAllowed(false),
natureAllowed(false),
- numDaycares(0),
numPokemonBoxes(0),
numPokemonPerBox(1),
maxParty(1),
@@ -64,10 +62,10 @@ PokeGen::PokeMod::Pokemod::Pokemod(const String &f) :
superPCPasswd(""),
struggleMove(UINT_MAX),
confuseMove(UINT_MAX),
- typeChart(1, 1, Frac(1, 1, true)),
- file(f)
+ typeChart(1, 1, Frac(1, 1, true))
{
- LogCtor("Pokemod", 0);
+ LogCtor("Pokemod", 0);
+ ImportIni(f);
}
PokeGen::PokeMod::Pokemod::~Pokemod()
@@ -95,11 +93,6 @@ void PokeGen::PokeMod::Pokemod::Validate()
LogVarNotValid("Pokemod", 0, "eggSpecies");
isValid = false;
}
- if (genderAllowed && breedingAllowed && (numDaycares < 2))
- {
- LogVarNotValid("Pokemod", 0, "numDaycares");
- isValid = false;
- }
if (!numPokemonBoxes)
LogVarNotValid("Pokemod", 0, "numPokemonBoxes");
else if (!numPokemonPerBox)
@@ -138,7 +131,7 @@ void PokeGen::PokeMod::Pokemod::Validate()
}
}
if (.05 < pokerusChance)
- Log("Pokemod: pokerusChance unusually high", PM_DEBUG_INFO);
+ Log::Write("Pokemod: pokerusChance unusually high", PM_DEBUG_INFO | PM_DEBUG_VALIDATION);
if (const Map *m = GetMap(startMap))
{
if (m->GetWidth() <= startCoordinate.GetX())
@@ -788,816 +781,6 @@ void PokeGen::PokeMod::Pokemod::Validate()
LogValidateOver("Pokemod", 0, isValid);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Pokemod::Validate(const wxListBox &output)
-{
- LogValidateStart("Pokemod", 0);
- if (title == "")
- {
- LogVarNotSet("Pokemod", 0, "title");
- output.Append(ConsoleLogVarNotSet("Pokemod", 0, "title"));
- isValid = false;
- }
- if (version == "")
- {
- LogVarNotSet("Pokemod", 0, "version");
- output.Append(ConsoleLogVarNotSet("Pokemod", 0, "version"));
- isValid = false;
- }
- if (description == "")
- {
- LogVarNotSet("Pokemod", 0, "description");
- output.Append(ConsoleLogVarNotSetW("Pokemod", 0, "description"));
- }
- if (genderAllowed && breedingAllowed && !GetPokemon(eggSpecies))
- {
- LogVarNotValid("Pokemod", 0, "eggSpecies");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "eggSpecies"));
- isValid = false;
- }
- if (genderAllowed && breedingAllowed && (numDaycares < 2))
- {
- LogVarNotValid("Pokemod", 0, "numDaycares");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "numDaycares"));
- isValid = false;
- }
- if (!numPokemonBoxes)
- {
- LogVarNotValid("Pokemod", 0, "numPokemonBoxes");
- output.Append(ConsoleLogVarNotValidW("Pokemod", 0, "numPokemonBoxes"));
- }
- else if (!numPokemonPerBox)
- {
- LogVarNotValid("Pokemod", 0, "numPokemonPerBox");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "numPokemonPerBox"));
- isValid = false;
- }
- if (!maxParty)
- {
- LogVarNotValid("Pokemod", 0, "maxParty");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "maxParty"));
- isValid = false;
- }
- if (!maxParty || (maxParty < maxFight))
- {
- LogVarNotValid("Pokemod", 0, "maxFight");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "maxFight"));
- isValid = false;
- }
- if (!maxMoves)
- {
- LogVarNotValid("Pokemod", 0, "maxMoves");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "maxMoves"));
- isValid = false;
- }
- if (!maxMoney)
- {
- LogVarNotValid("Pokemod", 0, "maxMoney");
- output.Append(ConsoleLogVarNotValidW("Pokemod", 0, "maxMoney"));
- }
- if ((maxDVValue != 16) && (maxDVValue != 32))
- {
- LogVarNotValid("Pokemod", 0, "maxDVValue");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "maxDVValue"));
- isValid = false;
- }
- if (effortValuesAllowed)
- {
- if (maxTotalEV < maxEVPerStat)
- {
- LogVarNotValid("Pokemod", 0, "maxEVPerStat");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "maxEVPerStat"));
- isValid = false;
- }
- }
- if (.05 < pokerusChance)
- {
- Log("Pokemod: pokerusChance unusually high", PM_DEBUG_INFO);
- output.Append(String("Warning (Pokemod): pokerusChance unusually high"));
- }
- if (const Map *m = GetMap(startMap))
- {
- if (m->GetWidth() <= startCoordinate.GetX())
- {
- LogVarNotValid("Pokemod", 0, "startCoordinate x");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "startCoordinate x"));
- isValid = false;
- }
- if (m->GetHeight() <= startCoordinate.GetY())
- {
- LogVarNotValid("Pokemod", 0, "startCoordinate y");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "startCoordinate y"));
- isValid = false;
- }
- }
- else
- {
- LogVarNotValid("Pokemod", 0, "startMap");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "startMap"));
- isValid = false;
- }
- if (DIR_END <= startDirection)
- {
- LogVarNotValid("Pokemod", 0, "startDirection");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "startDirection"));
- isValid = false;
- }
- if (!GetDialog(startDialog))
- {
- LogVarNotValid("Pokemod", 0, "startDialog");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "startDialog"));
- isValid = false;
- }
- if (!Path(GetPath() + "skins/walk.png").DoesExist())
- {
- LogVarNotValid("Pokemod", 0, "walkSkin");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "walkSkin"));
- isValid = false;
- }
- if (!Path(GetPath() + "skins/bike.png").DoesExist())
- {
- LogVarNotValid("Pokemod", 0, "bikeSkin");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "bikeSkin"));
- isValid = false;
- }
- if (!Path(GetPath() + "skins/surf.png").DoesExist())
- {
- LogVarNotValid("Pokemod", 0, "surfSkin");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "surfSkin"));
- isValid = false;
- }
- if (!Path(GetPath() + "skins/fly.png").DoesExist())
- {
- LogVarNotValid("Pokemod", 0, "flySkin");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "flySkin"));
- isValid = false;
- }
- if (!Path(GetPath() + "skins/fish.png").DoesExist())
- {
- LogVarNotValid("Pokemod", 0, "fishSkin");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "fishSkin"));
- isValid = false;
- }
- if (!Path(GetPath() + "skins/surfFish.png").DoesExist())
- {
- LogVarNotValid("Pokemod", 0, "surfFishSkin");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "surfFishSkin"));
- isValid = false;
- }
- if (superPCUname == "")
- {
- LogVarNotSet("Pokemod", 0, "superPCUname");
- output.Append(ConsoleLogVarNotSetW("Pokemod", 0, "superPCUname"));
- }
- if (superPCPasswd == "")
- {
- LogVarNotSet("Pokemod", 0, "superPCPasswd");
- output.Append(ConsoleLogVarNotSetW("Pokemod", 0, "superPCPasswd"));
- }
- if (!GetMove(struggleMove))
- {
- LogVarNotValid("Pokemod", 0, "struggleMove");
- output.Append(ConsoleLogVarNotValid("Pokemod", 0, "struggleMove"));
- isValid = false;
- }
- if (!GetMove(confuseMove))
- {
- LogVarNotValid("Pokemod", 0, "confuseMove");
- output.Append(ConsoleLogVarNotValidW("Pokemod", 0, "confuseMove"));
- }
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> nameChecker;
- if (abilityAllowed)
- {
- if (GetAbilityCount())
- {
- for (std::vector<Ability>::iterator i = abilities.begin(); i != abilities.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "ability", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "ability", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "ability", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "ability", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "ability", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "ability");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "ability"));
- isValid = false;
- }
- }
- if (GetAuthorCount())
- {
- for (std::vector<Author>::iterator i = authors.begin(); i != authors.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "author", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "author", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "author", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "author", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "author", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "author");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "author"));
- isValid = false;
- }
- if (GetBadgeCount())
- {
- for (std::vector<Badge>::iterator i = badges.begin(); i != badges.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "badge", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "badge", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "badge", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "badge", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "badge", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "badge");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "badge"));
- isValid = false;
- }
- if (GetCoinListCount())
- {
- for (std::vector<CoinList>::iterator i = coinLists.begin(); i != coinLists.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "coin list", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "coin list", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "coin list", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "coin list", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "coin list", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "coin list");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "coin list"));
- isValid = false;
- }
- if (GetDialogCount())
- {
- for (std::vector<Dialog>::iterator i = dialogs.begin(); i != dialogs.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "dialog", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "dialog", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "dialog", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "dialog");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "dialog"));
- isValid = false;
- }
- if (IsBreedingAllowed())
- {
- if (GetEggGroupCount())
- {
- for (std::vector<EggGroup>::iterator i = eggGroups.begin(); i != eggGroups.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "egg group", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "egg group", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "egg group", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "egg group", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "egg group", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "egg group");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "egg group"));
- isValid = false;
- }
- }
- if (GetItemCount())
- {
- for (std::vector<Item>::iterator i = items.begin(); i != items.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "item", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "item", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "item", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "item", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "item", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "item");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "item"));
- isValid = false;
- }
- if (GetItemStorageCount())
- {
- for (std::vector<ItemStorage>::iterator i = itemStorages.begin(); i != itemStorages.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "item storages", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "item storages", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "item storages", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "item storages", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "item storages", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "item storages");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "item storages"));
- isValid = false;
- }
- if (GetMapCount())
- {
- for (std::vector<Map>::iterator i = maps.begin(); i != maps.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "map", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "map", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "map", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "map", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "map", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "map");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "map"));
- isValid = false;
- }
- if (GetMoveCount())
- {
- for (std::vector<Move>::iterator i = moves.begin(); i != moves.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "move", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "move", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "move", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "move", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "move", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "move");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "move"));
- isValid = false;
- }
- if (natureAllowed)
- {
- if (GetNatureCount())
- {
- for (std::vector<Nature>::iterator i = natures.begin(); i != natures.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "nature", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "nature", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "nature", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "nature", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "nature", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "nature");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "nature"));
- isValid = false;
- }
- }
- if (GetPokemonCount())
- {
- for (std::vector<Pokemon>::iterator i = pokemon.begin(); i != pokemon.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "Pokémon", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "Pokémon", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "Pokémon", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "Pokémon", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "Pokémon", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "Pokémon");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "Pokémon"));
- isValid = false;
- }
- if (GetStatusCount())
- {
- for (std::vector<Status>::iterator i = statuses.begin(); i != statuses.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "status", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "status", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "status", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "status", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "status", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "status");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "status"));
- isValid = false;
- }
- if (GetStoreCount())
- {
- for (std::vector<Store>::iterator i = stores.begin(); i != stores.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "store", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "store", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "store", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "store", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "store", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "store");
- output.Append(ConsoleLogSubmoduleEmptyW("Pokemod", 0, "store"));
- }
- if (GetTileCount())
- {
- for (std::vector<Tile>::iterator i = tiles.begin(); i != tiles.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "tile", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "tile", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "tile", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "tile", i->first);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "tile", i->first));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "tile");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "tile"));
- isValid = false;
- }
- if (GetTimeCount())
- {
- std::map<unsigned, unsigned> timeChecker;
- for (std::vector<Time>::iterator i = times.begin(); i != times.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "time", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++timeChecker[60 * i->GetStartHour() + i->GetStartMinute()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "time", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "time", i->first));
- isValid = false;
- }
- }
- for (std::map<unsigned, unsigned>::const_iterator i = timeChecker.begin(); i != timeChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "time", String("%u:%u", i->first / 60, i->first % 60));
- output.Append(ConsoleLogDuplicateSubmodule("Pokemod", 0, "time", String("%u:%u", i->first / 60, i->first % 60)));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "time");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "time"));
- isValid = false;
- }
- if (GetTypeCount())
- {
- for (std::vector<Type>::iterator i = types.begin(); i != types.end(); ++i)
- {
- LogSubmoduleIterate("Pokemod", 0, "type", i->GetId());
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemod", 0, "type", i->first);
- output.Append(ConsoleLogDuplicateId("Pokemod", 0, "type", i->first));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemod", 0, "type", i->first);
- output.Append(Console);
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemod", 0, "type");
- output.Append(ConsoleLogSubmoduleEmpty("Pokemod", 0, "type"));
- isValid = false;
- }
- LogValidateOver("Pokemod", 0, isValid);
-}
-#endif
-
PokeGen::PokeMod::Path PokeGen::PokeMod::Pokemod::GetPath() const
{
Path f = file;
@@ -1619,7 +802,7 @@ void PokeGen::PokeMod::Pokemod::ImportIni(const String &f)
{
if (meta.GetName() == "unset")
{
- Log(String("Pokemod: Multiple meta data sections in PokéMod file"), PM_DEBUG_ERROR);
+ Log::Write(String("Pokemod: Multiple meta data sections in PokéMod file"), PM_DEBUG_ERROR);
return;
}
meta = curSection;
@@ -1631,12 +814,10 @@ void PokeGen::PokeMod::Pokemod::ImportIni(const String &f)
curSection.GetValue("genderAllowed", genderAllowed, false);
curSection.GetValue("breedingAllowed", breedingAllowed, false);
curSection.GetValue("eggSpecies", eggSpecies);
- curSection.GetValue("holdItems", holdItems, false);
+ curSection.GetValue("holdItems", holdItems, 0);
curSection.GetValue("criticalDomains", criticalDomains, false);
- curSection.GetValue("contestAllowed", contestAllowed, false);
curSection.GetValue("abilityAllowed", abilityAllowed, false);
curSection.GetValue("natureAllowed", natureAllowed, false);
- curSection.GetValue("numDaycares", numDaycares, 0);
curSection.GetValue("numPokemonBoxes", numPokemonBoxes, 0);
curSection.GetValue("numPokemonPerBox", numPokemonPerBox, 1);
curSection.GetValue("maxParty", maxParty, 1);
@@ -1709,7 +890,7 @@ void PokeGen::PokeMod::Pokemod::ImportIni(const String &f)
}
if (meta.GetName() == "unset")
{
- Log(String("Pokemod: No meta data found in PokéMod file"), PM_DEBUG_ERROR);
+ Log::Write(String("Pokemod: No meta data found in PokéMod file"), PM_DEBUG_ERROR);
return;
}
for (std::vector<Type>::iterator i = types.begin(); i != types.end(); ++i)
@@ -1780,12 +961,6 @@ void PokeGen::PokeMod::Pokemod::ImportIni(const String &f)
m->NewMoveEffect(&*i);
sections.erase(i);
}
- else if (s == "natureEffect")
- {
- if (Nature *n = (Nature *)GetNature(s1))
- n->NewNatureEffect(&*i);
- sections.erase(i);
- }
else if (s == "pokemonAbility")
{
if (Pokemon *p = (Pokemon *)GetPokemon(s1))
@@ -1848,16 +1023,16 @@ void PokeGen::PokeMod::Pokemod::ImportIni(const String &f)
}
}
for (std::vector<Ini>::iterator i = sections.begin(); i != sections.end(); ++i)
- Log(String("Pokemod: Unused INI section named \"%s\"", i->GetName().c_str()), PM_DEBUG_INFO);
+ Log::Write(String("Pokemod: Unused INI section named \"%s\"", i->GetName().c_str()), PM_DEBUG_INFO);
LogImportOver("Pokemod", 0, title);
}
-void PokeGen::PokeMod::Pokemod::ExportIni(const String &f) const
+void PokeGen::PokeMod::Pokemod::ExportIni(const String &f)
{
LogExportStart("Pokemod", 0, title);
Ini exPokemod("pokemod");
std::ofstream fout(f, std::ios::out);
- file = f.c_str();
+ file = f;
exPokemod.AddField("title", title);
exPokemod.AddField("version", version);
exPokemod.AddField("description", description);
@@ -1866,10 +1041,8 @@ void PokeGen::PokeMod::Pokemod::ExportIni(const String &f) const
exPokemod.AddField("eggSpecies", eggSpecies);
exPokemod.AddField("holdItems", holdItems);
exPokemod.AddField("criticalDomains", criticalDomains);
- exPokemod.AddField("contestAllowed", contestAllowed);
exPokemod.AddField("abilityAllowed", abilityAllowed);
exPokemod.AddField("natureAllowed", natureAllowed);
- exPokemod.AddField("numDaycares", numDaycares);
exPokemod.AddField("numPokemonBoxes", numPokemonBoxes);
exPokemod.AddField("numPokemonPerBox", numPokemonPerBox);
exPokemod.AddField("maxParty", maxParty);
@@ -1995,7 +1168,7 @@ void PokeGen::PokeMod::Pokemod::SetEggSpecies(const String &e)
eggSpecies = p->GetId();
}
-void PokeGen::PokeMod::Pokemod::SetCanHoldItems(const bool h)
+void PokeGen::PokeMod::Pokemod::SetHoldItems(const unsigned h)
{
LogSetVar("Pokemod", 0, "holdItems", h);
holdItems = h;
@@ -2007,12 +1180,6 @@ void PokeGen::PokeMod::Pokemod::SetHasCriticalDomains(const bool c)
criticalDomains = c;
}
-void PokeGen::PokeMod::Pokemod::SetIsContestAllowed(const bool c)
-{
- LogSetVar("Pokemod", 0, "contestAllowed", c);
- contestAllowed = c;
-}
-
void PokeGen::PokeMod::Pokemod::SetIsAbilityAllowed(const bool a)
{
LogSetVar("Pokemod", 0, "abilityAllowed", a);
@@ -2025,12 +1192,6 @@ void PokeGen::PokeMod::Pokemod::SetIsNatureAllowed(const bool n)
natureAllowed = n;
}
-void PokeGen::PokeMod::Pokemod::SetNumDaycares(const unsigned n)
-{
- LogSetVar("Pokemod", 0, "numDaycares", n);
- numDaycares = n;
-}
-
void PokeGen::PokeMod::Pokemod::SetNumPokemonBoxes(const unsigned n)
{
LogSetVar("Pokemod", 0, "numPokemonBoxes", n);
@@ -2368,7 +1529,7 @@ PokeGen::PokeMod::String PokeGen::PokeMod::Pokemod::GetEggSpeciesString() const
return "";
}
-bool PokeGen::PokeMod::Pokemod::CanHoldItems() const
+unsigned PokeGen::PokeMod::Pokemod::GetHoldItems() const
{
LogFetchVar("Pokemod", 0, "holdItems", holdItems);
return holdItems;
@@ -2380,12 +1541,6 @@ bool PokeGen::PokeMod::Pokemod::HasCriticalDomains() const
return criticalDomains;
}
-bool PokeGen::PokeMod::Pokemod::IsContestAllowed() const
-{
- LogFetchVar("Pokemod", 0, "contestAllowed", contestAllowed);
- return contestAllowed;
-}
-
bool PokeGen::PokeMod::Pokemod::IsAbilityAllowed() const
{
LogFetchVar("Pokemod", 0, "abilityAllowed", abilityAllowed);
@@ -2398,12 +1553,6 @@ bool PokeGen::PokeMod::Pokemod::IsNatureAllowed() const
return natureAllowed;
}
-unsigned PokeGen::PokeMod::Pokemod::GetNumDaycares() const
-{
- LogFetchVar("Pokemod", 0, "numDaycares", numDaycares);
- return numDaycares;
-}
-
unsigned PokeGen::PokeMod::Pokemod::GetNumPokemonBoxes() const
{
LogFetchVar("Pokemod", 0, "numPokemonBoxes", numPokemonBoxes);
diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h
index fa0b3ea1..5b64713c 100644
--- a/pokemod/Pokemod.h
+++ b/pokemod/Pokemod.h
@@ -68,7 +68,7 @@ namespace PokeGen
~Pokemod();
void ImportIni(const String &f);
- void ExportIni(const String &f) const;
+ void ExportIni(const String &f);
Path GetPath() const;
@@ -81,12 +81,10 @@ namespace PokeGen
void SetIsBreedingAllowed(const bool b);
void SetEggSpecies(const unsigned e);
void SetEggSpecies(const String &e);
- void SetCanHoldItems(const bool h);
+ void SetHoldItems(const unsigned h);
void SetHasCriticalDomains(const bool c);
- void SetIsContestAllowed(const bool c);
void SetIsAbilityAllowed(const bool a);
void SetIsNatureAllowed(const bool n);
- void SetNumDaycares(const unsigned n);
void SetNumPokemonBoxes(const unsigned n);
void SetNumPokemonPerBox(const unsigned n);
void SetMaxParty(const unsigned m);
@@ -139,12 +137,10 @@ namespace PokeGen
bool IsBreedingAllowed() const;
unsigned GetEggSpecies() const;
String GetEggSpeciesString() const;
- bool CanHoldItems() const;
+ unsigned GetHoldItems() const;
bool HasCriticalDomains() const;
- bool IsContestAllowed() const;
bool IsAbilityAllowed() const;
bool IsNatureAllowed() const;
- unsigned GetNumDaycares() const;
unsigned GetNumPokemonBoxes() const;
unsigned GetNumPokemonPerBox() const;
unsigned GetMaxParty() const;
@@ -336,9 +332,6 @@ namespace PokeGen
void DeleteType(const String &n);
private:
void Validate();
-# ifdef POKEMODR
- void Validate(const wxListBox &output);
-# endif
String title;
String version;
@@ -346,12 +339,10 @@ namespace PokeGen
bool genderAllowed;
bool breedingAllowed;
unsigned eggSpecies;
- bool holdItems;
+ unsigned holdItems;
bool criticalDomains;
- bool contestAllowed;
bool abilityAllowed;
bool natureAllowed;
- unsigned numDaycares;
unsigned numPokemonBoxes;
unsigned numPokemonPerBox;
unsigned maxParty;
diff --git a/pokemod/Pokemon.cpp b/pokemod/Pokemon.cpp
index b699e540..01a88c69 100644
--- a/pokemod/Pokemon.cpp
+++ b/pokemod/Pokemon.cpp
@@ -313,294 +313,6 @@ void PokeGen::PokeMod::Pokemon::Validate()
LogValidateOver("Pokemon", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Pokemon::Validate(const wxListBox &output)
-{
- LogValidateStart("Pokemon", id, name);
- if (name == "")
- {
- LogVarNotSet("Pokemon", id, "Name", name);
- output.Append(ConsoleLogVarNotSet("Pokemon", id, "Name", name));
- isValid = false;
- }
- if (name == "")
- {
- LogVarNotSet("Pokemon", id, "name", name);
- output.Append(ConsoleLogVarNotSet("Pokemon", id, "name", name));
- isValid = false;
- }
- for (unsigned i = 0; i < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY); ++i)
- {
- if (!baseStats[i])
- {
- LogVarNotValid("Pokemon", id, String("baseStats[%u]", i), name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, String("baseStats[%u]", i), name));
- isValid = false;
- }
- }
- if (STY_END <= growth)
- {
- LogVarNotValid("Pokemon", id, "growth", name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, "growth", name));
- isValid = false;
- }
- if (pokemod->GetPokemonCount() <= pokedexNumber)
- {
- LogVarNotValid("Pokemon", id, "pokedexNumber", name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, "pokedexNumber", name));
- isValid = false;
- }
- if (!weight)
- {
- LogVarNotSet("Pokemon", id, "weight", name);
- output.Append(ConsoleLogVarNotSetW("Pokemon", id, "weight", name));
- }
- if (12 <= heightInches)
- {
- LogVarNotValid("Pokemon", id, "heightInches", name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, "heightInches", name));
- isValid = false;
- }
- if (!Path(pokemod->GetPath() + "images/pokemon/front/male/" + name + ".png").DoesExist())
- {
- LogVarNotValid("Pokemon", id, "frontMaleSprite", name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, "frontMaleSprite", name));
- isValid = false;
- }
- if (!Path(pokemod->GetPath() + "images/pokemon/back/male/" + name + ".png").DoesExist())
- {
- LogVarNotValid("Pokemon", id, "backMaleSprite", name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, "backMaleSprite", name));
- isValid = false;
- }
- if (!Path(pokemod->GetPath() + "images/pokemon/front/female/" + name + ".png").DoesExist())
- {
- LogVarNotValid("Pokemon", id, "frontFemaleSprite", name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, "frontFemaleSprite", name));
- isValid = false;
- }
- if (!Path(pokemod->GetPath() + "images/pokemon/back/female/" + name + ".png").DoesExist())
- {
- LogVarNotValid("Pokemon", id, "backFemaleSprite", name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, "backFemrontMaleSprite", name));
- isValid = false;
- }
- if (!Path(pokemod->GetPath() + "images/pokemon/list/" + name + ".png").DoesExist())
- {
- LogVarNotValid("Pokemon", id, "listSprite", name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, "listSprite", name));
- isValid = false;
- }
- if (!pokemod->GetPokemon(eggSpecies))
- {
- LogVarNotValid("Pokemon", id, "eggSpecies", name);
- output.Append(ConsoleLogVarNotValidW("Pokemon", id, "eggSpecies", name));
- }
- else if (!eggSteps)
- {
- LogVarNotValid("Pokemon", id, "eggSteps", name);
- output.Append(ConsoleLogVarNotValid("Pokemon", id, "eggSteps", name));
- isValid = false;
- }
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> nameChecker;
- if (pokemod->IsAbilityAllowed())
- {
- if (GetPokemonAbilityCount())
- {
- for (std::vector<PokemonAbility>::iterator i = abilities.begin(); i != abilities.end(); ++i)
- {
- LogSubmoduleIterate("Pokemon", id, "ability", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetAbilityString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemon", id, "ability", i->first, name);
- output.Append(ConsoleLogDuplicateId("Pokemon", id, "ability", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemon", id, "ability", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemon", id, "ability", i->first, name));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemon", id, "ability", name);
- output.Append(ConsoleLogSubmoduleEmpty("Pokemon", id, "ability", name));
- isValid = false;
- }
- }
- if (GetPokemonEvolutionCount())
- {
- for (std::vector<PokemonEvolution>::iterator i = evolutions.begin(); i != evolutions.end(); ++i)
- {
- LogSubmoduleIterate("Pokemon", id, "evolution", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetSpeciesString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemon", id, "evolution", i->first, name);
- output.Append(ConsoleLogDuplicateId("Pokemon", id, "evolution", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemon", id, "evolution", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemon", id, "evolution", i->first, name));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemon", id, "evolution", name);
- output.Append(ConsoleLogSubmoduleEmptyW("Pokemon", id, "evolution", name));
- }
- if (pokemod->CanHoldItems())
- {
- if (GetPokemonItemCount())
- {
- for (std::vector<PokemonItem>::iterator i = items.begin(); i != items.end(); ++i)
- {
- LogSubmoduleIterate("Pokemon", id, "item", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetItemString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemon", id, "item", i->first, name);
- output.Append(ConsoleLogDuplicateId("Pokemon", id, "item", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemon", id, "item", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemon", id, "item", i->first, name));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemon", id, "item", name);
- output.Append(ConsoleLogSubmoduleEmpty("Pokemon", id, "item", name));
- isValid = false;
- }
- }
- if (GetPokemonMoveCount())
- {
- for (std::vector<PokemonMove>::iterator i = moves.begin(); i != moves.end(); ++i)
- {
- LogSubmoduleIterate("Pokemon", id, "move", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetMoveString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemon", id, "move", i->first, name);
- output.Append(ConsoleLogDuplicateId("Pokemon", id, "move", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemon", id, "move", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemon", id, "move", i->first, name));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemon", id, "move", name);
- output.Append(ConsoleLogSubmoduleEmpty("Pokemon", id, "move", name));
- isValid = false;
- }
- if (pokemod->IsNatureAllowed())
- {
- if (GetPokemonNatureCount())
- {
- for (std::vector<PokemonNature>::iterator i = natures.begin(); i != natures.end(); ++i)
- {
- LogSubmoduleIterate("Pokemon", id, "nature", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++nameChecker[i->GetNatureString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Pokemon", id, "nature", i->first, name);
- output.Append(ConsoleLogDuplicateId("Pokemon", id, "nature", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Pokemon", id, "nature", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Pokemon", id, "nature", i->first, name));
- isValid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
- {
- LogSubmoduleEmpty("Pokemon", id, "nature", name);
- output.Append(ConsoleLogSubmoduleEmpty("Pokemon", id, "nature", name));
- isValid = false;
- }
- }
- LogValidateOver("Pokemon", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::Pokemon::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Pokemon");
diff --git a/pokemod/Pokemon.h b/pokemod/Pokemon.h
index d0544d77..d8360e6a 100644
--- a/pokemod/Pokemon.h
+++ b/pokemod/Pokemon.h
@@ -172,9 +172,6 @@ namespace PokeGen
void DeletePokemonNature(const String &n);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
bool baseStats[STH_END_GSC];
diff --git a/pokemod/PokemonAbility.cpp b/pokemod/PokemonAbility.cpp
index af5812b9..28bdee4c 100644
--- a/pokemod/PokemonAbility.cpp
+++ b/pokemod/PokemonAbility.cpp
@@ -62,26 +62,6 @@ void PokeGen::PokeMod::PokemonAbility::Validate()
LogValidateOver("PokemonAbility", id, isValid, GetAbilityString());
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::PokemonAbility::Validate(const wxListBox &output)
-{
- LogValidateStart("PokemonAbility", id);
- if (!pokemod->GetAbility(ability))
- {
- LogVarNotValid("PokemonAbility", id, "ability");
- output.Append(ConsoleLogVarNotValid("PokemonAbility", id, "ability"));
- isValid = false;
- }
- if (!weight)
- {
- LogVarNotSet("PokemonAbility", id, "weight", GetAbilityString());
- output.Append(ConsoleLogVarNotSet("PokemonAbility", id, weight, GetAbilityString());
- isValid = false;
- }
- LogValidateOver("PokemonAbility", id, isValid, GetAbilityString());
-}
-#endif
-
void PokeGen::PokeMod::PokemonAbility::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("PokemonAbility");
diff --git a/pokemod/PokemonAbility.h b/pokemod/PokemonAbility.h
index 15b0eaab..459cdd24 100644
--- a/pokemod/PokemonAbility.h
+++ b/pokemod/PokemonAbility.h
@@ -52,7 +52,7 @@ namespace PokeGen
private:
void Validate();
# ifdef POKEMODR
- void Validate(const wxListBox &output);
+ void Validate(wxListBox &output);
# endif
unsigned ability;
diff --git a/pokemod/PokemonEvolution.cpp b/pokemod/PokemonEvolution.cpp
index 3543768a..daa05b13 100644
--- a/pokemod/PokemonEvolution.cpp
+++ b/pokemod/PokemonEvolution.cpp
@@ -75,38 +75,6 @@ void PokeGen::PokeMod::PokemonEvolution::Validate()
LogValidateOver("PokemonEvolution", id, isValid);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::PokemonEvolution::Validate(const wxListBox &output)
-{
- LogValidateStart("PokemonEvolution", id);
- if (!pokemod->GetPokemon(species))
- {
- LogVarNotValid("PokemonEvolution", id, "species");
- output.Append(ConsoleLogVarNotValid("PokemonEvolution", id, "move"));
- isValid = false;
- }
- if (STY_END <= style)
- {
- LogVarNotValid("PokemonEvolution", id, "style");
- output.Append("Error (PokemonEvolution): Style out of range");
- isValid = false;
- }
- if (pokemod->GetMaxLevel() <= level)
- {
- LogVarNotValid("PokemonEvolution", id, "level");
- output.Append("Error (PokemonEvolution): Level out of range");
- isValid = false;
- }
- if (!pokemod->GetItem(item))
- {
- LogVarNotValid("PokemonEvolution", id, "species");
- output.Append(ConsoleLogVarNotValid("PokemonEvolution", id, "species"));
- isValid = false;
- }
- LogValidateOver("PokemonEvolution", id, isValid);
-}
-#endif
-
void PokeGen::PokeMod::PokemonEvolution::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("PokemonEvolution");
diff --git a/pokemod/PokemonEvolution.h b/pokemod/PokemonEvolution.h
index 5ccd4802..78a444e7 100644
--- a/pokemod/PokemonEvolution.h
+++ b/pokemod/PokemonEvolution.h
@@ -61,9 +61,6 @@ namespace PokeGen
unsigned GetHappiness() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
unsigned species;
unsigned style;
diff --git a/pokemod/PokemonItem.cpp b/pokemod/PokemonItem.cpp
index be97563e..a5d79816 100644
--- a/pokemod/PokemonItem.cpp
+++ b/pokemod/PokemonItem.cpp
@@ -62,26 +62,6 @@ void PokeGen::PokeMod::PokemonItem::Validate()
LogValidateOver("PokemonItem", id, isValid, GetItemString());
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::PokemonItem::Validate(const wxListBox &output)
-{
- LogValidateStart("PokemonItem Validation: Starting", PM_DEBUG_INFO);
- if (!pokemod->GetItem(item))
- {
- LogVarNotValid("PokemonItem", id, "item");
- output.Append(ConsoleLogVarNotValid("PokemonItem", id, "item"));
- isValid = false;
- }
- if (!weight)
- {
- LogVarNotSet("PokemonItem", id, weight, GetItemString());
- output.Append(ConsoleLogVarNotSet("PokemonItem", id, weight, GetItemString()));
- isValid = false;
- }
- LogValidateOver("PokemonItem", id, isValid, GetItemString());
-}
-#endif
-
void PokeGen::PokeMod::PokemonItem::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("PokemonItem");
diff --git a/pokemod/PokemonItem.h b/pokemod/PokemonItem.h
index fc0a420b..2413b692 100644
--- a/pokemod/PokemonItem.h
+++ b/pokemod/PokemonItem.h
@@ -51,9 +51,6 @@ namespace PokeGen
unsigned GetWeight() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
unsigned item;
unsigned weight;
diff --git a/pokemod/PokemonMove.cpp b/pokemod/PokemonMove.cpp
index 032c65a5..c5a1c059 100644
--- a/pokemod/PokemonMove.cpp
+++ b/pokemod/PokemonMove.cpp
@@ -68,32 +68,6 @@ void PokeGen::PokeMod::PokemonMove::Validate()
LogValidateOver("PokemonMove", id, isValid, GetMoveString());
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::PokemonMove::Validate(const wxListBox &output)
-{
- LogValidateStart("PokemonMove", id, GetMoveString());
- if (!pokemod->GetMove(move))
- {
- LogVarNotValid("PokemonMove", id, "move");
- output.Append(ConsoleLogVarNotValid("PokemonMove", id, "move"));
- isValid = false;
- }
- if (level < pokemod->GetMaxLevel())
- {
- LogVarNotValid("PokemonMove", id, "level", GetMoveString());
- output.Append(ConsoleLogVarNotValid("PokemonMove", id, "level", GetMoveString()));
- isValid = false;
- }
- if (wild < pokemod->GetMaxLevel())
- {
- LogVarNotValid("PokemonMove", id, "wild", GetMoveString());
- output.Append(ConsoleLogVarNotValid("PokemonMove", id, "wild", GetMoveString()));
- isValid = false;
- }
- LogValidateOver("PokemonMove", id, isValid, GetMoveString());
-}
-#endif
-
void PokeGen::PokeMod::PokemonMove::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("PokemonMove");
diff --git a/pokemod/PokemonMove.h b/pokemod/PokemonMove.h
index e9d164f4..f93deb4d 100644
--- a/pokemod/PokemonMove.h
+++ b/pokemod/PokemonMove.h
@@ -53,9 +53,6 @@ namespace PokeGen
unsigned GetWild() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
unsigned move;
unsigned level;
diff --git a/pokemod/PokemonNature.cpp b/pokemod/PokemonNature.cpp
index 8f98e705..da9c6e03 100644
--- a/pokemod/PokemonNature.cpp
+++ b/pokemod/PokemonNature.cpp
@@ -62,26 +62,6 @@ void PokeGen::PokeMod::PokemonNature::Validate()
LogValidateOver("PokemonNature", id, isValid, GetNatureString());
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::PokemonNature::Validate(const wxListBox &output)
-{
- LogValidateStart("PokemonNature", id);
- if (!pokemod->GetNature(nature))
- {
- LogVarNotValid("PokemonNature", id, "nature");
- output.Append(ConsoleLogVarNotValid("PokemonNature", id, "nature"));
- isValid = false;
- }
- if (!weight)
- {
- LogVarNotSet("PokemonNature", id, "weight", GetNatureString());
- output.Append(ConsoleLogVarNotSet("PokemonNature", id, weight, GetNatureString());
- isValid = false;
- }
- LogValidateOver("PokemonNature", id, isValid, GetNatureString());
-}
-#endif
-
void PokeGen::PokeMod::PokemonNature::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("PokemonNature");
diff --git a/pokemod/PokemonNature.h b/pokemod/PokemonNature.h
index c7e9e0db..ef89c514 100644
--- a/pokemod/PokemonNature.h
+++ b/pokemod/PokemonNature.h
@@ -51,9 +51,6 @@ namespace PokeGen
unsigned GetWeight() const;
private:
void Validate();
-# ifdef POKEMODR
- void Validate(const wxListBox &output);
-# endif
unsigned nature;
unsigned weight;
diff --git a/pokemod/Ref.h b/pokemod/Ref.h
index 0b39c919..95b16f74 100644
--- a/pokemod/Ref.h
+++ b/pokemod/Ref.h
@@ -229,10 +229,12 @@ namespace PokeGen
HM_WATERFALL = 6,
HM_DIVE = 7,
HM_HEADBUTT = 8,
- HM_ROCK_SMASH = 9,
- HM_END = 10
+ HM_ROCK_SMASH = 9,
+ HM_CLEAR_FOG = 10,
+ HM_ROCK_CLIMB = 11,
+ HM_END = 12
};
- const char *HMStr[HM_END] = {"Cut", "Fly", "Surf", "Strength", "Flash", "Whirlpool", "Waterfall", "Dive", "Headbutt", "Rock Smash"};
+ const char *HMStr[HM_END] = {"Cut", "Fly", "Surf", "Strength", "Flash", "Whirlpool", "Waterfall", "Dive", "Headbutt", "Rock Smash", "Clear Fog", "Rock Climb"};
enum EnumStatVersion
{
@@ -497,7 +499,7 @@ namespace PokeGen
DC_SOUND_EFFECT = 36,
DC_TIMER = 37,
DC_MAP_SIGN = 38,
- DC_WILD_SCOPE = 39,
+ DC_WILD_SCOPE = 39,
DC_SAFARI = 40,
DC_HEAL_PARTY = 41,
DC_REFRESH = 42,
@@ -510,6 +512,7 @@ namespace PokeGen
};
const char *DialogCommandStr[DC_END] = {"Flip Flag", "Set Flag", "Unset Flag", "Randomize Flag", "Test Flag", "Dialog", "Yes/No", "Item Shop", "Give Item", "Take Item", "Check Item", "Coin List", "Teach Move", "Delete Move", "Give Pokemon", "Take Pokemon", "Show Pokemon", "View Pokemon", "Give Money", "Take Money", "Move Effect", "Turn Effect", "Check Direction", "Check Roster", "Check Levels", "Check Species", "Check Held Items", "Check Money", "Trade", "Daycare", "Battle", "Badge", "Warp", "Name", "Music", "Sound Effect", "Timer", "Map Sign", "Wild Scope", "Safari", "Heal Party", "Refresh", "Clear", "Pause", "New Line", "Exit", "Menu"};
const char *DialogCommandAbbrStr[DC_END] = {"FF", "SF", "UF", "RF", "TF", "D", "YN", "ItS", "GIt", "TIt", "CIt", "CL", "TMv", "DMv", "GPk", "TPk", "SPk", "VPk", "G$", "T$", "MvEf", "TEf", "CD", "CR", "CLv", "CS", "CHIt", "C$", "T", "Dc", "Bat", "Bdg", "W", "N", "Ms", "SFX", "Tmr", "MS", "WS", "S", "HP", "R", "C", "P", "NL", "X", "M"};
+ const unsigned DialogCommandNumArgs[DC_MENU] = {1, 1, 1, 1, 3, 2, 2, 1, 4, 4, 4, 1, 5, 3, 7, 4, 1, 4, 1, 4, 6, 3, 6, 5, 5, 4, 4, 5, 6, 1, 2, 1, 2, 1, 1, 1, 3, 1, 1, 3, 0, 0, 0, 0, 0, 0};
enum EnumMapEffect
{
diff --git a/pokemod/Status.cpp b/pokemod/Status.cpp
index 79b53f0b..0a90d1a0 100644
--- a/pokemod/Status.cpp
+++ b/pokemod/Status.cpp
@@ -125,100 +125,6 @@ void PokeGen::PokeMod::Status::Validate()
LogValidateOver("Status", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Status::Validate(const wxListBox &output)
-{
- LogValidateStart("Status", id, name);
- if (name == "")
- {
- LogVarNotSet("Status", id, "Name", name);
- output.Append(ConsoleLogVarNotSet("Status", id, "Name", name));
- isValid = false;
- }
- else if (name == "Clear")
- {
- LogVarNotValid("Status", id, "name", name);
- isValid = false;
- }
- if (abbreviation == "")
- {
- LogVarNotSet("Status", id, "abbreviation", name);
- output.Append(ConsoleLogVarNotSetW("Status", id, "abbreviation", name));
- }
- else if (4 <= abbreviation.length())
- {
- LogVarNotValid("Status", id, "abbreviation", name);
- output.Append(ConsoleLogVarNotValid("Status", id, "abbreviation", name));
- isValid = false;
- }
- if (verb == "")
- {
- LogVarNotSet("Status", id, "verb", name);
- output.Append(ConsoleLogVarNotSetW("Status", id, "verb", name));
- }
- if (afterSwitch == UINT_MAX)
- {
- LogVarNotSet("Status", id, "afterSwitch", name);
- output.Append(ConsoleLogVarNotSetW("Status", id, "afterSwitch", name));
- }
- else if (!pokemod->GetStatus(afterSwitch))
- {
- LogVarNotValid("Status", id, "afterSwitch", name);
- output.Append(ConsoleLogVarNotValid("Status", id, "afterSwitch", name));
- isValid = false;
- }
- if (afterBattle == UINT_MAX)
- {
- LogVarNotSet("Status", id, "afterBattle", name);
- output.Append(ConsoleLogVarNotSetW("Status", id, "afterBattle", name));
- }
- else if (!pokemod->GetStatus(afterBattle))
- {
- LogVarNotValid("Status", id, "afterBattle", name);
- output.Append(ConsoleLogVarNotValid("Status", id, "afterBattle", name));
- isValid = false;
- }
- if (GetStatusEffectCount())
- {
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> effectChecker;
- for (std::vector<StatusEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
- {
- LogSubmoduleIterate("Status", id, "effect", i->GetId(), name);
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- ++effectChecker[i->GetEffectString()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Status", id, "effect", i->first, name);
- output.Append(ConsoleLogDuplicateId("Status", id, "effect", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = effectChecker.begin(); i != effectChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Status", id, "effect", i->first, name);
- output.Append(LogDuplicateSubmodule("Status", id, "effect", i->first, name));
- isValid = false;
- }
- }
- }
- else
- {
- LogSubmoduleEmpty("Status", id, "effect", id, name);
- output.Append(ConsoleLogSubmoduleEmpty("Status", id, "effect", name));
- isValid = false;
- }
- LogValidateOver("Status", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::Status::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Status");
diff --git a/pokemod/Status.h b/pokemod/Status.h
index 79682e70..4f42b299 100644
--- a/pokemod/Status.h
+++ b/pokemod/Status.h
@@ -72,9 +72,6 @@ namespace PokeGen
void DeleteStatusEffect(const unsigned _id);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
String abbreviation;
diff --git a/pokemod/StatusEffect.cpp b/pokemod/StatusEffect.cpp
index 46a70a4c..11b55a50 100644
--- a/pokemod/StatusEffect.cpp
+++ b/pokemod/StatusEffect.cpp
@@ -78,14 +78,6 @@ void PokeGen::PokeMod::StatusEffect::Validate()
LogValidateOver("StatusEffect", id, isValid);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::StatusEffect::Validate(const wxListBox &output)
-{
- LogValidateStart("StatusEffect", id);
- LogValidateOver("StatusEffect", id, isValid);
-}
-#endif
-
void PokeGen::PokeMod::StatusEffect::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("StatusEffect");
diff --git a/pokemod/StatusEffect.h b/pokemod/StatusEffect.h
index ec38e4d1..347bd218 100644
--- a/pokemod/StatusEffect.h
+++ b/pokemod/StatusEffect.h
@@ -56,9 +56,6 @@ namespace PokeGen
String GetVal2String() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
unsigned effect;
unsigned val1;
diff --git a/pokemod/Store.cpp b/pokemod/Store.cpp
index 3aa26331..2257c1a8 100644
--- a/pokemod/Store.cpp
+++ b/pokemod/Store.cpp
@@ -92,60 +92,6 @@ void PokeGen::PokeMod::Store::Validate()
LogValidateOver("Store", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Store::Validate(const wxListBox &output)
-{
- LogValidateStart("Store", id, name);
- if (name == "")
- {
- LogVarNotSet("Store", id, "name", name);
- output.Append(ConsoleLogVarNotSet("Store", id, "name", name));
- isValid = false;
- }
- if (GetItemCount())
- {
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> itemChecker;
- for (std::vector<unsigned>::const_iterator i = items.begin(); i != items.end(); ++i)
- {
- if (!pokemod->GetItem(*i))
- {
- LogVarNotValid("Store", id, "item", name);
- output.Append(ConsoleLogVarNotValid("Store", id, "item", name));
- isValid = false;
- }
- ++idChecker[*i];
- ++itemChecker[pokemod->GetItem(*i)->GetName()];
- }
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateId("Store", id, "item", i->first, name);
- output.Append(ConsoleLogDuplicateId("Store", id, "item", i->first, name));
- isValid = false;
- }
- }
- for (std::map<String, unsigned>::const_iterator i = itemChecker.begin(); i != itemChecker.end(); ++i)
- {
- if (1 < i->second)
- {
- LogDuplicateSubmodule("Store", id, "item", i->first, name);
- output.Append(ConsoleLogDuplicateSubmodule("Store", id, "item", i->first, name));
- isValid = false;
- }
- }
- }
- else
- {
- LogSubmoduleEmpty("Store", id, "item", name);
- output.Append(ConsoleLogSubmoduleEmpty("Store", id, "item", name));
- isValid = false;
- }
- LogValidateOver("Store", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::Store::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Store");
diff --git a/pokemod/Store.h b/pokemod/Store.h
index 855885be..fb162534 100644
--- a/pokemod/Store.h
+++ b/pokemod/Store.h
@@ -59,9 +59,6 @@ namespace PokeGen
void DeleteItemByID(const unsigned i);
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
diff --git a/pokemod/String.cpp b/pokemod/String.cpp
index 61bc7e37..635e7bc7 100644
--- a/pokemod/String.cpp
+++ b/pokemod/String.cpp
@@ -28,7 +28,7 @@ PokeGen::PokeMod::String::String(const std::string &str)
{
assign(str);
}
-
+
PokeGen::PokeMod::String::String(const char *fmt, ...)
{
va_list args;
diff --git a/pokemod/String.h b/pokemod/String.h
index a2e84301..e5780367 100644
--- a/pokemod/String.h
+++ b/pokemod/String.h
@@ -28,7 +28,7 @@
#include <cstdarg>
#include <string>
#include <sstream>
-#include <iostream>
+#include <iostream>
namespace PokeGen
{
diff --git a/pokemod/TODO b/pokemod/TODO
index 83de910a..3e332748 100644
--- a/pokemod/TODO
+++ b/pokemod/TODO
@@ -5,8 +5,6 @@ Urgent
----------
References
----------
-ContestTarget CONT Move
-ContestEffects CONE Move
MoveEffects ME MoveEffect
StatusEffect SE StatusEffect
@@ -14,12 +12,18 @@ StatusEffect SE StatusEffect
Effect Switches
---------------
ItemEffect
-MoveEffect
+MoveEffect
+StatusEffect
----
Enum
----
-Class Template-ize (for implicit char * <-> enum <-> int conversions) (???)
+Class Template-ize (for implicit char * <-> enum <-> int conversions) (???) (would require HUGE rework everywhere involving the enums...)
+
+------------------
+PokéMod comparison
+------------------
+Figure out what makes 2 PokéMods incompatable
=================
Showstopper
@@ -29,7 +33,6 @@ Showstopper
Validation
----------
StatusEffect
-Dialog
ItemEffect
MoveEffect
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp
index 36cc5bc5..cd1e3d13 100644
--- a/pokemod/Tile.cpp
+++ b/pokemod/Tile.cpp
@@ -38,7 +38,8 @@ PokeGen::PokeMod::Tile::Tile(const Pokemod *par, const unsigned _id) :
canDive(false),
isCuttable(false),
underCut(UINT_MAX),
- canHeadbutt(false),
+ canHeadbutt(false),
+ isRockClimb(false),
forceType(UINT_MAX),
forceDirection(UINT_MAX)
{
@@ -84,6 +85,14 @@ void PokeGen::PokeMod::Tile::Validate()
LogVarNotValid("Tile", id, "waterType", name);
isValid = false;
}
+ else if (waterType == WTRT_WATERFALL)
+ {
+ if (!fromDown)
+ {
+ Log::Write(String("Tile: Waterfall needs to be accessible from below in %u (%s)", id, name.c_str()), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
else if (waterType == WTRT_WHIRLPOOL)
{
if (!pokemod->GetTile(underWater))
@@ -100,77 +109,15 @@ void PokeGen::PokeMod::Tile::Validate()
LogVarNotValid("Tile", id, "underCut", name);
isValid = false;
}
- }
- if (forceType < FT_END)
- {
- if ((forceType == FT_SLIP) || (forceType == FT_FORCE) || (forceType == FT_PUSH))
- {
- if (DIR_END <= forceDirection)
- {
- LogVarNotValid("Tile", id, "forceDirection", name);
- isValid = false;
- }
- }
- }
- else
- {
- LogVarNotValid("Tile", id, "forceType", name);
- isValid = false;
- }
- LogValidateOver("Tile", id, isValid, name);
-}
-
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Tile::Validate(const wxListBox &output)
-{
- LogValidateStart("Tile", id, name);
- if (name == "")
- {
- LogVarNotSet("Tile", id, "Name", name);
- output.Append(ConsoleLogVarNotSet("Tile", id, "Name", name));
- isValid = false;
- }
- if (!pic.DoesExist())
- {
- if (pic == "")
- {
- LogVarNotSet("Tile", id, "pic", name);
- output.Append(ConsoleLogVarNotSet("Tile", id, "pic", name));
- }
- else
- {
- LogVarNotValid("Tile", id, "pic", name);
- output.Append(ConsoleLogVarNotValid("Tile", id, "pic", name));
- }
- isValid = false;
- }
- if (isWater)
- {
- if (WT_END <= waterType)
- {
- LogVarNotValid("Tile", id, "waterType", name);
- output.Append(Console);
- isValid = false;
- }
- else if (waterType == WT_WHIRLPOOL)
- {
- if (!pokemod->GetTile(underWater))
- {
- LogVarNotValid("Tile", id, "underWater", name);
- output.Append(Console);
- isValid = false;
- }
- }
- }
- if (isCuttable)
+ }
+ if (isRockClimb)
{
- if (!pokemod->GetTile(underCut))
- {
- LogVarNotValid("Tile", id, "underCut", name);
- output.Append(Console);
- isValid = false;
- }
- }
+ if (!fromDown)
+ {
+ Log::Write(String("Tile: Rock Climbing needs to be accessible from below in %u (%s)", id, name.c_str()), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
+ isValid = false;
+ }
+ }
if (forceType < FT_END)
{
if ((forceType == FT_SLIP) || (forceType == FT_FORCE) || (forceType == FT_PUSH))
@@ -178,7 +125,6 @@ void PokeGen::PokeMod::Tile::Validate(const wxListBox &output)
if (DIR_END <= forceDirection)
{
LogVarNotValid("Tile", id, "forceDirection", name);
- output.Append(Console);
isValid = false;
}
}
@@ -186,12 +132,10 @@ void PokeGen::PokeMod::Tile::Validate(const wxListBox &output)
else
{
LogVarNotValid("Tile", id, "forceType", name);
- output.Append(Console);
isValid = false;
}
LogValidateOver("Tile", id, isValid, name);
}
-#endif
void PokeGen::PokeMod::Tile::ImportIni(Ini &ini, const unsigned _id)
{
@@ -223,6 +167,7 @@ void PokeGen::PokeMod::Tile::ImportIni(Ini &ini, const unsigned _id)
ini.GetValue("isCuttable", isCuttable, false);
ini.GetValue("underCut", underCut);
ini.GetValue("canHeadbutt", canHeadbutt, false);
+ ini.GetValue("isRockClimb", isRockClimb, false);
ini.GetValue("forceType", forceType);
ini.GetValue("forceDirection", forceDirection);
LogImportOver("Tile", id, name);
@@ -249,6 +194,7 @@ void PokeGen::PokeMod::Tile::ExportIni(std::ofstream &fout) const
exTile.AddField("isCuttable", isCuttable);
exTile.AddField("underCut", underCut);
exTile.AddField("canHeadbutt", canHeadbutt);
+ exTile.AddField("isRockClimb", isRockClimb);
exTile.AddField("forceType", forceType);
exTile.AddField("forceDirection", forceDirection);
exTile.Export(fout);
@@ -385,6 +331,12 @@ void PokeGen::PokeMod::Tile::SetCanHeadbutt(const bool c)
canHeadbutt = c;
}
+void PokeGen::PokeMod::Tile::SetIsRockClimb(const bool i)
+{
+ LogSetVar("Tile", id, "isRockClimb", i, name);
+ isRockClimb = i;
+}
+
void PokeGen::PokeMod::Tile::SetForceType(const unsigned f)
{
LogSetVar("Tile", id, "forceType", f, name);
@@ -535,6 +487,12 @@ bool PokeGen::PokeMod::Tile::GetCanHeadbutt() const
return canHeadbutt;
}
+bool PokeGen::PokeMod::Tile::GetIsRockClimb() const
+{
+ LogFetchVar("Tile", id, "isRockClimb", isRockClimb, name);
+ return isRockClimb;
+}
+
unsigned PokeGen::PokeMod::Tile::GetForceType() const
{
LogFetchVar("Tile", id, "forceType", forceType, name);
diff --git a/pokemod/Tile.h b/pokemod/Tile.h
index 7b2c0be6..a36cb3eb 100644
--- a/pokemod/Tile.h
+++ b/pokemod/Tile.h
@@ -63,6 +63,7 @@ namespace PokeGen
void SetUnderCut(const unsigned u);
void SetUnderCut(const String &u);
void SetCanHeadbutt(const bool c);
+ void SetIsRockClimb(const bool i);
void SetForceType(const unsigned f);
void SetForceType(const String &f);
void SetForceDirection(const unsigned f);
@@ -88,15 +89,13 @@ namespace PokeGen
unsigned GetUnderCut() const;
String GetUnderCutString() const;
bool GetCanHeadbutt() const;
+ bool GetIsRockClimb() const;
unsigned GetForceType() const;
String GetForceTypeString() const;
unsigned GetForceDirection() const;
String GetForceDirectionString() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
Path pic;
@@ -112,7 +111,8 @@ namespace PokeGen
bool canDive;
bool isCuttable;
unsigned underCut;
- bool canHeadbutt;
+ bool canHeadbutt;
+ bool isRockClimb;
unsigned forceType;
unsigned forceDirection;
};
diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp
index 2e6fc6ab..be515c37 100644
--- a/pokemod/Time.cpp
+++ b/pokemod/Time.cpp
@@ -66,32 +66,6 @@ void PokeGen::PokeMod::Time::Validate()
LogValidateOver("Time", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Time::Validate(const wxListBox &output)
-{
- 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, const unsigned _id)
{
LogImportStart("Time");
diff --git a/pokemod/Time.h b/pokemod/Time.h
index 198bf483..e18eace1 100644
--- a/pokemod/Time.h
+++ b/pokemod/Time.h
@@ -50,9 +50,6 @@ namespace PokeGen
unsigned GetStartMinute() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
unsigned startHour;
diff --git a/pokemod/Type.cpp b/pokemod/Type.cpp
index c0b568c2..794d5d81 100644
--- a/pokemod/Type.cpp
+++ b/pokemod/Type.cpp
@@ -25,7 +25,7 @@
PokeGen::PokeMod::Type::Type(const unsigned _id) :
name(""),
- stab(false)
+ stab(1, 1, true)
{
LogCtor("Type", _id);
id = _id;
@@ -55,20 +55,6 @@ void PokeGen::PokeMod::Type::Validate()
LogValidateOver("Type", id, isValid, name);
}
-#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::Type::Validate(const wxListBox &output)
-{
- LogValidateStart("Type", id, name);
- if (name == "")
- {
- LogVarNotSet("Type", id, "name", name);
- output.Append(ConsoleLogVarNotSet("Type", id, "name", name));
- isValid = false;
- }
- LogValidateOver("Type", id, isValid, name);
-}
-#endif
-
void PokeGen::PokeMod::Type::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Type");
@@ -80,9 +66,13 @@ void PokeGen::PokeMod::Type::ImportIni(Ini &ini, const unsigned _id)
LogIdNotFound("Type");
}
else
- id = _id;
+ id = _id;
+ unsigned i;
+ unsigned j;
ini.GetValue("name", name, "");
- ini.GetValue("stab", stab, false);
+ ini.GetValue("stab-n", i, 1);
+ ini.GetValue("stab-d", j, 1);
+ stab.Set(i, j, true);
LogImportOver("Type", id, name);
}
@@ -92,7 +82,8 @@ void PokeGen::PokeMod::Type::ExportIni(std::ofstream &fout) const
Ini exType("type");
exType.AddField("id", id);
exType.AddField("name", name);
- exType.AddField("stab", stab);
+ exType.AddField("stab-n", stab.GetNum());
+ exType.AddField("stab-d", stab.GetDenom());
exType.Export(fout);
LogExportOver("Type", id, name);
}
@@ -103,20 +94,50 @@ void PokeGen::PokeMod::Type::SetName(const String &n)
name = n;
}
-void PokeGen::PokeMod::Type::SetStab(const bool s)
+void PokeGen::PokeMod::Type::SetStab(const Frac &s)
{
- LogSetVar("Type", id, "stab", s, name);
+ LogSetVar("Type", id, "stab", s.GetNum(), s.GetDenom(), name);
stab = s;
}
+void PokeGen::PokeMod::Type::SetStab(const unsigned n, const unsigned d)
+{
+ LogSetVar("Type", id, "stab", n, d, name);
+ stab.Set(n, d);
+}
+
+void PokeGen::PokeMod::Type::SetStabNum(const unsigned n)
+{
+ LogSetVar("Type", id, "stab numerator", n, name);
+ stab.SetNum(n);
+}
+
+void PokeGen::PokeMod::Type::SetStabDenom(const unsigned d)
+{
+ LogSetVar("Type", id, "stab denominator", d, name);
+ stab.SetDenom(d);
+}
+
PokeGen::PokeMod::String PokeGen::PokeMod::Type::GetName() const
{
LogFetchVar("Type", id, "name", name, name);
return name;
-}
+}
-bool PokeGen::PokeMod::Type::GetStab() const
-{
- LogFetchVar("Type", id, "stab", stab, name);
- return stab;
-}
+PokeGen::PokeMod::Frac PokeGen::PokeMod::Type::GetStab() const
+{
+ LogFetchVar("Type", id, "stab", stab.GetNum(), stab.GetDenom(), name);
+ return stab;
+}
+
+unsigned PokeGen::PokeMod::Type::GetStabNum() const
+{
+ LogFetchVar("Type", id, "stab numerator", stab.GetNum(), name);
+ return stab.GetNum();
+}
+
+unsigned PokeGen::PokeMod::Type::GetStabDenom() const
+{
+ LogFetchVar("Type", id, "stab denominator", stab.GetDenom(), name);
+ return stab.GetDenom();
+}
diff --git a/pokemod/Type.h b/pokemod/Type.h
index be60aea0..d3a117e9 100644
--- a/pokemod/Type.h
+++ b/pokemod/Type.h
@@ -25,7 +25,8 @@
#define __POKEMOD_TYPE__
#include "Object.h"
-#include "String.h"
+#include "String.h"
+#include "Frac.h"
namespace PokeGen
{
@@ -42,18 +43,20 @@ namespace PokeGen
void ExportIni(std::ofstream &fout) const;
void SetName(const String &n);
- void SetStab(const bool s);
+ void SetStab(const Frac &s);
+ void SetStab(const unsigned n, const unsigned d);
+ void SetStabNum(const unsigned n);
+ void SetStabDenom(const unsigned d);
String GetName() const;
- bool GetStab() const;
+ Frac GetStab() const;
+ unsigned GetStabNum() const;
+ unsigned GetStabDenom() const;
private:
void Validate();
-# ifdef PG_DEBUG_WINDOW
- void Validate(const wxListBox &output);
-# endif
String name;
- bool stab;
+ Frac stab;
};
}
}
diff --git a/pokemod/pokemod_inc.h b/pokemod/pokemod_inc.h
index aae1032a..e461dcfd 100644
--- a/pokemod/pokemod_inc.h
+++ b/pokemod/pokemod_inc.h
@@ -23,7 +23,19 @@
#ifndef __POKEMOD_H__
#define __POKEMOD_H__
-
+
+#define PM_DEBUG
+
+#include "Debug.h"
+
+#ifdef __WINDOWS__
+# define PM_DEFAULT_DIR "~\\Application Data\\.pokemod"
+# define PM_DEFAULT_SEPARATOR "\\"
+#else
+# define PM_DEF_DIR "~/.pokemod"
+# define PM_DEF_SEP "/"
+#endif
+
namespace PokeGen
{
namespace PokeMod
@@ -49,7 +61,6 @@ namespace PokeGen
class Move;
class MoveEffect;
class Nature;
- class NatureEffect;
class Pokemod;
class Pokemon;
class PokemonAbility;
@@ -64,7 +75,9 @@ namespace PokeGen
class Time;
class Type;
}
-}
+}
+
+#include "Object.h"
#include "Pokemod.h"
#endif