summaryrefslogtreecommitdiffstats
path: root/pokebattle/Arena.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-06-30 01:37:51 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-06-30 01:37:51 +0000
commita423cf3db8fa90cc09d2f92ff892e4fcdda4af16 (patch)
tree174b821adc5e089a313657499e0df740d7184fca /pokebattle/Arena.cpp
parent300e44b68e075d7fd78287e10262b0d502f4898d (diff)
downloadsigen-a423cf3db8fa90cc09d2f92ff892e4fcdda4af16.tar.gz
sigen-a423cf3db8fa90cc09d2f92ff892e4fcdda4af16.tar.xz
sigen-a423cf3db8fa90cc09d2f92ff892e4fcdda4af16.zip
[FIX] Replaced Point with QPoint (less duplicate code)
[FIX] Fraction and Point widgets are more compact [FIX] Fleshed out more of the TeamMember [FIX] Map tilemap editor now expands to fill all available area [FIX] Added priority values to abilities and moves [FIX] Added option for ATB-like battle rounds git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@217 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokebattle/Arena.cpp')
-rw-r--r--pokebattle/Arena.cpp39
1 files changed, 31 insertions, 8 deletions
diff --git a/pokebattle/Arena.cpp b/pokebattle/Arena.cpp
index a2ece8fa..68d3d6ed 100644
--- a/pokebattle/Arena.cpp
+++ b/pokebattle/Arena.cpp
@@ -26,36 +26,59 @@
// KDE includes
#include <kross/core/action.h>
-#include <kross/core/childreninterface.h>
+#include <kross/core/manager.h>
-int Pokebattle::Arena::m_totalCount = 0;
+QSet<int> Pokebattle::Arena::m_arenaIds;
Pokebattle::Arena::Arena(QList<Player*> players) :
- m_count(m_totalCount),
+ m_id(0),
m_players(players),
- m_actions(new Kross::ActionCollection(QString("arena-%1").arg(m_count), Kross::Manager::self().actionCollection()))
+ m_actions(NULL)
{
connect(this, SIGNAL(battleEnd()), SLOT(cleanUp()));
connect(this, SIGNAL(battleEnd()), SLOT(unregisterAllScripts()));
- ++m_totalCount;
+ for (; (m_id < m_arenaIds.size()) && m_arenaIds.contains(m_id); ++m_id)
+ ;
+ m_arenaIds.insert(m_id);
+ unregisterAllScripts();
+// foreach (Player* player, m_players)
+// {
+// QList<TeamMember*> leadMembers(player->active());
+// foreach (TeamMember* teamMember, leadMembers)
+// {
+// // TODO: load abilities
+// // TODO: connect signals for retreating and fainting to removing abilities
+// }
+// }
}
Pokebattle::Arena::~Arena()
{
- --m_totalCount;
+ m_arenaIds.remove(m_id);
delete m_actions;
}
+Kross::Action* Pokebattle::Arena::script(const QString& name)
+{
+ return m_actions->action(name);
+}
+
void Pokebattle::Arena::registerScript(const QString& name, const Pokemod::Script& script)
{
Kross::Action* action = new Kross::Action(m_actions, name);
action->setInterpreter(script.interpreter());
action->setCode(script.script().toUtf8());
action->addObject(this, "arena", Kross::ChildrenInterface::AutoConnectSignals);
- action->trigger();
m_actions->addAction(action);
}
+void Pokebattle::Arena::triggerScript(const QString& name)
+{
+ Kross::Action* action = m_actions->action(name);
+ if (action)
+ action->trigger();
+}
+
void Pokebattle::Arena::unregisterScript(const QString& name)
{
m_actions->removeAction(name);
@@ -64,7 +87,7 @@ void Pokebattle::Arena::unregisterScript(const QString& name)
void Pokebattle::Arena::unregisterAllScripts()
{
delete m_actions;
- m_actions = new Kross::ActionCollection(QString("arena-%1").arg(m_count), Kross::Manager::self().actionCollection());
+ m_actions = new Kross::ActionCollection(QString("arena-%1").arg(m_id), Kross::Manager::self().actionCollection());
}
void Pokebattle::Arena::cleanUp()