diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-06-10 03:15:20 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-06-10 03:15:20 +0000 |
| commit | 60ec161d7df28c3147e86f7344a9a548b7682aee (patch) | |
| tree | 361e36b4275f35967d8fc7208005018796ff7af7 /pokebattle/Arena.cpp | |
| parent | bfd8c384cec5f75c381cbf07b7982afc8be03fb5 (diff) | |
| download | sigen-60ec161d7df28c3147e86f7344a9a548b7682aee.tar.gz sigen-60ec161d7df28c3147e86f7344a9a548b7682aee.tar.xz sigen-60ec161d7df28c3147e86f7344a9a548b7682aee.zip | |
[FIX] Added some stuff to Pokebattle
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@205 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokebattle/Arena.cpp')
| -rw-r--r-- | pokebattle/Arena.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/pokebattle/Arena.cpp b/pokebattle/Arena.cpp index eda64717..7c7cf776 100644 --- a/pokebattle/Arena.cpp +++ b/pokebattle/Arena.cpp @@ -18,8 +18,57 @@ // Header include #include "Arena.h" +// Pokemod includes +#include "../pokemod/Script.h" + +// KDE includes +#include <kross/core/action.h> +#include <kross/core/childreninterface.h> + +Pokebattle::Arena::Arena* Pokebattle::Arena::m_arena = 0; +Kross::ActionCollection* Pokebattle::Arena::m_actions = 0; + +Pokebattle::Arena::~Arena() +{ +} + +void Pokebattle::Arena::setTeams(QList<Team*> teams) +{ + m_teams = teams; +} + void Pokebattle::Arena::cleanUp() { delete m_arena; - m_arena = 0; + m_arena = NULL; + m_teams.clear(); +} + +void Pokebattle::Arena::registerScript(const QString& name, const Pokemod::Script& script) +{ + if (!m_actions) + remakeCollection(); + 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::unregisterScript(const QString& name) +{ + m_actions->removeAction(name); +} + +void Pokebattle::Arena::remakeCollection() +{ + if (!m_actions) + m_actions = new Kross::ActionCollection("arena", Kross::Manager::self().actionCollection()); +} + +void Pokebattle::Arena::unregisterAllScripts() +{ + delete m_actions; + m_actions = 0; } |
