summaryrefslogtreecommitdiffstats
path: root/pokemod/MapWildList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod/MapWildList.cpp')
-rw-r--r--pokemod/MapWildList.cpp69
1 files changed, 8 insertions, 61 deletions
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
index df47e517..b9fec1f1 100644
--- a/pokemod/MapWildList.cpp
+++ b/pokemod/MapWildList.cpp
@@ -20,7 +20,6 @@
// Pokemod includes
#include "Item.h"
-#include "ItemEffect.h"
#include "Map.h"
#include "MapWildListEncounter.h"
#include "Pokemod.h"
@@ -39,8 +38,7 @@ MapWildList::MapWildList(const MapWildList& wildList) :
MapWildList::MapWildList(const Map* parent, const int id) :
Object("MapWildList", parent, id),
m_control(INT_MAX),
- m_value(INT_MAX),
- m_scope(INT_MAX)
+ m_script("", "")
{
}
@@ -64,9 +62,7 @@ MapWildList::~MapWildList()
void MapWildList::validate()
{
TEST(setControl, control);
- TEST(setValue, value);
TEST_LIST(setTime, time);
- TEST(setScope, scope);
if (!encounterCount())
emit(error("There are no encounters"));
QSet<int> idChecker;
@@ -83,9 +79,8 @@ void MapWildList::load(const QDomElement& xml, int id)
{
LOAD_ID();
LOAD(int, control);
- LOAD(int, value);
+ LOAD(Script, script);
LOAD_LIST(int, time);
- LOAD(int, scope);
LOAD_SUB(newEncounter, MapWildListEncounter);
}
@@ -93,9 +88,8 @@ QDomElement MapWildList::save() const
{
SAVE_CREATE();
SAVE(int, control);
- SAVE(int, value);
+ SAVE(Script, script);
SAVE_LIST(int, time);
- SAVE(int, scope);
SAVE_SUB(MapWildListEncounter, encounters);
return xml;
}
@@ -110,27 +104,9 @@ void MapWildList::setControl(const int control)
CHECK(control);
}
-void MapWildList::setValue(const int value)
+void MapWildList::setScript(const Script& script)
{
- if (m_control != Fishing)
- {
- emit(warning(unused("value")));
- return;
- }
- for (int i = 0; (i < static_cast<const Pokemod*>(pokemod())->itemCount()); ++i)
- {
- const Item* item = static_cast<const Pokemod*>(pokemod())->item(i);
- for (int j = 0; (j < item->effectCount()); ++j)
- {
- const ItemEffect* effect = item->effect(j);
- if ((effect->effect() == ItemEffect::E_Fish) && (effect->value2() == value))
- {
- CHECK(value);
- return;
- }
- }
- }
- emit(error(bounds("value")));
+ CHECK(script);
}
void MapWildList::setTime(const int time, const bool state)
@@ -155,37 +131,14 @@ void MapWildList::setTime(const int time, const bool state)
}
}
-void MapWildList::setScope(const int scope)
-{
- if (scope != INT_MAX)
- {
- for (int i = 0; (i < static_cast<const Pokemod*>(pokemod())->itemCount()); ++i)
- {
- const Item* item = static_cast<const Pokemod*>(pokemod())->item(i);
- for (int j = 0; (j < item->effectCount()); ++j)
- {
- const ItemEffect* effect = item->effect(j);
- if ((effect->effect() == ItemEffect::E_Scope) && (effect->value2() == scope))
- {
- CHECK(scope);
- return;
- }
- }
- }
- emit(error(bounds("value")));
- }
- else
- CHECK(scope);
-}
-
int MapWildList::control() const
{
return m_control;
}
-int MapWildList::value() const
+Script MapWildList::script() const
{
- return m_value;
+ return m_script;
}
bool MapWildList::time(const int time) const
@@ -193,11 +146,6 @@ bool MapWildList::time(const int time) const
return m_time.contains(time);
}
-int MapWildList::scope() const
-{
- return m_scope;
-}
-
const MapWildListEncounter* MapWildList::encounter(const int index) const
{
if (encounterCount() <= index)
@@ -285,9 +233,8 @@ MapWildList& MapWildList::operator=(const MapWildList& rhs)
return *this;
clear();
COPY(control);
- COPY(value);
+ COPY(script);
COPY(time);
- COPY(scope);
COPY_SUB(MapWildListEncounter, encounters);
return *this;
}