From 20199970b277dd4cec75420a6e6c4396e29361cd Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 28 Mar 2009 00:26:44 -0400 Subject: Add support for PlayerPlugin in PluginLoader --- sigtools/PluginLoader.cpp | 11 +++++++++++ sigtools/PluginLoader.h | 2 ++ 2 files changed, 13 insertions(+) (limited to 'sigtools') diff --git a/sigtools/PluginLoader.cpp b/sigtools/PluginLoader.cpp index 6b08efdb..9d36b100 100644 --- a/sigtools/PluginLoader.cpp +++ b/sigtools/PluginLoader.cpp @@ -22,6 +22,7 @@ // Sigencore plugin includes #include #include +#include #include // Sigmod includes @@ -93,6 +94,14 @@ Canvas* PluginLoader::canvas(const QString& name, GameWrapper* game, Config* par return NULL; } +Player* PluginLoader::player(const QString& name, GameWrapper* game, Config* parent) +{ + PlayerPlugin* plugin = qobject_cast(loader->factory("Player", name)); + if (plugin) + return plugin->getPlayer(name, game, parent); + return NULL; +} + PluginLoader::Private::Private() { if (!KGlobal::dirs()->resourceDirs("sigmod").size()) @@ -168,6 +177,8 @@ void PluginLoader::Private::refresh(const QString& type) plugin = factory->create(this); else if (type == "Canvas") plugin = factory->create(this); + else if (type == "Player") + plugin = factory->create(this); else KMessageBox::information(NULL, QString("The plugin type \"Sigen/%1\" is not supported.").arg(type), "Unsupported plugin type"); if (plugin) diff --git a/sigtools/PluginLoader.h b/sigtools/PluginLoader.h index 5e0158ef..62fe27ef 100644 --- a/sigtools/PluginLoader.h +++ b/sigtools/PluginLoader.h @@ -33,6 +33,7 @@ namespace Sigencore { class Arena; class Canvas; +class Player; } namespace Sigscript { @@ -57,6 +58,7 @@ namespace PluginLoader SIGTOOLS_EXPORT QSharedPointer game(const QString& name); SIGTOOLS_EXPORT Sigencore::Arena* arena(const QString& arena, Sigscript::GameWrapper* game, Sigscript::Config* parent); SIGTOOLS_EXPORT Sigencore::Canvas* canvas(const QString& canvas, Sigscript::GameWrapper* game, Sigscript::Config* parent); + SIGTOOLS_EXPORT Sigencore::Player* player(const QString& canvas, Sigscript::GameWrapper* game, Sigscript::Config* parent); } } -- cgit