summaryrefslogtreecommitdiffstats
path: root/plugins/arena/standard/SigenArenaStandard.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-04-10 02:32:48 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-04-10 02:32:48 -0400
commita47f5f5ee9f698ef29c03b8db6de5cf1ca2950e5 (patch)
treeae64760adfe2beaf0751976c667afb1e9d24429f /plugins/arena/standard/SigenArenaStandard.cpp
parent75fdbe8605cb63c4f8e828fcc85d4e3cbabe3846 (diff)
downloadsigen-a47f5f5ee9f698ef29c03b8db6de5cf1ca2950e5.tar.gz
sigen-a47f5f5ee9f698ef29c03b8db6de5cf1ca2950e5.tar.xz
sigen-a47f5f5ee9f698ef29c03b8db6de5cf1ca2950e5.zip
Rename plugin factory files to be less generic
Diffstat (limited to 'plugins/arena/standard/SigenArenaStandard.cpp')
-rw-r--r--plugins/arena/standard/SigenArenaStandard.cpp92
1 files changed, 92 insertions, 0 deletions
diff --git a/plugins/arena/standard/SigenArenaStandard.cpp b/plugins/arena/standard/SigenArenaStandard.cpp
new file mode 100644
index 00000000..6ddd2052
--- /dev/null
+++ b/plugins/arena/standard/SigenArenaStandard.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2009 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/>.
+ */
+
+// Header include
+#include "SigenArenas.h"
+
+// Arena includes
+#include "atb/ATBArena.h"
+#include "turn/TurnArena.h"
+
+// Sigencore includes
+#include <sigencore/Arena.h>
+
+// KDE includes
+#include <KIcon>
+
+SIGEN_ARENA_PLUGIN_VERSION(SigenArenas, "sigen_arenas", 000101)
+
+using namespace Sigscript;
+using namespace Sigencore;
+using namespace Sigencore::Plugins;
+
+SigenArenas::SigenArenas(QObject* parent, const QVariantList& args) :
+ ArenaPlugin(parent, args)
+{
+}
+
+SigenArenas::~SigenArenas()
+{
+}
+
+QStringList SigenArenas::classList() const
+{
+ return QStringList() << TurnArena::name() << ATBArena::name();
+}
+
+QString SigenArenas::description(const QString& name) const
+{
+ if (name == TurnArena::name())
+ return TurnArena::description();
+ if (name == ATBArena::name())
+ return ATBArena::description();
+ return "(Unknown arena)";
+}
+
+QIcon SigenArenas::icon(const QString& name)
+{
+ if (name == TurnArena::name())
+ return TurnArena::icon();
+ if (name == ATBArena::name())
+ return ATBArena::icon();
+ return KIcon();
+}
+
+Arena* SigenArenas::createArena(const QString& name, GameWrapper* game, Config* parent)
+{
+ if (name == TurnArena::name())
+ return new TurnArena(game, parent);
+ if (name == ATBArena::name())
+ return new ATBArena(game, parent);
+ return NULL;
+}
+
+void SigenArenas::cleanupArena(Arena* arena)
+{
+ TurnArena* turnArena = qobject_cast<TurnArena*>(arena);
+ if (turnArena)
+ {
+ delete turnArena;
+ return;
+ }
+ ATBArena* atbArena = qobject_cast<ATBArena*>(arena);
+ if (atbArena)
+ {
+ delete atbArena;
+ return;
+ }
+}