summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog11
-rw-r--r--pokegen.cbp50
-rw-r--r--pokegen.layout82
-rw-r--r--pokemod/Ability.cpp3
-rw-r--r--pokemod/AbilityEffect.cpp9
-rw-r--r--pokemod/Author.cpp1
-rw-r--r--pokemod/CoinItem.cpp227
-rw-r--r--pokemod/CoinItem.h70
-rw-r--r--pokemod/CoinList.cpp5
-rw-r--r--pokemod/Item.cpp283
-rw-r--r--pokemod/Item.h82
-rw-r--r--pokemod/ItemStorage.cpp2
-rw-r--r--pokemod/MapTrainerTeam.cpp200
-rw-r--r--pokemod/MapTrainerTeam.h69
-rw-r--r--pokemod/MapWildList.cpp300
-rw-r--r--pokemod/MapWildList.h82
-rw-r--r--pokemod/MapWildPokemon.cpp184
-rw-r--r--pokemod/MapWildPokemon.h67
-rw-r--r--pokemod/Nature.cpp4
-rw-r--r--pokemod/Pokemod.cpp6
-rw-r--r--pokemod/PokemonAbility.cpp6
-rw-r--r--pokemod/PokemonAbility.h2
-rw-r--r--pokemod/PokemonEvolution.cpp6
-rw-r--r--pokemod/PokemonEvolution.h2
-rw-r--r--pokemod/PokemonItem.cpp8
-rw-r--r--pokemod/PokemonItem.h2
-rw-r--r--pokemod/PokemonMove.cpp6
-rw-r--r--pokemod/PokemonMove.h2
-rw-r--r--pokemod/PokemonNature.cpp6
-rw-r--r--pokemod/PokemonNature.h2
-rw-r--r--pokemod/Store.cpp2
-rw-r--r--pokemod/Time.cpp2
32 files changed, 1715 insertions, 68 deletions
diff --git a/Changelog b/Changelog
index 7f6bffe8..9f6abe17 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,15 @@
-----------------
+Rev: 13
+Date: 22 May 2007
+User: MathStuf
+-----------------
+[ADD] /pokemod/CoinItem.{h, cpp}
+[ADD] /pokemod/Item.{h, cpp}
+[ADD] /pokemod/MapWildList.{h, cpp}
+[ADD] /pokemod/MapWildPokemon.{h, cpp}
+[ADD] /pokemod/MapTrainerTeam.{h, cpp}
+
+-----------------
Rev: 12
Date: 21 May 2007
User: MathStuf
diff --git a/pokegen.cbp b/pokegen.cbp
index df988269..6f08535b 100644
--- a/pokegen.cbp
+++ b/pokegen.cbp
@@ -117,6 +117,16 @@
<Unit filename="pokemod\Badge.h">
<Option target="pokemod-DLL" />
</Unit>
+ <Unit filename="pokemod\CoinItem.cpp">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\CoinItem.h">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
<Unit filename="pokemod\CoinList.cpp">
<Option target="pokemodr" />
<Option target="pokegen" />
@@ -151,6 +161,16 @@
<Unit filename="pokemod\Ini.h">
<Option target="pokemod-DLL" />
</Unit>
+ <Unit filename="pokemod\Item.cpp">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\Item.h">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
<Unit filename="pokemod\ItemStorage.cpp">
<Option target="pokemodr" />
<Option target="pokegen" />
@@ -161,6 +181,36 @@
<Option target="pokegen" />
<Option target="pokemod-DLL" />
</Unit>
+ <Unit filename="pokemod\MapTrainerTeam.cpp">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\MapTrainerTeam.h">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\MapWildList.cpp">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\MapWildList.h">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\MapWildPokemon.cpp">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\MapWildPokemon.h">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
<Unit filename="pokemod\Matrix.h">
<Option target="pokemod-DLL" />
</Unit>
diff --git a/pokegen.layout b/pokegen.layout
index b3691d29..441133d1 100644
--- a/pokegen.layout
+++ b/pokegen.layout
@@ -2,7 +2,7 @@
<CodeBlocks_layout_file>
<ActiveTarget name="pokemod-DLL" />
<File name="Changelog" open="1" top="1" tabpos="1">
- <Cursor position="378" topLine="0" />
+ <Cursor position="253" topLine="0" />
</File>
<File name="STANDARDS" open="0" top="0" tabpos="0">
<Cursor position="2" topLine="0" />
@@ -25,35 +25,41 @@
<File name="ai\Node.h" open="0" top="0" tabpos="0">
<Cursor position="1408" topLine="0" />
</File>
- <File name="pokemod\Ability.cpp" open="0" top="0" tabpos="5">
- <Cursor position="6082" topLine="166" />
+ <File name="pokemod\Ability.cpp" open="1" top="0" tabpos="2">
+ <Cursor position="4420" topLine="117" />
</File>
<File name="pokemod\Ability.h" open="0" top="0" tabpos="2">
- <Cursor position="2198" topLine="0" />
+ <Cursor position="2059" topLine="0" />
</File>
<File name="pokemod\AbilityEffect.cpp" open="0" top="0" tabpos="2">
- <Cursor position="103" topLine="0" />
+ <Cursor position="2972" topLine="6" />
</File>
<File name="pokemod\AbilityEffect.h" open="0" top="0" tabpos="3">
<Cursor position="103" topLine="0" />
</File>
<File name="pokemod\Author.cpp" open="0" top="0" tabpos="4">
- <Cursor position="4756" topLine="0" />
+ <Cursor position="1444" topLine="24" />
</File>
<File name="pokemod\Author.h" open="0" top="0" tabpos="5">
<Cursor position="2263" topLine="0" />
</File>
<File name="pokemod\Badge.cpp" open="0" top="0" tabpos="6">
- <Cursor position="7320" topLine="0" />
+ <Cursor position="7320" topLine="21" />
</File>
<File name="pokemod\Badge.h" open="0" top="0" tabpos="7">
<Cursor position="1402" topLine="0" />
</File>
+ <File name="pokemod\CoinItem.cpp" open="0" top="0" tabpos="0">
+ <Cursor position="1570" topLine="27" />
+ </File>
+ <File name="pokemod\CoinItem.h" open="0" top="0" tabpos="0">
+ <Cursor position="1718" topLine="36" />
+ </File>
<File name="pokemod\CoinList.cpp" open="0" top="0" tabpos="0">
- <Cursor position="6001" topLine="175" />
+ <Cursor position="1604" topLine="32" />
</File>
<File name="pokemod\CoinList.h" open="0" top="0" tabpos="0">
- <Cursor position="2118" topLine="39" />
+ <Cursor position="2449" topLine="33" />
</File>
<File name="pokemod\Debug.cpp" open="0" top="0" tabpos="0">
<Cursor position="1310" topLine="0" />
@@ -79,20 +85,44 @@
<File name="pokemod\Ini.h" open="0" top="0" tabpos="12">
<Cursor position="2687" topLine="0" />
</File>
+ <File name="pokemod\Item.cpp" open="0" top="0" tabpos="2">
+ <Cursor position="6832" topLine="25" />
+ </File>
+ <File name="pokemod\Item.h" open="0" top="0" tabpos="0">
+ <Cursor position="2095" topLine="33" />
+ </File>
<File name="pokemod\ItemStorage.cpp" open="0" top="0" tabpos="0">
- <Cursor position="3786" topLine="108" />
+ <Cursor position="1524" topLine="27" />
</File>
<File name="pokemod\ItemStorage.h" open="0" top="0" tabpos="0">
<Cursor position="103" topLine="0" />
</File>
+ <File name="pokemod\MapTrainerTeam.cpp" open="0" top="0" tabpos="3">
+ <Cursor position="6583" topLine="165" />
+ </File>
+ <File name="pokemod\MapTrainerTeam.h" open="0" top="0" tabpos="0">
+ <Cursor position="1743" topLine="24" />
+ </File>
+ <File name="pokemod\MapWildList.cpp" open="0" top="0" tabpos="2">
+ <Cursor position="1617" topLine="21" />
+ </File>
+ <File name="pokemod\MapWildList.h" open="0" top="0" tabpos="0">
+ <Cursor position="1775" topLine="30" />
+ </File>
+ <File name="pokemod\MapWildPokemon.cpp" open="0" top="0" tabpos="0">
+ <Cursor position="1595" topLine="30" />
+ </File>
+ <File name="pokemod\MapWildPokemon.h" open="0" top="0" tabpos="0">
+ <Cursor position="1872" topLine="34" />
+ </File>
<File name="pokemod\Matrix.h" open="0" top="0" tabpos="4">
<Cursor position="3839" topLine="0" />
</File>
<File name="pokemod\Nature.cpp" open="0" top="0" tabpos="5">
- <Cursor position="2289" topLine="0" />
+ <Cursor position="4418" topLine="7" />
</File>
<File name="pokemod\Nature.h" open="0" top="0" tabpos="4">
- <Cursor position="1307" topLine="0" />
+ <Cursor position="1307" topLine="14" />
</File>
<File name="pokemod\Object.cpp" open="0" top="0" tabpos="0">
<Cursor position="1358" topLine="0" />
@@ -113,40 +143,40 @@
<Cursor position="1594" topLine="0" />
</File>
<File name="pokemod\Pokemod.cpp" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1866" topLine="0" />
</File>
<File name="pokemod\Pokemod.h" open="0" top="0" tabpos="0">
<Cursor position="1346" topLine="17" />
</File>
<File name="pokemod\PokemonAbility.cpp" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1580" topLine="18" />
</File>
<File name="pokemod\PokemonAbility.h" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1743" topLine="27" />
</File>
<File name="pokemod\PokemonEvolution.cpp" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1647" topLine="18" />
</File>
<File name="pokemod\PokemonEvolution.h" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1765" topLine="24" />
</File>
<File name="pokemod\PokemonItem.cpp" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1571" topLine="27" />
</File>
<File name="pokemod\PokemonItem.h" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1740" topLine="30" />
</File>
<File name="pokemod\PokemonMove.cpp" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1558" topLine="30" />
</File>
<File name="pokemod\PokemonMove.h" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1719" topLine="21" />
</File>
<File name="pokemod\PokemonNature.cpp" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1570" topLine="24" />
</File>
<File name="pokemod\PokemonNature.h" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1712" topLine="27" />
</File>
<File name="pokemod\Ref.cpp" open="0" top="0" tabpos="0">
<Cursor position="103" topLine="0" />
@@ -155,7 +185,7 @@
<Cursor position="103" topLine="0" />
</File>
<File name="pokemod\Store.cpp" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1503" topLine="21" />
</File>
<File name="pokemod\Store.h" open="0" top="0" tabpos="0">
<Cursor position="103" topLine="0" />
@@ -167,13 +197,13 @@
<Cursor position="1715" topLine="0" />
</File>
<File name="pokemod\Time.cpp" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="1479" topLine="18" />
</File>
<File name="pokemod\Time.h" open="0" top="0" tabpos="0">
<Cursor position="103" topLine="0" />
</File>
<File name="pokemod\Type.cpp" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="892" topLine="21" />
</File>
<File name="pokemod\Type.h" open="0" top="0" tabpos="0">
<Cursor position="103" topLine="0" />
diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp
index 0d05af7c..6b298c6a 100644
--- a/pokemod/Ability.cpp
+++ b/pokemod/Ability.cpp
@@ -122,6 +122,7 @@ void PokeGen::PokeMod::Ability::ImportIni(Ini &ini, unsigned _id)
else
id = _id;
ini.GetValue("name", name, "");
+ effects.clear();
LogImportOver("Ability", id, name);
}
@@ -158,7 +159,7 @@ PokeGen::PokeMod::AbilityEffect *PokeGen::PokeMod::Ability::GetAbilityEffect(uns
if (effects[i].GetId() == _id)
return &effects[i];
}
- LogSubmoduleFetch("Ability", id, "effect", _id, name);
+ LogSubmoduleFetchFail("Ability", id, "effect", _id, name);
return NULL;
}
diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp
index 45f45d3a..06d03afb 100644
--- a/pokemod/AbilityEffect.cpp
+++ b/pokemod/AbilityEffect.cpp
@@ -42,16 +42,7 @@ PokeGen::PokeMod::AbilityEffect::AbilityEffect(unsigned _id)
PokeGen::PokeMod::AbilityEffect::AbilityEffect(Ini &ini, unsigned _id)
{
LogCtorIni("AbilityEffect", _id);
- chance.Set(1, 1);
- effect = -1;
- val1 = -1;
- val2 = -1;
- val3 = -1;
- trigger = -1;
- tval1 = -1;
- tval2.Set(1, 1);
ImportIni(ini, _id);
- // Big problems
if (id == UINT_MAX)
LogIdError("AbilityEffect");
}
diff --git a/pokemod/Author.cpp b/pokemod/Author.cpp
index 3b5905b7..b290dc49 100644
--- a/pokemod/Author.cpp
+++ b/pokemod/Author.cpp
@@ -36,7 +36,6 @@ PokeGen::PokeMod::Author::Author(Ini &ini, unsigned _id)
{
LogCtorIni("Author", id);
ImportIni(ini, _id);
- // Big problems
if (id == UINT_MAX)
LogIdError("Author");
}
diff --git a/pokemod/CoinItem.cpp b/pokemod/CoinItem.cpp
new file mode 100644
index 00000000..d1b26125
--- /dev/null
+++ b/pokemod/CoinItem.cpp
@@ -0,0 +1,227 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/CoinItem.cpp
+// Purpose: Define an object that can be bought with gambling winnings
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Wed Feb 28 21:21:23 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "CoinItem.h"
+
+extern PokeGen::PokeMod::Pokemod curPokeMod;
+
+PokeGen::PokeMod::CoinItem::CoinItem(unsigned _id)
+{
+ LogCtor("CoinItem", _id);
+ type = 0;
+ object = -1;
+ amount = 1;
+ cost = 0;
+ id = _id;
+}
+
+PokeGen::PokeMod::CoinItem::CoinItem(Ini &ini, unsigned _id)
+{
+ LogCtorIni("CoinItem", _id);
+ ImportIni(ini);
+ if (id == UINT_MAX)
+ LogIdError("CoinItem");
+}
+
+PokeGen::PokeMod::CoinItem::~CoinItem()
+{
+ LogDtor("CoinItem", id);
+}
+
+void PokeGen::PokeMod::CoinItem::Validate()
+{
+ isValid = true;
+ LogValidateStart("CoinItem", id);
+ if (type == CIT_ITEM)
+ {
+ if (!curPokeMod.GetItem(object))
+ {
+ LogVarNotValid("CoinItem", id, "item", object);
+ isValid = false;
+ }
+ }
+ else if (type == CIT_POKEMON)
+ {
+ if (!curPokeMod.GetPokemon(object))
+ {
+ LogVarNotValid("CoinItem", id, "Pokémon", object);
+ isValid = false;
+ }
+ }
+ else
+ {
+ LogVarNotValid("CoinItem", id, "type", type);
+ isValid = false;
+ }
+ if (!amount)
+ {
+ LogVarNotValid("CoinItem", id, "amount", amount, GetObjectString());
+ isValid = false;
+ }
+ LogValidateOver("CoinItem", id, isValid, GetObjectString());
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::CoinItem::Validate(const wxListBox &output)
+{
+ isValid = true;
+ LogValidateStart("CoinItem", id);
+ if (type == CIT_ITEM)
+ {
+ if (!curPokeMod.GetItem(object))
+ {
+ LogVarNotValid("CoinItem", id, "item", object);
+ output.Append(ConsoleLogVarNotValid("CoinItem", id, "item", object));
+ isValid = false;
+ }
+ }
+ else if (type == CIT_POKEMON)
+ {
+ if (!curPokeMod.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, unsigned _id)
+{
+ LogImportStart("CoinItem");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("CoinItem");
+ }
+ else
+ id = _id;
+ ini.GetValue("type", type, CIT_ITEM);
+ ini.GetValue("object", object, -1);
+ ini.GetValue("amount", amount, 1);
+ ini.GetValue("cost", cost, 0);
+ LogImportOver("CoinItem", id);
+}
+
+void PokeGen::PokeMod::CoinItem::ExportIni(std::ofstream &fout, const String &coinList) const
+{
+ LogExportStart("CoinItem", id, name);
+ // Make elements
+ Ini exCoinItem(coinList + " CoinItem");
+ exCoinItem.AddField("id", id);
+ exCoinItem.AddField("type",type);
+ exCoinItem.AddField("object", object);
+ exCoinItem.AddField("amount", amount);
+ exCoinItem.AddField("cost", cost);
+ exCoinItem.Export(fout);
+ LogExportOver("CoinItem", id, name);
+}
+
+void PokeGen::PokeMod::CoinItem::SetType(unsigned t)
+{
+ LogSetVar("CoinItem", id, "type", t);
+ if (t < CIT_END)
+ {
+ type = t;
+ object = -1;
+ }
+}
+
+void PokeGen::PokeMod::CoinItem::SetObject(int o)
+{
+ LogSetVar("CoinItem", id, "object", o);
+ if (((type == CIT_ITEM) && curPokeMod.GetItem(o)) || ((type == CIT_POKEMON) && curPokeMod.GetPokemon(o)))
+ object = o;
+}
+
+void PokeGen::PokeMod::CoinItem::SetObject(const String &o)
+{
+ LogSetVar("CoinItem", id, "object string", o);
+ if ((type == CIT_ITEM) && (Item *i = curPokeMod.GetItem(o)))
+ object = i->GetId();
+ else if ((type == CIT_POKEMON) && (Pokemon *p = curPokeMod.GetPokemon(o)))
+ object = p->GetId();
+}
+
+void PokeGen::PokeMod::CoinItem::SetAmount(unsigned a)
+{
+ LogSetVar("CoinItem", id, "amount", a);
+ if (a)
+ amount = a;
+}
+
+void PokeGen::PokeMod::CoinItem::SetCost(unsigned c)
+{
+ LogSetVar("CoinItem", id, "cost", c);
+ cost = c;
+}
+
+unsigned PokeGen::PokeMod::CoinItem::GetType() const
+{
+ LogFetchVar("CoinItem", id, "type", type);
+ return type;
+}
+
+int PokeGen::PokeMod::CoinItem::GetObject() const
+{
+ LogFetchVar("CoinItem", id, "object", object);
+ return object;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::CoinItem::GetObjectString() const
+{
+ LogFetchVar("CoinItem", id, "object string", object);
+ if ((type == CIT_ITEM) && (Item *i = curPokeMod.GetItem(object)))
+ return i->GetName();
+ else if ((type == CIT_POKEMON) && (Pokemon *p = curPokeMod.GetPokemon(object)))
+ return p->GetName();
+ return "";
+}
+
+unsigned PokeGen::PokeMod::CoinItem::GetAmount() const
+{
+ LogFetchVar("CoinItem", id, "amount", amount);
+ return amount;
+}
+
+unsigned PokeGen::PokeMod::CoinItem::GetCost() const
+{
+ LogFetchVar("CoinItem", id, "cost", cost);
+ return cost;
+}
diff --git a/pokemod/CoinItem.h b/pokemod/CoinItem.h
new file mode 100644
index 00000000..641c15fa
--- /dev/null
+++ b/pokemod/CoinItem.h
@@ -0,0 +1,70 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/CoinItem.h
+// Purpose: Define an object that can be bought with gambling winnings
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Wed Feb 28 21:21:23 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMOD_COINITEM__
+#define __POKEMOD_COINITEM__
+
+#include "Object.h"
+#include "String.h"
+#include "Pokemod.h"
+
+namespace PokeGen
+{
+ namespace PokeMod
+ {
+ class CoinItem : public Object
+ {
+ public:
+ CoinItem(unsigned _id);
+ CoinItem(Ini &ini, unsigned _id = UINT_MAX);
+ ~CoinItem();
+
+ void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
+ void ExportIni(std::ofstream &fout, const String &coinList) const;
+
+ void SetType(unsigned t);
+ void SetObject(int o);
+ void SetObject(const String &o);
+ void SetAmount(unsigned a);
+ void SetCost(unsigned c);
+
+ unsigned GetType() const;
+ int GetObject() const;
+ String GetObjectString() const;
+ unsigned GetAmount() const;
+ unsigned GetCost() const;
+ private:
+ void Validate();
+# ifdef PG_DEBUG_WINDOW
+ void Validate(const wxListBox &output);
+# endif
+
+ unsigned type;
+ int object;
+ unsigned amount;
+ unsigned cost;
+ };
+ }
+}
+
+#endif
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp
index 83748355..d9bb353d 100644
--- a/pokemod/CoinList.cpp
+++ b/pokemod/CoinList.cpp
@@ -39,7 +39,7 @@ PokeGen::PokeMod::CoinList::CoinList(Ini &ini, unsigned _id)
{
LogCtorIni("CoinList", _id);
ImportIni(ini);
- if(_id == UINT_MAX)
+ if (id == UINT_MAX)
LogIdError("CoinList");
}
@@ -118,6 +118,7 @@ void PokeGen::PokeMod::CoinList::ImportIni(Ini &ini, unsigned _id)
id = _id;
ini.GetValue("name", name, "");
ini.GetValue("value", value, 0);
+ items.clear();
LogImportOver("CoinList", id, name);
}
@@ -167,7 +168,7 @@ PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(unsigned _id
if (items[i].GetId() == _id)
return &items[i];
}
- LogSubmoduleFetch("CoinList", id, "item", _id, name);
+ LogSubmoduleFetchFail("CoinList", id, "item", _id, name);
return NULL;
}
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp
new file mode 100644
index 00000000..70207def
--- /dev/null
+++ b/pokemod/Item.cpp
@@ -0,0 +1,283 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/Item.cpp
+// Purpose: Define an item
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:16:29 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "Item.h"
+
+extern PokeGen::PokeMod::Pokemod curPokeMod;
+
+PokeGen::PokeMod::Item::Item(unsigned _id)
+{
+ LogCtor("Item", _id);
+ name = "";
+ sellable = false;
+ type = -1;
+ price = 0;
+ description = "";
+ effects.clear();
+ id = _id;
+}
+
+PokeGen::PokeMod::Item::Item(Ini &ini, unsigned _id)
+{
+ LogCtorIni("Item", _id);
+ ImportIni(ini);
+ if (id == UINT_MAX)
+ LogIdError();
+}
+
+PokeGen::PokeMod::Item::~Item()
+{
+ LogDtor("Item", id, name);
+}
+
+void PokeGen::PokeMod::Item::Validate()
+{
+ isValid = true;
+ LogValidateStart("Item", id, name);
+ if (name == "")
+ {
+ LogVarEmpty("Item", id, "name");
+ output.Append(ConsoleLogVarEmpty("Item", id, "name"));
+ isValid = false;
+ }
+ if (!curPokeMod.GetItemStorage(type))
+ {
+ LogVarNotValid("Item", id, "type", type, name);
+ output.Append(ConsoleLogVarNotValid("Item", id, "type", type, name));
+ isValid = false;
+ }
+ if (GetItemEffectCount())
+ {
+ for (unsigned i = 0; i < GetItemEffectCount(); ++i)
+ {
+ LogSubmoduleIterate("Item", id, "effect", i, name);
+ if (!effects[i].IsValid())
+ isValid = false;
+ }
+ }
+ else
+ {
+ LogSubmoduleEmpty("Item", id, "effect", name);
+ output.Append(ConsoleLogSubmoduleEmpty("Item", id, "effect", name));
+ isValid = false;
+ }
+ LogValidateOver("Item", id, isValid, name);
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::Item::Validate(const wxListBox &output)
+{
+ isValid = true;
+ LogValidateStart("Item", id, name);
+ if (name == "")
+ {
+ LogVarEmpty("Item", id, "name");
+ output.Append(ConsoleLogVarEmpty("Item", id, "name"));
+ isValid = false;
+ }
+ if (!curPokeMod.GetItemStorage(type))
+ {
+ LogVarNotValid("Item", id, "type", type, name);
+ output.Append(ConsoleLogVarNotValid("Item", id, "type", type, name));
+ isValid = false;
+ }
+ if (GetItemEffectCount())
+ {
+ for (unsigned i = 0; i < GetItemEffectCount(); ++i)
+ {
+ LogSubmoduleIterate("Item", id, "effect", i, name);
+ if (!effects[i].IsValid())
+ 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, unsigned _id)
+{
+ LogImportStart("Item");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("Item");
+ }
+ else
+ id = _id;
+ ini.GetValue("name", name, "");
+ ini.GetValue("sellable", sellable, false);
+ ini.GetValue("type", type, -1);
+ ini.GetValue("price", price, 0);
+ ini.GetValue("description", description, "");
+ effects.clear();
+ LogImportOver("Item", id, name);
+}
+
+void PokeGen::PokeMod::Item::ExportIni(std::ofstream &fout) const
+{
+ LogExportStart("Item", id, name);
+ // Make elements
+ Ini exItem("item");
+ exItem.AddField("id", id);
+ exItem.AddField("name", name);
+ exItem.AddField("sellable", sellable);
+ exItem.AddField("type", type);
+ exItem.AddField("price", price);
+ exItem.AddField("description", description);
+ exItem.Export(fout);
+ for (std::vector<ItemEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
+ i->ExportIni(fout, name);
+ LogExportOver("Item", id, name);
+}
+
+void PokeGen::PokeMod::Item::SetName(const String &n)
+{
+ LogSetVar("Item", id, "name", n);
+ name = n;
+}
+
+void PokeGen::PokeMod::Item::SetSellable(bool s)
+{
+ LogSetVar("Item", id, "sellable", s, name);
+ sellable = s;
+}
+
+void PokeGen::PokeMod::Item::SetType(int t)
+{
+ LogSetVar("Item", id, "type", t, name);
+ if (curPokeMod.GetItemStorage(t))
+ type = t;
+}
+
+void PokeGen::PokeMod::Item::SetType(const String &t)
+{
+ LogSetVar("Item", id, "type string", t, name);
+ if (ItemStorage *i = curPokeMod.GetItemStorage(t))
+ type = i->GetId();
+}
+
+void PokeGen::PokeMod::Item::SetPrice(unsigned p)
+{
+ LogSetVar("Item", id, "price", p, name);
+ price = p;
+}
+
+void PokeGen::PokeMod::Item::SetDescription(const String &d)
+{
+ LogSetVar("Item", id, "description", d, name);
+ description = d;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::Item::GetName() const
+{
+ LogFetchVar("Item", id, "name", name);
+ return name;
+}
+
+bool PokeGen::PokeMod::Item::GetSellable() const
+{
+ LogFetchVar("Item", id, "sellable", sellable, name);
+ return sellable;
+}
+
+int PokeGen::PokeMod::Item::GetType() const
+{
+ LogFetchVar("Item", id, "type", type, name);
+ return type;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::Item::GetType() const
+{
+ LogFetchVar("Item", id, "type string", type, name);
+ if (ItemStorage *i = curPokeMod.GetItemStorage(type))
+ return i->GetName();
+ return "";
+}
+
+unsigned PokeGen::PokeMod::Item::GetPrice() const
+{
+ LogFetchVar("Item", id, "price", price, name);
+ return price;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::Item::GetDescription() const
+{
+ LogFetchVar("Item", id, "description", description, name);
+ return description;
+}
+
+PokeGen::PokeMod::ItemEffect *PokeGen::PokeMod::Item::GetItemEffect(unsigned _id)
+{
+ LogSubmoduleFetch("Item", id, "effect", _id, name);
+ for (unsigned i = 0; i < GetItemEffectCount(); ++i)
+ {
+ if (effects[i].GetId() == _id)
+ return &effects[i];
+ }
+ LogSubmoduleFetchFail("Item", id, "effect", _id, name);
+ return NULL;
+}
+
+unsigned PokeGen::PokeMod::Item::GetItemEffectCount() const
+{
+ LogSubmoduleCount("Item", id, "effect", name);
+ return effects.size();
+}
+
+void PokeGen::PokeMod::Item::NewItemEffect()
+{
+ unsigned i = 0;
+ // Find the first unused ID in the vector
+ for (; i < GetItemEffectCount(); ++i)
+ {
+ if (!GetItemEffect(i))
+ break;
+ }
+ ItemEffect newItemEffect(i);
+ if (ini)
+ newItemEffect.ImportIni(*ini);
+ LogSubmoduleNew("Item", id, "effect", i, name);
+ effects.push_back(newItemEffect);
+}
+
+void PokeGen::PokeMod::Item::DeleteItemEffect(unsigned _id)
+{
+ LogSubmoduleRemoveStart("Item", id, "effect", _id, name);
+ for (std::vector<ItemEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
+ {
+ if (i->GetId() == _id)
+ {
+ LogSubmoduleRemoved("Item", id, "effect", _id, name);
+ effects.erase(i);
+ }
+ }
+ LogSubmoduleRemoveFail("Item", id, "effect", _id, name);
+}
diff --git a/pokemod/Item.h b/pokemod/Item.h
new file mode 100644
index 00000000..2f83f842
--- /dev/null
+++ b/pokemod/Item.h
@@ -0,0 +1,82 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/Item.h
+// Purpose: Define an item
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:16:29 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMOD_ITEM__
+#define __POKEMOD_ITEM__
+
+#include <vector>
+#include "Object.h"
+#include "String.h"
+#include "Pokemod.h"
+#include "ItemEffect.h"
+
+namespace PokeGen
+{
+ namespace PokeMod
+ {
+ class Item : public Object
+ {
+ public:
+ Item(unsigned _id);
+ Item(Ini &ini, unsigned _id = UINT_MAX);
+ ~Item();
+
+ void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
+ void ExportIni(std::ofstream &fout) const;
+
+ void SetName(const String &n);
+ void SetSellable(bool s);
+ void SetType(int t);
+ void SetType(const String &t);
+ void SetPrice(unsigned p);
+ void SetDescription(const String &d);
+
+ String GetName() const;
+ bool GetSellable() const;
+ int GetType() const;
+ int GetTypeString() const;
+ unsigned GetPrice() const;
+ String GetDescription() const;
+
+ ItemEffect *GetItemEffect(unsigned _id);
+ unsigned GetItemEffectCount() const;
+ void NewItemEffect(Ini *const ini = NULL);
+ void DeleteItemEffect(unsigned _id);
+ private:
+ void Validate();
+# ifdef PG_DEBUG_WINDOW
+ void Validate(const wxListBox &output);
+# endif
+
+ String name;
+ bool sellable;
+ int type;
+ unsigned price;
+ String description;
+
+ std::vector<ItemEffect> effects;
+ };
+ }
+}
+
+#endif
diff --git a/pokemod/ItemStorage.cpp b/pokemod/ItemStorage.cpp
index b7466f3e..c0de1701 100644
--- a/pokemod/ItemStorage.cpp
+++ b/pokemod/ItemStorage.cpp
@@ -36,7 +36,7 @@ PokeGen::PokeMod::ItemStorage::ItemStorage(Ini &ini, unsigned _id)
{
LogCtorIni("ItemStorage", _id);
ImportIni(ini);
- if(_id == UINT_MAX)
+ if (id == UINT_MAX)
LogIdError("ItemStorage");
}
diff --git a/pokemod/MapTrainerTeam.cpp b/pokemod/MapTrainerTeam.cpp
new file mode 100644
index 00000000..bc069497
--- /dev/null
+++ b/pokemod/MapTrainerTeam.cpp
@@ -0,0 +1,200 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/MapTrainerTeam.cpp
+// Purpose: Define a Pokémon on a trainer's team
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 19:20:21 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "MapTrainerTeam.h"
+
+extern PokeGen::PokeMod::Pokemod curPokeMod;
+
+PokeGen::PokeMod::MapTrainerTeam::MapTrainerTeam(unsigned _id)
+{
+ LogCtor("MapTrainerTeam", _id);
+ species = -1;
+ level = 1;
+ item = -1;
+ id = _id;
+}
+
+PokeGen::PokeMod::MapTrainerTeam::MapTrainerTeam(Ini &ini, unsigned _id)
+{
+ LogCtorIni("MapTrainerTeam", _id);
+ ImportIni(ini);
+ if (id == UINT_MAX)
+ LogIdError("MapTrainerTeam");
+}
+
+PokeGen::PokeMod::MapTrainerTeam::~MapTrainerTeam()
+{
+ LogDtor("MapTrainerTeam", id, GetSpeciesString());
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::Validate()
+{
+ isValid = true;
+ LogValidateStart("MapTrainerTeam", id);
+ if (!curPokeMod.GetPokemon(species))
+ {
+ LogVarNotValid("MapTrainerTeam", id, "species", species);
+ output.Append(ConsoleLogVarNotValid("MapTrainerTeam", id, "species", species));
+ isValid = false;
+ }
+ if (curPokeMod.GetMaxLevel() <= level)
+ {
+ LogVarOutOfRange("MapTrainerTeam", id, "level", level, GetSpeciesString());
+ output.Append(ConsoleLogVarOutOfRange("MapTrainerTeam", id, "level", level, GetSpeciesString()));
+ isValid = false;
+ }
+ if ((item != -1) && !curPokeMod.GetItem(item))
+ {
+ LogVarNotValid("MapTrainerTeam", id, "item", item);
+ output.Append(ConsoleLogVarNotValid("MapTrainerTeam", id, "item", item));
+ isValid = false;
+ }
+ LogValidateOver("MapTrainerTeam", id, isValid, GetSpeciesString());
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::MapTrainerTeam::Validate(const wxListBox &output)
+{
+ isValid = true;
+ LogValidateStart("MapTrainerTeam", id);
+ if (!curPokeMod.GetPokemon(species))
+ {
+ LogVarNotValid("MapTrainerTeam", id, "species", species);
+ output.Append(ConsoleLogVarNotValid("MapTrainerTeam", id, "species", species));
+ isValid = false;
+ }
+ if (curPokeMod.GetMaxLevel() <= level)
+ {
+ LogVarOutOfRange("MapTrainerTeam", id, "level", level, GetSpeciesString());
+ output.Append(ConsoleLogVarOutOfRange("MapTrainerTeam", id, "level", level, GetSpeciesString()));
+ isValid = false;
+ }
+ if ((item != -1) && !curPokeMod.GetItem(item))
+ {
+ LogVarNotValid("MapTrainerTeam", id, "item", item);
+ output.Append(ConsoleLogVarNotValid("MapTrainerTeam", id, "item", item));
+ isValid = false;
+ }
+ LogValidateOver("MapTrainerTeam", id, isValid, GetSpeciesString());
+}
+#endif
+
+void PokeGen::PokeMod::MapTrainerTeam::ImportIni(Ini &ini, unsigned _id)
+{
+ LogImportStart("MapTrainerTeam");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("MapTrainerTeam");
+ }
+ else
+ id = _id;
+ ini.GetValue("species", species, -1);
+ ini.GetValue("level", level, 1);
+ ini.GetValue("item", item, -1);
+ LogImportOver("MapTrainerTeam", id);
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::ExportIni(Ini &ini, const String &map, unsigned trainerId) const
+{
+ LogExportStart("MapTrainerTeam", id);
+ // Make elements
+ Ini exMapTrainerTeam(map + String(" %u MapTrainerTeam", trainerId));
+ exMapTrainerTeam.AddField("id", id);
+ exMapTrainerTeam.AddField("species", species);
+ exMapTrainerTeam.AddField("level", level);
+ exMapTrainerTeam.AddField("item", item);
+ exMapTrainerTeam.Export(fout);
+ LogExportOver("MapTrainerTeam", id);
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::SetSpecies(int s)
+{
+ LogSetVar("MapTrainerTeam", id, "species", s);
+ if (curPokeMod.GetPokemon(s))
+ species = s;
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::SetSpecies(const String &s)
+{
+ LogSetVar("MapTrainerTeam", id, "species string", s);
+ if (Pokemon *p = curPokeMod.GetPokemon(s))
+ species = p->GetId();
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::SetLevel(unsigned l)
+{
+ LogSetVar("MapTrainerTeam", id, "level", l, GetSpeciesString());
+ if (l <= curPokeMod.GetMaxLevel())
+ level = l;
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::SetItem(int i)
+{
+ LogSetVar("MapTrainerTeam", id, "item", i, GetSpeciesString());
+ if (curPokeMod.GetItem(i))
+ item = i;
+}
+
+void PokeGen::PokeMod::MapTrainerTeam::SetItem(const String &i)
+{
+ LogSetVar("MapTrainerTeam", id, "item string", i, GetSpeciesString());
+ if (Item *item = curPokeMod.GetItem(i))
+ item = item->GetId();
+}
+
+int PokeGen::PokeMod::MapTrainerTeam::GetSpecies() const
+{
+ LogFetchVar("MapTrainerTeam", id, "speceis", species);
+ return species;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::MapTrainerTeam::GetSpeciesString() const
+{
+ LogFetchVar("MapTrainerTeam", id, "species string", species);
+ if (Pokemon *p = curPokeMod.GetPokemon(species))
+ return p->GetName();
+ return "";
+}
+
+unsigned PokeGen::PokeMod::MapTrainerTeam::GetLevel() const
+{
+ LogFetchVar("MapTrainerTeam", id, "level", level, GetSpeceisString());
+ return level;
+}
+
+int PokeGen::PokeMod::MapTrainerTeam::GetItem() const
+{
+ LogFetchVar("MapTrainerTeam", id, "item", item, GetSpeceisString());
+ return item;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::MapTrainerTeam::GetItemString() const
+{
+ LogFetchVar("MapTrainerTeam", id, "item string", item, GetSpeciesString());
+ if (Item *i = curPokeMod.GetItem(item))
+ i->GetName();
+ return "";
+}
diff --git a/pokemod/MapTrainerTeam.h b/pokemod/MapTrainerTeam.h
new file mode 100644
index 00000000..e1492581
--- /dev/null
+++ b/pokemod/MapTrainerTeam.h
@@ -0,0 +1,69 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/MapTrainerTeam.h
+// Purpose: Define a Pokémon on a trainer's team
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 19:20:21 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMOD_MAPTRAINERTEAM__
+#define __POKEMOD_MAPTRAINERTEAM__
+
+#include "Object.h"
+#include "String.h"
+#include "Pokemod.h"
+
+namespace PokeGen
+{
+ namespace PokeMod
+ {
+ class MapTrainerTeam : public Object
+ {
+ public:
+ MapTrainerTeam(unsigned _id);
+ MapTrainerTeam(Ini &ini, unsigned _id = UINT_MAX);
+ ~MapTrainerTeam();
+
+ void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
+ void ExportIni(Ini &ini, const String &map, unsigned trainerId) const;
+
+ void SetSpecies(int s);
+ void SetSpecies(const String &s);
+ void SetLevel(unsigned l);
+ void SetItem(int i);
+ void SetItem(const String &i);
+
+ int GetSpecies() const;
+ String GetSpeciesString() const;
+ unsigned GetLevel() const;
+ int GetItem() const;
+ String GetItemString() const;
+ private:
+ void Validate();
+# ifdef PG_DEBUG_WINDOW
+ void Validate(const wxListBox &output);
+# endif
+
+ int species;
+ unsigned level;
+ int item;
+ };
+ }
+}
+
+#endif
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
new file mode 100644
index 00000000..053aebc1
--- /dev/null
+++ b/pokemod/MapWildList.cpp
@@ -0,0 +1,300 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/MapWildList.cpp
+// Purpose: Define a list of Pokémon that can be found on the map
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 19:18:23 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "MapWildList.h"
+
+extern PokeGen::PokeMod::Pokemod curPokeMod;
+
+PokeGen::PokeMod::MapWildList::MapWildList(unsigned _id)
+{
+ LogCtor("MapWildList", _id);
+ control = 0;
+ value = 0;
+ times = false;
+ scope = -1;
+ pokemon.clear();
+ id = _id;
+}
+
+PokeGen::PokeMod::MapWildList::MapWildList(Ini &ini, unsigned _id)
+{
+ LogCtorIni("MapWildList", _id);
+ ImportIni(ini);
+ if (id == UINT_MAX)
+ LogIdError("MapWildList");
+}
+
+PokeGen::PokeMod::MapWildList::~MapWildList()
+{
+ LogDtor("MapWildList", id);
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::MapWildList::Validate(wxListBox &output)
+#else
+void PokeGen::PokeMod::MapWildList::Validate()
+#endif
+{
+ isValid = true;
+ PMLog("MapWildList Validation: Starting", PM_DEBUG_INFO);
+ // TODO (Validation#1#): MapWildList Validation
+ if (isValid)
+ PMLog("MapWildList Validation: Passed", PM_DEBUG_INFO);
+ else
+ PMLog("MapWildList Validation: Failed", PM_DEBUG_INFO);
+}
+
+void PokeGen::PokeMod::MapWildList::ImportIni(Ini &ini, unsigned _id)
+{
+ LogImportStart("MapWildList");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("MapWildList");
+ }
+ else
+ id = _id;
+ unsigned i;
+ unsigned j;
+ times.clear();
+ ini.GetValue("control", , 0);
+ ini.GetValue("value", , 0);
+ ini.GetValue("numTimes", i, 0);
+ for (unsigned k = 0; k < i; ++k)
+ {
+ ini.GetValue(String("time-%u", k), j, UINT_MAX);
+ if (k != UINT_MAX)
+ times.push_back(j);
+ }
+ ini.GetValue("scope", scope, -1);
+ LogImportOver("MapWildList", id, name);
+}
+
+void PokeGen::PokeMod::MapWildList::ExportIni(std::ofstream &fout, const String &map) const
+{
+ LogExportStart("MapWildList", id);
+ // Make elements
+ Ini exMapWildList(map + " mapWildList");
+ exMapWildList.AddField("id", id);
+ exMapWildList.AddField("control", control);
+ exMapWildList.AddField("value", value);
+ exMapWildList.AddField("numTimes", times.size());
+ for (unsigned i = 0; i < times.size(); ++i)
+ exMapWildList.AddField(String("time-%u", i), times[i]);
+ exMapWildList.AddField("scope", scope);
+ exMapWildList.Export(fout);
+ for (std::vector<MapWildListPokemon>::iterator i = effects.begin(); i != effects.end(); ++i)
+ i->ExportIni(fout, map, id);
+ LogExportOver("MapWildList", id);
+}
+
+void PokeGen::PokeMod::MapWildList::SetControl(unsigned c)
+{
+ LogSetVar("MapWildList", id, "control", c);
+ if ((CON_NONE < c) && (c < CON_END))
+ control = c;
+}
+
+void PokeGen::PokeMod::MapWildList::SetValue(unsigned v)
+{
+ unsigned i = 0;
+ unsigned j = 0;
+ LogSetVar("MapWildList", id, "value", v);
+ if (Item *item = curPokeMod.GetItem(v))
+ {
+ while (i < item->GetEffectCount())
+ {
+ if (ItemEffect *effect = curPokeMod.GetItem(j++))
+ {
+ ++i;
+ if (effect->GetEffect() == IE_FISH)
+ {
+ value = effect->GetVal1();
+ break;
+ }
+ }
+ }
+ }
+}
+
+void PokeGen::PokeMod::MapWildList::SetValue(const String &v)
+{
+ LogSetVar("MapWildList", id, "value string", v);
+ if (Item *i = curPokeMod.GetItem(v))
+ SetValue(i->GetId());
+}
+
+void PokeGen::PokeMod::MapWildList::SetTime(unsigned ts, bool t)
+{
+ for (std::vector<unsigned>::iterator i = times.begin(); i != times.end(); ++i)
+ {
+ if (*i == ts)
+ {
+ if (t)
+ return;
+ else
+ {
+ times.erase(i);
+ LogSetVar("MapWildList", id, String("time[%u]", ts), false);
+ return;
+ }
+ }
+ }
+ if (t)
+ {
+ times.push_back(ts);
+ LogSetVar("MapWildList", id, String("time[%u]", ts), true);
+ }
+}
+
+void PokeGen::PokeMod::MapWildList::SetTime(const String &ts, bool t)
+{
+ LogSetVar("MapWildList", id, String("time[%u] string", ts), t);
+ SetTime(curPokeMod.GetTime(ts)->GetId(), t);
+}
+
+void PokeGen::PokeMod::MapWildList::SetScope(unsigned s)
+{
+ LogSetVar("MapWildList", id, "scope", s);
+ unsigned i = 0;
+ unsigned j = 0;
+ if (Item *item = curPokeMod.GetItem(s))
+ {
+ while (i < item->GetEffectCount())
+ {
+ ItemEffect *effect = curPokeMod.GetItem(j++);
+ if (effect)
+ {
+ ++i;
+ if (effect->GetEffect() == IE_SCOPE)
+ scope = effect->GetVal1();
+ }
+ }
+ }
+}
+
+void PokeGen::PokeMod::MapWildList::SetScope(const String &s)
+{
+ LogSetVar("MapWildList", id, "scope string", s);
+ if (Item *i = curPokeMod.GetItem(s))
+ SetScope(i->GetId());
+}
+
+unsigned PokeGen::PokeMod::MapWildList::GetControl() const
+{
+ LogFetchVar("MapWildList", id, "control", control);
+ return control;
+}
+
+unsigned PokeGen::PokeMod::MapWildList::GetValue() const
+{
+ LogFetchVar("MapWildList", id, "value", value);
+ return value;
+}
+
+bool PokeGen::PokeMod::MapWildList::GetTime(unsigned ts) const
+{
+ LogFetchVar("MapWildList", id, String("time[%u]", ts), "???");
+ for (std::vector<unsigned>::iterator i = times.begin(); i != times.end(); ++i)
+ {
+ if (*i == ts)
+ return true;
+ }
+ return false;
+}
+
+bool PokeGen::PokeMod::MapWildList::GetTime(const String &ts) const
+{
+ LogFetchVar("MapWildList", id, String("time[%u] string", ts), "???");
+ if (Time *t = curPokeMod.GetTime(ts))
+ return GetTime(t->GetId());
+ return false;
+}
+
+int PokeGen::PokeMod::MapWildList::GetScope() const
+{
+ LogFetchVar("MapWildList", id, "scope", scope);
+ return scope;
+}
+
+PokeGen::PokeMod::MapWildPokemon *PokeGen::PokeMod::MapWildList::GetMapWildPokemon(unsigned _id)
+{
+ LogSubmoduleFetch("MapWildList", id, "Pokémon", _id);
+ for (unsigned i = 0; i < GetMapWildPokemonCount(); ++i)
+ {
+ if (pokemon[i].GetId() == _id)
+ return &pokemon[i];
+ }
+ LogSubmoduleFetch("MapWildList", id, "Pokémon", _id);
+ return NULL;
+}
+
+PokeGen::PokeMod::MapWildPokemon *PokeGen::PokeMod::MapWildList::GetMapWildPokemon(const String &n)
+{
+ LogSubmoduleFetch("MapWildList", id, "Pokémon string", n);
+ for (unsigned i = 0; i < GetMapWildPokemonCount(); ++i)
+ {
+ if (pokemon[i].GetPokemonString() == n)
+ return &pokemon[i];
+ }
+ LogSubmoduleFetch("MapWildList", id, "Pokémon", _id);
+ return NULL;
+}
+
+unsigned PokeGen::PokeMod::MapWildList::GetMapWildPokemonCount() const
+{
+ LogSubmoduleCount("MapWildList", id, "Pokémon");
+ return pokemon.size();
+}
+
+void PokeGen::PokeMod::MapWildList::NewMapWildPokemon(Ini *const ini)
+{
+ unsigned i = 0;
+ // Find the first unused ID in the vector
+ for (; i < GetMapWildPokemonCount(); ++i)
+ {
+ if (!GetMapWildPokemon(i))
+ break;
+ }
+ MapWildPokemon newMapWildPokemon(i);
+ if (ini)
+ newMapWildPokemon.ImportIni(*ini);
+ LogSubmoduleNew("MapWildList", id, "effect", i, name);
+ pokemon.push_back(newMapWildPokemon);
+}
+
+void PokeGen::PokeMod::MapWildList::DeleteMapWildPokemon(unsigned _id)
+{
+ LogSubmoduleRemoveStart("MapWildList", id, "Pokémon", _id, name);
+ for (std::vector<MapWildPokemon>::iterator i = effects.begin(); i != effects.end(); ++i)
+ {
+ if (i->GetId() == _id)
+ {
+ LogSubmoduleRemoved("MapWildList", id, "Pokémon", _id, name);
+ effects.erase(i);
+ }
+ }
+ LogSubmoduleRemoveFail("MapWildList", id, "Pokémon", _id, name);
+}
diff --git a/pokemod/MapWildList.h b/pokemod/MapWildList.h
new file mode 100644
index 00000000..0ff599f5
--- /dev/null
+++ b/pokemod/MapWildList.h
@@ -0,0 +1,82 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/MapWildList.h
+// Purpose: Define a list of Pokémon that can be found on the map
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 19:18:23 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMOD_MAPWILDLIST__
+#define __POKEMOD_MAPWILDLIST__
+
+#include <vector>
+#include "Object.h"
+#include "String.h"
+#include "Pokemod.h"
+#include "MapWildPokemon.h"
+
+namespace PokeGen
+{
+ namespace PokeMod
+ {
+ class MapWildList : public Object
+ {
+ public:
+ MapWildList(unsigned _id);
+ MapWildList(Ini &ini, unsigned _id = UINT_MAX);
+ ~MapWildList();
+
+ void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
+ void ExportIni(std::ofstream &fout, const String &map) const;
+
+ void SetControl(unsigned c);
+ void SetValue(unsigned v);
+ void SetValue(const String &v);
+ void SetTime(unsigned ts, bool t);
+ void SetTime(const String &ts, bool t);
+ void SetScope(unsigned s);
+ void SetScope(const String &s);
+
+ unsigned GetControl() const;
+ unsigned GetValue() const;
+ bool GetTime(unsigned ts) const;
+ bool GetTime(const String &ts) const;
+ int GetScope() const;
+
+ MapWildPokemon *GetMapWildPokemon(unsigned _id);
+ MapWildPokemon *GetMapWildPokemon(const String &n);
+ unsigned GetMapWildPokemonCount() const;
+ void NewMapWildPokemon();
+ void DeleteMapWildPokemon(unsigned _id);
+ private:
+ void Validate();
+# ifdef PG_DEBUG_WINDOW
+ void Validate(const wxListBox &output);
+# endif
+
+ unsigned control;
+ unsigned value;
+ std::vector<unsigned> times;
+ int scope;
+
+ std::vector<MapWildPokemon> pokemon;
+ };
+ }
+}
+
+#endif
diff --git a/pokemod/MapWildPokemon.cpp b/pokemod/MapWildPokemon.cpp
new file mode 100644
index 00000000..765142b6
--- /dev/null
+++ b/pokemod/MapWildPokemon.cpp
@@ -0,0 +1,184 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/MapWildPokemon.cpp
+// Purpose: Define a Pokémon that can be found in the wild
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:50:59 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "MapWildPokemon.h"
+
+extern PokeGen::PokeMod::Pokemod curPokeMod;
+
+PokeGen::PokeMod::MapWildPokemon::MapWildPokemon(unsigned _id)
+{
+ LogCtor("MapWildPokemon", _id);
+ pokemon = -1;
+ level = 1;
+ weight = 1;
+ id = _id;
+}
+
+PokeGen::PokeMod::MapWildPokemon::MapWildPokemon(Ini &ini, unsigned _id)
+{
+ LogCtorIni("MapWildPokemon", _id);
+ ImportIni(ini);
+ if (id == UINT_MAX)
+ LogIdError("MapWildPokemon");
+}
+
+PokeGen::PokeMod::MapWildPokemon::~MapWildPokemon()
+{
+ LogDtor("MapWildPokemon", id, GetPokemonString());
+}
+
+void PokeGen::PokeMod::MapWildPokemon::Validate()
+{
+ isValid = true;
+ LogValidateStart("MapWildPokemon", id, GetPokemonString());
+ if (!curPokeMod.GetPokemon(pokemon))
+ {
+ LogVarNotValid("MapWildPokemon", id, "pokemon");
+ output.Append(ConsoleLogVarNotValid("MapWildPokemon", id, "pokemon"));
+ isValid = false;
+ }
+ if (curPokeMod.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());
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::MapWildPokemon::Validate(const wxListBox &output)
+{
+ isValid = true;
+ LogValidateStart("MapWildPokemon", id, GetPokemonString());
+ if (!curPokeMod.GetPokemon(pokemon))
+ {
+ LogVarNotValid("MapWildPokemon", id, "pokemon");
+ output.Append(ConsoleLogVarNotValid("MapWildPokemon", id, "pokemon"));
+ isValid = false;
+ }
+ if (curPokeMod.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, unsigned _id)
+{
+ LogImportStart("MapWildPokemon");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("MapWildPokemon");
+ }
+ else
+ id = _id;
+ ini.GetValue("pokemon", pokemon, -1);
+ ini.GetValue("level", level, 1);
+ ini.GetValue("weight", weight, 1);
+ LogImportOver("MapWildPokemon", id, name);
+}
+
+void PokeGen::PokeMod::MapWildPokemon::ExportIni(std::ofstream &fout, const String &map, const unsigned listId) const
+{
+ LogExportStart("MapWildPokemon", id, name);
+ // Make elements
+ Ini exMapWildPokemon(map + String(" %u mapWildPokemon", listId));
+ exMapWildPokemon.AddField("id", id);
+ exMapWildPokemon.AddField("pokemon", pokemon);
+ exMapWildPokemon.AddField("level", level);
+ exMapWildPokemon.AddField("weight", weight);
+ exMapWildPokemon.Export(fout);
+ LogExportOver("MapWildPokemon", id, name);
+}
+
+void PokeGen::PokeMod::MapWildPokemon::SetPokemon(int p)
+{
+ LogSetVar("MapWildPokemon", id, "pokemon", p);
+ if (curPokeMod.GetPokemon(p))
+ pokemon = p;
+}
+
+void PokeGen::PokeMod::MapWildPokemon::SetPokemon(const String &p)
+{
+ LogSetVar("MapWildPokemon", id, "pokemon string", p);
+ if (Pokemon *pok = curPokeMod.GetPokemon(p))
+ pokemon = pok->GetId();
+}
+
+void PokeGen::PokeMod::MapWildPokemon::SetLevel(unsigned l)
+{
+ LogSetVar("MapWildPokemon", id, "level", l, GetPokemonString());
+ level = l;
+}
+
+void PokeGen::PokeMod::MapWildPokemon::SetWeight(unsigned w)
+{
+ LogSetVar("MapWildPokemon", id, "weight", w, GetPokemonString());
+ if (w)
+ weight = w;
+}
+
+int PokeGen::PokeMod::MapWildPokemon::GetPokemon() const
+{
+ LogFetchVar("MapWildPokemon", id, "pokemon", pokemon);
+ return pokemon;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::MapWildPokemon::GetPokemonString() const
+{
+ LogFetchVar("MapWildPokemon", id, "pokemon string", pokemon);
+ if (Pokemon *p = curPokeMod.GetPokemon(pokemon))
+ return p->GetName();
+ return "";
+}
+
+unsigned PokeGen::PokeMod::MapWildPokemon::GetLevel() const
+{
+ LogFetchVar("MapWildPokemon", id, "level", level, GetPokemonString());
+ return level;
+}
+
+unsigned PokeGen::PokeMod::MapWildPokemon::GetWeight() const
+{
+ LogFetchVar("MapWildPokemon", id, "weight", weight, GetPokemonString());
+ return weight;
+}
diff --git a/pokemod/MapWildPokemon.h b/pokemod/MapWildPokemon.h
new file mode 100644
index 00000000..2a14f448
--- /dev/null
+++ b/pokemod/MapWildPokemon.h
@@ -0,0 +1,67 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/MapWildPokemon.h
+// Purpose: Define a Pokémon that can be found in the wild
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:50:59 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMOD_MAPWILDPOKEMON__
+#define __POKEMOD_MAPWILDPOKEMON__
+
+#include "Object.h"
+#include "String.h"
+#include "Pokemod.h"
+
+namespace PokeGen
+{
+ namespace PokeMod
+ {
+ class MapWildPokemon: public Object
+ {
+ public:
+ MapWildPokemon(unsigned _id);
+ MapWildPokemon(Ini &ini, unsigned _id = UINT_MAX);
+ ~MapWildPokemon();
+
+ void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
+ void ExportIni(std::ofstream &fout, const String &map, const unsigned listId) const;
+
+ void SetPokemon(int p);
+ void SetPokemon(const String &p);
+ void SetLevel(unsigned l);
+ void SetWeight(unsigned w);
+
+ int GetPokemon() const;
+ String GetPokemonString() const;
+ unsigned GetLevel() const;
+ unsigned GetWeight() const;
+ private:
+ void Validate();
+# ifdef PG_DEBUG_WINDOW
+ void Validate(const wxListBox &output);
+# endif
+
+ int pokemon;
+ unsigned level;
+ unsigned weight;
+ };
+ }
+}
+
+#endif
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp
index 62fcd177..404b759f 100644
--- a/pokemod/Nature.cpp
+++ b/pokemod/Nature.cpp
@@ -113,8 +113,8 @@ void PokeGen::PokeMod::Nature::ImportIni(Ini &ini, unsigned _id)
}
else
id = _id;
- effects.clear();
ini.GetValue("name", name, "");
+ effects.clear();
LogImportOver("Nature");
}
@@ -149,7 +149,7 @@ PokeGen::PokeMod::NatureEffect *PokeGen::PokeMod::Nature::GetNatureEffect(unsign
if (effects[i].GetId() == _id)
return &effects[i];
}
- LogSubmodule("Nature", "effect", _id, id, name);
+ LogSubmoduleFetchFail("Nature", id, "effect", _id, name);
return NULL;
}
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index b62b3da7..906aee1e 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -38,13 +38,13 @@ PokeGen::PokeMod::PokeMod::~Pokemod()
LogDtor("Pokemod", 0);
}
-void Validate()
+void PokeGen::PokeMod::PokeMod::Validate()
{
// TODO (Validation#1#): Pokemod Validation
}
#ifdef PG_DEBUG_WINDOW
-void Validate(const wxListBox &output)
+void PokeGen::PokeMod::PokeMod::Validate(const wxListBox &output)
{
// TODO (Validation#1#): Pokemod Validation
}
@@ -55,7 +55,7 @@ void PokeGen::PokeMod::PokeMod::ImportIni(std::ifstream &fin)
// TODO (Xml#1#): Import Pokemod from XML
}
-void PokeGen::PokeMod::PokeMod::ExportXml(std::ofstream &fout)
+void PokeGen::PokeMod::PokeMod::ExportIni(std::ofstream &fout)
{
// TODO (Xml#1#): Export Pokemod to XML
}
diff --git a/pokemod/PokemonAbility.cpp b/pokemod/PokemonAbility.cpp
index 33035db1..d67c510d 100644
--- a/pokemod/PokemonAbility.cpp
+++ b/pokemod/PokemonAbility.cpp
@@ -37,7 +37,7 @@ PokeGen::PokeMod::PokemonAbility::PokemonAbility(Ini &ini, unsigned _id)
{
LogCtorIni("PokemonAbility", _id);
ImportIni(ini, _id);
- if(_id == UINT_MAX)
+ if (id == UINT_MAX)
LogIdError("PokemonAbility");
}
@@ -101,11 +101,11 @@ void PokeGen::PokeMod::PokemonAbility::ImportIni(Ini &ini, unsigned _id)
LogImportOver("PokemonAbility", id);
}
-void PokeGen::PokeMod::PokemonAbility::ExportIni(std::ofstream &fout) const
+void PokeGen::PokeMod::PokemonAbility::ExportIni(std::ofstream &fout, const String &pokemon) const
{
LogExportStart("PokemonAbility", id);
// Make elements
- Ini exPokemonAbility("pokemonAbility");
+ Ini exPokemonAbility(pokemon + " pokemonAbility");
exPokemonAbility.AddField("id", id);
exPokemonAbility.AddField("ability", ability);
exPokemonAbility.AddField("weight", weight);
diff --git a/pokemod/PokemonAbility.h b/pokemod/PokemonAbility.h
index eee13a26..133b6146 100644
--- a/pokemod/PokemonAbility.h
+++ b/pokemod/PokemonAbility.h
@@ -40,7 +40,7 @@ namespace PokeGen
~PokemonAbility();
void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
- void ExportIni(std::ofstream &fout) const;
+ void ExportIni(std::ofstream &fout, const String &pokemon) const;
void SetAbility(int a);
void SetAbility(const String &a);
diff --git a/pokemod/PokemonEvolution.cpp b/pokemod/PokemonEvolution.cpp
index c355a89c..89cc45eb 100644
--- a/pokemod/PokemonEvolution.cpp
+++ b/pokemod/PokemonEvolution.cpp
@@ -40,7 +40,7 @@ PokeGen::PokeMod::PokemonEvolution::PokemonEvolution(Ini &ini, unsigned _id)
{
LogCtorIni("PokemonEvolution", _id);
ImportIni(ini);
- if(_id == UINT_MAX)
+ if (id == UINT_MAX)
LogIdError("PokemonEvolution");
}
@@ -129,11 +129,11 @@ void PokeGen::PokeMod::PokemonEvolution::ImportIni(Ini &ini, unsigned _id)
LogImportOver("PokemonEvolution", id);
}
-void PokeGen::PokeMod::PokemonEvolution::ExportIni(std::ofstream &fout) const
+void PokeGen::PokeMod::PokemonEvolution::ExportIni(std::ofstream &fout, const String &pokemon) const
{
LogExportStart("PokemonEvolution", id);
// Make elements
- Ini exPokemonEvolution("PokemonEvolution");
+ Ini exPokemonEvolution(pokemon + " pokemonEvolution");
exPokemonEvolution.AddField("id", id);
exPokemonEvolution.AddField("species", species);
exPokemonEvolution.AddField("style", style);
diff --git a/pokemod/PokemonEvolution.h b/pokemod/PokemonEvolution.h
index 537b5283..554e0ed2 100644
--- a/pokemod/PokemonEvolution.h
+++ b/pokemod/PokemonEvolution.h
@@ -40,7 +40,7 @@ namespace PokeGen
~PokemonEvolution();
void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
- void ExportIni(std::ofstream &fout) const;
+ void ExportIni(std::ofstream &fout, const String &pokemon) const;
void SetSpecies(int s);
void SetSpecies(const String &s);
diff --git a/pokemod/PokemonItem.cpp b/pokemod/PokemonItem.cpp
index 7c47ee4d..906f2080 100644
--- a/pokemod/PokemonItem.cpp
+++ b/pokemod/PokemonItem.cpp
@@ -37,7 +37,7 @@ PokeGen::PokeMod::PokemonItem::PokemonItem(Ini &ini, unsigned _id)
{
LogCtorIni("PokemonItem", _id);
ImportIni(ini, _id);
- if(_id == UINT_MAX)
+ if (id == UINT_MAX)
LogIdError("PokemonItem");
}
@@ -64,7 +64,7 @@ void PokeGen::PokeMod::PokemonItem::Validate()
}
#ifdef PG_DEBUG_WINDOW
-void PokeGen::PokeMod::PokemonItem::Validate(wxListBox &output)
+void PokeGen::PokeMod::PokemonItem::Validate(const wxListBox &output)
{
isValid = true;
LogValidateStart("PokemonItem Validation: Starting", PM_DEBUG_INFO);
@@ -101,11 +101,11 @@ void PokeGen::PokeMod::PokemonItem::ImportIni(Ini &ini, unsigned _id)
LogImportOver("PokemonItem", id);
}
-void PokeGen::PokeMod::PokemonItem::ExportIni(std::ofstream &fout) const
+void PokeGen::PokeMod::PokemonItem::ExportIni(std::ofstream &fout, const String &pokemon) const
{
LogExportStart("PokemonItem", id);
// Make elements
- Ini exPokemonItem("pokemonItem");
+ Ini exPokemonItem(pokemon + " pokemonItem");
exPokemonItem.AddField("id", id);
exPokemonItem.AddField("item", item);
exPokemonItem.AddField("weight", weight);
diff --git a/pokemod/PokemonItem.h b/pokemod/PokemonItem.h
index 72e3747f..b1fe7673 100644
--- a/pokemod/PokemonItem.h
+++ b/pokemod/PokemonItem.h
@@ -40,7 +40,7 @@ namespace PokeGen
~PokemonItem();
void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
- void ExportIni(std::ofstream &fout) const;
+ void ExportIni(std::ofstream &fout, const String &pokemon) const;
void SetItem(int i);
void SetItem(const String &i);
diff --git a/pokemod/PokemonMove.cpp b/pokemod/PokemonMove.cpp
index 6af754d7..39709094 100644
--- a/pokemod/PokemonMove.cpp
+++ b/pokemod/PokemonMove.cpp
@@ -38,7 +38,7 @@ PokeGen::PokeMod::PokemonMove::PokemonMove(Ini &ini, unsigned _id)
{
LogCtorIni("PokemonMove", _id);
ImportIni(ini);
- if(_id == UINT_MAX)
+ if (id == UINT_MAX)
LogIdError("PokemonMove");
}
@@ -114,11 +114,11 @@ void PokeGen::PokeMod::PokemonMove::ImportIni(Ini &ini, unsigned _id)
LogImportOver("PokemonMove", id);
}
-void PokeGen::PokeMod::PokemonMove::ExportIni(std::ofstream &fout) const
+void PokeGen::PokeMod::PokemonMove::ExportIni(std::ofstream &fout, const String &pokemon) const
{
LogExportStart("PokemonMove", id);
// Make elements
- Ini exPokemonMove("pokemonMove");
+ Ini exPokemonMove(pokemon + " pokemonMove");
exPokemonMove.AddField("id", id);
exPokemonMove.AddField("move", move);
exPokemonMove.AddField("level", level);
diff --git a/pokemod/PokemonMove.h b/pokemod/PokemonMove.h
index e97092c4..449bfec0 100644
--- a/pokemod/PokemonMove.h
+++ b/pokemod/PokemonMove.h
@@ -40,7 +40,7 @@ namespace PokeGen
~PokemonMove();
void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
- void ExportIni(std::ofstream &fout) const;
+ void ExportIni(std::ofstream &fout, const String &pokemon) const;
void SetMove(int m);
void SetMove(const String &m);
diff --git a/pokemod/PokemonNature.cpp b/pokemod/PokemonNature.cpp
index 7bc972bc..ead7cd2f 100644
--- a/pokemod/PokemonNature.cpp
+++ b/pokemod/PokemonNature.cpp
@@ -37,7 +37,7 @@ PokeGen::PokeMod::PokemonNature::PokemonNature(Ini &ini, unsigned _id)
{
LogCtorIni("PokemonNature", _id);
ImportIni(ini, _id);
- if(_id == UINT_MAX)
+ if (id == UINT_MAX)
LogIdError("PokemonNature");
}
@@ -101,11 +101,11 @@ void PokeGen::PokeMod::PokemonNature::ImportIni(Ini &ini, unsigned _id)
LogImportOver("PokemonNature", id);
}
-void PokeGen::PokeMod::PokemonNature::ExportIni(std::ofstream &fout) const
+void PokeGen::PokeMod::PokemonNature::ExportIni(std::ofstream &fout, const String &pokemon) const
{
LogExportStart("PokemonNature", id);
// Make elements
- Ini exPokemonNature("PokemonNature");
+ Ini exPokemonNature(pokemon + " pokemonNature");
exPokemonNature.AddField("id", id);
exPokemonNature.AddField("nature", nature);
exPokemonNature.AddField("weight", weight);
diff --git a/pokemod/PokemonNature.h b/pokemod/PokemonNature.h
index 09cd7e7d..7d0c6c56 100644
--- a/pokemod/PokemonNature.h
+++ b/pokemod/PokemonNature.h
@@ -40,7 +40,7 @@ namespace PokeGen
~PokemonNature();
void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
- void ExportIni(std::ofstream &fout) const;
+ void ExportIni(std::ofstream &fout, const String &pokemon) const;
void SetNature(int n);
void SetNature(const String &n);
diff --git a/pokemod/Store.cpp b/pokemod/Store.cpp
index 555d6d68..05315a43 100644
--- a/pokemod/Store.cpp
+++ b/pokemod/Store.cpp
@@ -37,7 +37,7 @@ PokeGen::PokeMod::Store::Store(Ini &ini, unsigned _id)
{
LogCtorIni("Store", _id);
ImportIni(ini);
- if(_id == UINT_MAX)
+ if (id == UINT_MAX)
LogIdError("Store");
}
diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp
index 4e61f48c..453401c7 100644
--- a/pokemod/Time.cpp
+++ b/pokemod/Time.cpp
@@ -36,7 +36,7 @@ PokeGen::PokeMod::Time::Time(Ini &ini, unsigned _id)
{
LogCtorIni("Time", _id);
ImportIni(ini, _id);
- if(_id == UINT_MAX)
+ if (id == UINT_MAX)
LogIdError("Time");
}