summaryrefslogtreecommitdiffstats
path: root/pokemod/MapEffect.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/MapEffect.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/MapEffect.cpp')
-rw-r--r--pokemod/MapEffect.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp
index a8a6b5f1..f6fc95b1 100644
--- a/pokemod/MapEffect.cpp
+++ b/pokemod/MapEffect.cpp
@@ -35,7 +35,7 @@ MapEffect::MapEffect(const MapEffect& effect) :
*this = effect;
}
-MapEffect::MapEffect(const Object* parent, const int id) :
+MapEffect::MapEffect(const Map* parent, const int id) :
Object("MapEffect", parent, id),
m_name(""),
m_coordinate(0, 0),
@@ -51,23 +51,22 @@ MapEffect::MapEffect(const Object* parent, const int id) :
{
}
-MapEffect::MapEffect(const MapEffect& effect, const Object* parent, const int id) :
+MapEffect::MapEffect(const MapEffect& effect, const Map* parent, const int id) :
Object("MapEffect", parent, id)
{
*this = effect;
}
-MapEffect::MapEffect(const QDomElement& xml, const Object* parent, const int id) :
+MapEffect::MapEffect(const QDomElement& xml, const Map* parent, const int id) :
Object("MapEffect", parent, id)
{
load(xml, id);
}
-void MapEffect::validate(QTextStream& stream)
+void MapEffect::validate()
{
- TEST_SETUP();
if (m_name.isEmpty())
- error(stream, "Name is empty");
+ emit(error("Name is empty"));
TEST(setCoordinate, coordinate);
TEST(setSkin, skin);
TEST(setEffect, effect);
@@ -119,7 +118,7 @@ void MapEffect::setCoordinate(const Point& coordinate)
{
if ((static_cast<const Map*>(parent())->width() <= coordinate.x()) || (static_cast<const Map*>(parent())->height() <= coordinate.y()))
{
- boundsError("coordinate");
+ emit(error(bounds("coordinate")));
return;
}
m_coordinate = coordinate;
@@ -134,7 +133,7 @@ void MapEffect::setSkin(const QPixmap& skin)
{
if (skin.size() != QSize(192, 128))
{
- sizeError("skin");
+ emit(error(size("skin")));
return;
}
m_skin = skin;
@@ -144,7 +143,7 @@ void MapEffect::setEffect(const int effect)
{
if (E_End <= effect)
{
- boundsError("effect");
+ emit(error(bounds("effect")));
return;
}
m_effect = effect;
@@ -156,7 +155,7 @@ void MapEffect::setValue1(const int value1)
{
if ((m_effect != E_StrengthBlock) && (m_effect != E_Button))
{
- unusedError("val1");
+ emit(warning(unused("val1")));
return;
}
m_value1 = value1;
@@ -169,14 +168,14 @@ void MapEffect::setValue2(const int value2)
case E_Item:
if (static_cast<const Pokemod*>(pokemod())->itemIndex(value2) == INT_MAX)
{
- boundsError("val2");
+ emit(error(bounds("val2")));
return;
}
break;
case E_PC:
if (PC_End <= value2)
{
- boundsError("val2");
+ emit(error(bounds("val2")));
return;
}
break;
@@ -184,12 +183,12 @@ void MapEffect::setValue2(const int value2)
case E_Button:
if (Flag::End <= value2)
{
- boundsError("val2");
+ emit(error(bounds("val2")));
return;
}
break;
default:
- unusedError("val2");
+ emit(warning(unused("val2")));
return;
}
m_value2 = value2;
@@ -199,7 +198,7 @@ void MapEffect::setDirection(const int direction)
{
if (Pokemod::D_End_None <= direction)
{
- boundsError("direction");
+ emit(error(bounds("direction")));
return;
}
m_direction = direction;
@@ -219,7 +218,7 @@ void MapEffect::setDialog(const int dialog)
{
if (static_cast<const Pokemod*>(pokemod())->dialogIndex(dialog) == INT_MAX)
{
- boundsError("dialog");
+ emit(error(bounds("dialog")));
return;
}
m_dialog = dialog;