summaryrefslogtreecommitdiffstats
path: root/pokemod/MapWildList.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-03 10:45:40 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-03 10:45:40 +0000
commit8714e1d409f46b05980b3e1e9f3a10910294b429 (patch)
tree5d4931ed73a4947df329c6825474ddb902c465b8 /pokemod/MapWildList.cpp
parent822b5fcaa34b78b9668a58680f9e0d89aa3fd7bd (diff)
downloadsigen-8714e1d409f46b05980b3e1e9f3a10910294b429.tar.gz
sigen-8714e1d409f46b05980b3e1e9f3a10910294b429.tar.xz
sigen-8714e1d409f46b05980b3e1e9f3a10910294b429.zip
[FIX] pokemod now uses signals/slots for errors and warnings
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@120 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/MapWildList.cpp')
-rw-r--r--pokemod/MapWildList.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
index ff092db2..3c2f25f4 100644
--- a/pokemod/MapWildList.cpp
+++ b/pokemod/MapWildList.cpp
@@ -21,6 +21,7 @@
// Pokemod includes
#include "Item.h"
#include "ItemEffect.h"
+#include "Map.h"
#include "MapWildListEncounter.h"
#include "Pokemod.h"
@@ -35,7 +36,7 @@ MapWildList::MapWildList(const MapWildList& wildList) :
*this = wildList;
}
-MapWildList::MapWildList(const Object* parent, const int id) :
+MapWildList::MapWildList(const Map* parent, const int id) :
Object("MapWildList", parent, id),
m_control(INT_MAX),
m_value(INT_MAX),
@@ -43,13 +44,13 @@ MapWildList::MapWildList(const Object* parent, const int id) :
{
}
-MapWildList::MapWildList(const MapWildList& wildList, const Object* parent, const int id) :
+MapWildList::MapWildList(const MapWildList& wildList, const Map* parent, const int id) :
Object("MapWildList", parent, id)
{
*this = wildList;
}
-MapWildList::MapWildList(const QDomElement& xml, const Object* parent, const int id) :
+MapWildList::MapWildList(const QDomElement& xml, const Map* parent, const int id) :
Object("MapWildList", parent, id)
{
load(xml, id);
@@ -60,22 +61,20 @@ MapWildList::~MapWildList()
clear();
}
-void MapWildList::validate(QTextStream& stream)
+void MapWildList::validate()
{
- TEST_SETUP();
TEST(setControl, control);
TEST(setValue, value);
TEST_LIST(setTime, time);
TEST(setScope, scope);
if (!encounterCount())
- error(stream, "There are no encounters");
+ emit(error("There are no encounters"));
QSet<int> idChecker;
foreach (MapWildListEncounter* encounter, m_encounters)
{
- if (!encounter->isValid(stream))
- setValid(false);
+ encounter->validate();
if (idChecker.contains(encounter->id()))
- subclassError(stream, "encounter", encounter->id());
+ emit(error(subclass("encounter", encounter->id())));
idChecker.insert(encounter->id());
}
}
@@ -105,7 +104,7 @@ void MapWildList::setControl(const int control)
{
if (End <= control)
{
- boundsError("control");
+ emit(error(bounds("control")));
return;
}
m_control = control;
@@ -116,7 +115,7 @@ void MapWildList::setValue(const int value)
{
if (m_control != Fishing)
{
- unusedError("value");
+ emit(warning(unused("value")));
return;
}
for (int i = 0; (i < static_cast<const Pokemod*>(pokemod())->itemCount()); ++i)
@@ -132,14 +131,14 @@ void MapWildList::setValue(const int value)
}
}
}
- boundsError("value");
+ emit(error(bounds("value")));
}
void MapWildList::setTime(const int time, const bool state)
{
if (static_cast<const Pokemod*>(pokemod())->timeIndex(time) == INT_MAX)
{
- boundsError("time");
+ emit(error(bounds("time")));
return;
}
if (state)
@@ -168,7 +167,7 @@ void MapWildList::setScope(const int scope)
}
}
}
- boundsError("value");
+ emit(error(bounds("value")));
}
else
m_scope = scope;