summaryrefslogtreecommitdiffstats
path: root/pokemod/Dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod/Dialog.cpp')
-rw-r--r--pokemod/Dialog.cpp249
1 files changed, 123 insertions, 126 deletions
diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp
index e0a7d3d2..aae66688 100644
--- a/pokemod/Dialog.cpp
+++ b/pokemod/Dialog.cpp
@@ -1,26 +1,21 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokemod/Dialog.cpp
-// Purpose: Define a dialog in a PokéMod
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Wed Feb 28 21:05:56 2007
-// Copyright: ©2007-2008 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 3 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, see <http://www.gnu.org/licenses/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
-#include "Pokemod.h"
+// Pokemod includes
#include "Item.h"
#include "ItemEffect.h"
#include "Map.h"
@@ -28,52 +23,55 @@
#include "MapTrainer.h"
#include "MapWarp.h"
#include "Move.h"
+#include "Pokemod.h"
#include "Species.h"
+
+// Header include
#include "Dialog.h"
const QStringList Dialog::CommandStr = QStringList() << "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 QStringList Dialog::CommandAbbrStr = QStringList() << "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 QList<int> Dialog::CommandNumArgs = QList<int>() << 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 << 2 << 1 << 3 << 1 << 1 << 3 << 0 << 0 << 0 << 0 << 0 << 0;
-Dialog::Dialog(const Pokemod* par, const int _id) :
- Object("Dialog", par, _id),
- dialog("")
+Dialog::Dialog(const Pokemod* pokemod, const int id) :
+ Object("Dialog", pokemod, id),
+ m_dialog("")
{
}
-Dialog::Dialog(const Pokemod* par, const Dialog& d, const int _id) :
- Object("Dialog", par, _id)
+Dialog::Dialog(const Pokemod* pokemod, const Dialog& dialog, const int id) :
+ Object("Dialog", pokemod, id)
{
- *this = d;
+ *this = dialog;
}
-Dialog::Dialog(const Pokemod* par, const QString& fname, const int _id) :
- Object("Dialog", par, _id)
+Dialog::Dialog(const Pokemod* pokemod, const QString& fileName, const int id) :
+ Object("Dialog", pokemod, id)
{
- load(fname, _id);
+ load(fileName, id);
}
bool Dialog::validate() const
{
bool valid = true;
- pokemod->validationMsg(QString("---Dialog with id %1---").arg(id), Pokemod::V_Msg);
- if (dialog == "")
+ pokemod()->validationMsg(QString("---Dialog with id %1---").arg(id()), Pokemod::V_Msg);
+ if (m_dialog == "")
{
- pokemod->validationMsg("Dialog is empty");
+ pokemod()->validationMsg("Dialog is empty");
valid = false;
}
- if (dialog.count('%') & 1)
+ if (m_dialog.count('%') & 1)
{
- pokemod->validationMsg("Command delimiter mismatch");
+ pokemod()->validationMsg("Command delimiter mismatch");
valid = false;
}
else
{
int curCmd = End;
int numArgs = 0;
- for (int i = 0; i < dialog.length(); ++i)
+ for (int i = 0; i < m_dialog.length(); ++i)
{
- switch (dialog.at(i).toAscii())
+ switch (m_dialog.at(i).toAscii())
{
case '%':
switch (curCmd)
@@ -81,26 +79,26 @@ bool Dialog::validate() const
case FlipFlag ... Exit:
if (numArgs != CommandNumArgs[curCmd])
{
- pokemod->validationMsg(QString("Invalid number of arguments for \"%1\". %2 given when %3 needed").arg(CommandStr[curCmd]).arg(numArgs).arg(CommandNumArgs[curCmd]));
+ pokemod()->validationMsg(QString("Invalid number of arguments for \"%1\". %2 given when %3 needed").arg(CommandStr[curCmd]).arg(numArgs).arg(CommandNumArgs[curCmd]));
valid = false;
}
break;
case Menu:
if (!(numArgs & 1))
{
- pokemod->validationMsg("Invalid number of arguments for Menu");
+ pokemod()->validationMsg("Invalid number of arguments for Menu");
valid = false;
}
break;
case End:
QString curCmdStr;
- for (; (dialog.at(i) != '%') && (dialog.at(i) != '#'); ++i)
- curCmdStr += dialog.at(i);
- if (((curCmd = CommandAbbrStr.indexOf(curCmdStr))) == -1)
+ for (; (m_dialog.at(i) != '%') && (m_dialog.at(i) != '#'); ++i)
+ curCmdStr += m_dialog.at(i);
+ if (((curCmd = CommandAbbrStr.indexOf(curCmdStr))) == INT_MAX)
{
if (curCmdStr != "")
{
- pokemod->validationMsg(QString("Invalid command \"%1\"").arg(curCmdStr));
+ pokemod()->validationMsg(QString("Invalid command \"%1\"").arg(curCmdStr));
valid = false;
}
curCmd = End;
@@ -113,8 +111,8 @@ bool Dialog::validate() const
if (curCmd != End)
{
QString arg;
- for (; (dialog.at(i) != '%') && (dialog.at(i) != '#'); ++i)
- arg += dialog.at(i);
+ for (; (m_dialog.at(i) != '%') && (m_dialog.at(i) != '#'); ++i)
+ arg += m_dialog.at(i);
bool ok;
int temp = arg.toInt(&ok);
int invError = 0;
@@ -130,7 +128,7 @@ bool Dialog::validate() const
{
if (!ok)
{
- pokemod->validationMsg(QString("Bad flag in \"%1\"").arg(CommandStr[curCmd]));
+ pokemod()->validationMsg(QString("Bad flag in \"%1\"").arg(CommandStr[curCmd]));
valid = false;
}
}
@@ -145,13 +143,13 @@ bool Dialog::validate() const
case 2:
if (!ok)
{
- pokemod->validationMsg("Bad flag in \"Test Flag\"");
+ pokemod()->validationMsg("Bad flag in \"Test Flag\"");
valid = false;
}
break;
case 3:
case 4:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
}
break;
@@ -163,7 +161,7 @@ bool Dialog::validate() const
}
else if (numArgs == 2)
{
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = 2;
}
break;
@@ -177,14 +175,14 @@ bool Dialog::validate() const
break;
case 2:
case 3:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
}
break;
case ItemShop:
if (numArgs == 1)
{
- if (!ok || (pokemod->getStoreIndex(temp) == -1))
+ if (!ok || (pokemod()->storeIndex(temp) == INT_MAX))
invError = 1;
}
break;
@@ -198,12 +196,12 @@ bool Dialog::validate() const
invError = 1;
break;
case 2:
- if (!ok || (pokemod->getItemIndex(temp) == -1))
+ if (!ok || (pokemod()->itemIndex(temp) == INT_MAX))
invError = 2;
break;
case 3:
case 4:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
break;
}
@@ -211,7 +209,7 @@ bool Dialog::validate() const
case CoinList:
if (numArgs == 1)
{
- if (!ok || (pokemod->getCoinListIndex(temp) == -1))
+ if (!ok || (pokemod()->coinListIndex(temp) == INT_MAX))
invError = 1;
}
break;
@@ -223,13 +221,13 @@ bool Dialog::validate() const
invError = 1;
break;
case 2:
- if (!ok || (pokemod->getMoveIndex(temp) == -1))
+ if (!ok || (pokemod()->moveIndex(temp) == INT_MAX))
invError = 2;
break;
case 3:
case 4:
case 5:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
break;
}
@@ -246,12 +244,12 @@ bool Dialog::validate() const
invError = 2;
break;
case 3:
- if (!ok || (pokemod->getMoveIndex(temp) == -1))
+ if (!ok || (pokemod()->moveIndex(temp) == INT_MAX))
invError = 3;
break;
case 4:
case 5:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
break;
}
@@ -264,7 +262,7 @@ bool Dialog::validate() const
invError = 1;
break;
case 2:
- if (!ok || (pokemod->getSpeciesIndex(temp) ==-1))
+ if (!ok || (pokemod()->speciesIndex(temp) ==INT_MAX))
invError = 2;
break;
case 3:
@@ -274,9 +272,9 @@ bool Dialog::validate() const
case 4:
if (ok)
{
- if (pokemod->getRules()->getMaxLevel() < temp)
+ if (pokemod()->rules()->maxLevel() < temp)
{
- pokemod->validationMsg("Higher level than allowed in \"Give Pokémon\"");
+ pokemod()->validationMsg("Higher level than allowed in \"Give Pokémon\"");
valid = false;
}
}
@@ -289,7 +287,7 @@ bool Dialog::validate() const
break;
case 6:
case 7:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
break;
}
@@ -304,12 +302,12 @@ bool Dialog::validate() const
invError = 1;
break;
case 2:
- if (!ok || (pokemod->getSpeciesIndex(temp) == -1))
+ if (!ok || (pokemod()->speciesIndex(temp) == INT_MAX))
invError = 2;
break;
case 3:
case 4:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
break;
}
@@ -317,7 +315,7 @@ bool Dialog::validate() const
case ShowPokemon:
if (numArgs == 1)
{
- if (!ok || (pokemod->getSpeciesIndex(temp) == -1))
+ if (!ok || (pokemod()->speciesIndex(temp) == INT_MAX))
invError = 1;
}
break;
@@ -326,9 +324,9 @@ bool Dialog::validate() const
{
if (ok)
{
- if (pokemod->getRules()->getMaxMoney() < temp)
+ if (pokemod()->rules()->maxMoney() < temp)
{
- pokemod->validationMsg("More money given than can be held in \"Give Money\"", Pokemod::V_Warn);
+ pokemod()->validationMsg("More money given than can be held in \"Give Money\"", Pokemod::V_Warn);
valid = false;
}
}
@@ -346,9 +344,9 @@ bool Dialog::validate() const
case 2:
if (ok)
{
- if (pokemod->getRules()->getMaxMoney() < temp)
+ if (pokemod()->rules()->maxMoney() < temp)
{
- pokemod->validationMsg("More money taken than can be held in \"Take Money\"");
+ pokemod()->validationMsg("More money taken than can be held in \"Take Money\"");
valid = false;
}
}
@@ -357,7 +355,7 @@ bool Dialog::validate() const
break;
case 3:
case 4:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
break;
}
@@ -371,19 +369,19 @@ bool Dialog::validate() const
invError = 1;
break;
case 2:
- if (!ok || (pokemod->getMapIndex(temp) == -1))
+ if (!ok || (pokemod()->mapIndex(temp) == INT_MAX))
invError = 2;
else
- map = pokemod->getMapByID(temp);
+ map = pokemod()->mapById(temp);
break;
case 3:
if (map)
{
- if (!ok || (map->getEffectIndex(temp) == -1))
+ if (!ok || (map->effectIndex(temp) == INT_MAX))
invError = 3;
}
- else if ((arg != "Player") && (arg != "-1"))
- pokemod->validationMsg(QString("Unable to validate argument #3 in \"%1\"").arg(CommandStr[curCmd]));
+ else if ((arg != "Player") && (arg != "INT_MAX"))
+ pokemod()->validationMsg(QString("Unable to validate argument #3 in \"%1\"").arg(CommandStr[curCmd]));
break;
case 4:
if ((arg != "Up") && (arg != "Down") && (arg != "Left") && (arg != "Right") && ((arg != "Random") || (curCmd == CheckDirection)) && (arg != "0") && (arg != "1") && (arg != "2") && (arg != "3") && ((arg != "4") || (curCmd == CheckDirection)))
@@ -391,7 +389,7 @@ bool Dialog::validate() const
break;
case 5:
case 6:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
break;
}
@@ -400,19 +398,19 @@ bool Dialog::validate() const
switch (numArgs)
{
case 1:
- if (!ok || (pokemod->getMapIndex(temp) == -1))
+ if (!ok || (pokemod()->mapIndex(temp) == INT_MAX))
invError = 1;
else
- map = pokemod->getMapByID(temp);
+ map = pokemod()->mapById(temp);
break;
case 2:
if (map)
{
- if (!ok || (map->getEffectIndex(temp) == -1))
+ if (!ok || (map->effectIndex(temp) == INT_MAX))
invError = 2;
}
- else if ((arg != "Player") && (arg != "-1"))
- pokemod->validationMsg("Unable to validate argument #2 in \"Turn Effect\"");
+ else if ((arg != "Player") && (arg != "INT_MAX"))
+ pokemod()->validationMsg("Unable to validate argument #2 in \"Turn Effect\"");
map = NULL;
break;
case 3:
@@ -437,9 +435,9 @@ bool Dialog::validate() const
case 3:
if (ok)
{
- if (((curCmd == CheckRoster) ? pokemod->getRules()->getMaxParty() : ((curCmd == CheckLevels) ? pokemod->getRules()->getMaxLevel() : pokemod->getRules()->getMaxMoney())) < temp)
+ if (((curCmd == CheckRoster) ? pokemod()->rules()->maxParty() : ((curCmd == CheckLevels) ? pokemod()->rules()->maxLevel() : pokemod()->rules()->maxMoney())) < temp)
{
- pokemod->validationMsg(QString("More %1 than can be carried in \"%2\"").arg((curCmd == CheckRoster) ? "party members" : ((curCmd == CheckLevels) ? "level" : "money")).arg(CommandStr[curCmd]));
+ pokemod()->validationMsg(QString("More %1 than can be carried in \"%2\"").arg((curCmd == CheckRoster) ? "party members" : ((curCmd == CheckLevels) ? "level" : "money")).arg(CommandStr[curCmd]));
valid = false;
}
}
@@ -448,7 +446,7 @@ bool Dialog::validate() const
break;
case 4:
case 5:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
break;
}
@@ -463,7 +461,7 @@ bool Dialog::validate() const
case 2:
case 3:
case 4:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
}
break;
@@ -476,7 +474,7 @@ bool Dialog::validate() const
break;
case 2:
case 3:
- if (!ok || (pokemod->getSpeciesIndex(temp) == -1))
+ if (!ok || (pokemod()->speciesIndex(temp) == INT_MAX))
invError = numArgs;
case 4:
if (!ok)
@@ -484,7 +482,7 @@ bool Dialog::validate() const
break;
case 5:
case 6:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = numArgs;
break;
}
@@ -499,47 +497,47 @@ bool Dialog::validate() const
case Battle:
if (numArgs == 1)
{
- if (!ok || (pokemod->getMapIndex(temp) == -1))
+ if (!ok || (pokemod()->mapIndex(temp) == INT_MAX))
invError = 1;
else
- map = pokemod->getMapByID(temp);
+ map = pokemod()->mapById(temp);
}
else if (numArgs == 2)
{
if (map)
{
- if (!ok || (map->getTrainerIndex(temp) == -1))
+ if (!ok || (map->trainerIndex(temp) == INT_MAX))
invError = 2;
}
else
- pokemod->validationMsg("Unable to validate argument #2 in \"Battle\"");
+ pokemod()->validationMsg("Unable to validate argument #2 in \"Battle\"");
map = NULL;
}
break;
case Badge:
if (numArgs == 1)
{
- if (!ok || (pokemod->getBadgeIndex(temp) == -1))
+ if (!ok || (pokemod()->badgeIndex(temp) == INT_MAX))
invError = 1;
}
break;
case Warp:
if (numArgs == 1)
{
- if (!ok || (pokemod->getMapIndex(temp) == -1))
+ if (!ok || (pokemod()->mapIndex(temp) == INT_MAX))
invError = 1;
else
- map = pokemod->getMapByID(temp);
+ map = pokemod()->mapById(temp);
}
else if (numArgs == 2)
{
if (map)
{
- if (!ok || (map->getWarpIndex(temp) == -1))
+ if (!ok || (map->warpIndex(temp) == INT_MAX))
invError = 2;
}
else
- pokemod->validationMsg("Unable to validate argument #2 in \"Warp\"");
+ pokemod()->validationMsg("Unable to validate argument #2 in \"Warp\"");
map = NULL;
}
break;
@@ -554,14 +552,14 @@ bool Dialog::validate() const
case Music:
if (numArgs == 1)
{
- if (!QFile(QString("%1/music/%2").arg(pokemod->getPath()).arg(arg)).exists())
+ if (!QFile(QString("%1/music/%2").arg(pokemod()->path()).arg(arg)).exists())
invError = 1;
}
break;
case SoundEffect:
if (numArgs == 1)
{
- if (!QFile(QString("%1/sound/%2").arg(pokemod->getPath()).arg(arg)).exists())
+ if (!QFile(QString("%1/sound/%2").arg(pokemod()->path()).arg(arg)).exists())
invError = 1;
}
else if (numArgs == 2)
@@ -582,7 +580,7 @@ bool Dialog::validate() const
invError = 2;
break;
case 3:
- if (!ok || (pokemod->getDialogIndex(temp) == -1))
+ if (!ok || (pokemod()->dialogIndex(temp) == INT_MAX))
invError = 3;
break;
}
@@ -598,18 +596,18 @@ bool Dialog::validate() const
switch (numArgs)
{
case 1:
- if (ok && (pokemod->getItemIndex(temp) != -1))
+ if (ok && (pokemod()->itemIndex(temp) != INT_MAX))
{
- const Item* item = pokemod->getItemByID(temp);
+ const Item* item = pokemod()->itemById(temp);
bool temp = false;
- for (int i = 0; (i < item->getEffectCount()) || !temp; ++i)
+ for (int i = 0; (i < item->effectCount()) || !temp; ++i)
{
- if (item->getEffect(i)->getEffect() == ItemEffect::E_Ball)
+ if (item->effect(i)->effect() == ItemEffect::E_Ball)
temp = true;
}
if (!temp)
{
- pokemod->validationMsg("Item in argument #1 in \"Safari\" isn\'t a PokéBall");
+ pokemod()->validationMsg("Item in argument #1 in \"Safari\" isn\'t a PokéBall");
valid = false;
}
}
@@ -621,7 +619,7 @@ bool Dialog::validate() const
invError = 2;
break;
case 3:
- if (!ok || (pokemod->getRules()->getMaxParty() < temp))
+ if (!ok || (pokemod()->rules()->maxParty() < temp))
invError = 3;
break;
}
@@ -636,7 +634,7 @@ bool Dialog::validate() const
{
if (ok)
{
- if (pokemod->getDialogIndex(temp) == -1)
+ if (pokemod()->dialogIndex(temp) == INT_MAX)
invError = numArgs;
}
else
@@ -648,7 +646,7 @@ bool Dialog::validate() const
}
if (invError)
{
- pokemod->validationMsg(QString("Invalid argument #%1 in \"%2\"").arg(invError).arg(CommandStr[curCmd]));
+ pokemod()->validationMsg(QString("Invalid argument #%1 in \"%2\"").arg(invError).arg(CommandStr[curCmd]));
valid = false;
}
}
@@ -659,45 +657,44 @@ bool Dialog::validate() const
return valid;
}
-void Dialog::load(const QString& fname, const int _id) throw(Exception)
+void Dialog::load(const QString& fileName, int id) throw(Exception)
{
- Ini ini(fname);
- if (_id == -1)
+ Ini ini(fileName);
+ if (id == INT_MAX)
ini.getValue("id", id);
- else
- id = _id;
- ini.getValue(className, dialog);
+ setId(id);
+ ini.getValue("dialog", m_dialog);
}
void Dialog::save() const throw(Exception)
{
Ini ini;
- ini.addField("id", id);
- ini.addField(className, dialog);
- ini.save(QString("%1/dialog/%2.pini").arg(pokemod->getPath()).arg(id));
+ ini.addField("id", id());
+ ini.addField("dialog", m_dialog);
+ ini.save(QString("%1/dialog/%2.pini").arg(pokemod()->path()).arg(id()));
}
-void Dialog::setDialog(const QString& d)
+void Dialog::setDialog(const QString& dialog)
{
- dialog = d;
+ m_dialog = dialog;
}
-QString Dialog::getDialog() const
+QString Dialog::dialog() const
{
- return dialog;
+ return m_dialog;
}
-void Dialog::insertDialogCommand(const QString& cmd, const int pos) throw(BoundsException)
+void Dialog::insertCommand(const int position, const QString& command) throw(BoundsException)
{
- if (dialog.length() < pos)
- throw(BoundsException(className , "command"));
- dialog.insert(pos, cmd);
+ if (m_dialog.length() < position)
+ throw(BoundsException(className(), "command"));
+ m_dialog.insert(position, command);
}
Dialog& Dialog::operator=(const Dialog& rhs)
{
if (this == &rhs)
return *this;
- dialog = rhs.dialog;
+ m_dialog = rhs.m_dialog;
return *this;
}