Browse Source

Reworked GenericCommand initialization; Plugin::OnGenericCommand is now called after subclass initialization

release/0.19
Jessica James 9 years ago
parent
commit
e8c4d67b62
  1. 5
      Jupiter/GenericCommand.cpp
  2. 10
      Jupiter/GenericCommand.h
  3. BIN
      Release/Jupiter.lib

5
Jupiter/GenericCommand.cpp

@ -32,12 +32,7 @@ Jupiter::GenericCommandNamespace &Jupiter::g_generic_commands = o_generic_comman
Jupiter::GenericCommand::GenericCommand() Jupiter::GenericCommand::GenericCommand()
{ {
if (&o_generic_commands != this) if (&o_generic_commands != this)
{
Jupiter::GenericCommand::setNamespace(o_generic_commands); Jupiter::GenericCommand::setNamespace(o_generic_commands);
for (size_t index = 0; index != Jupiter::plugins->size(); ++index)
Jupiter::plugins->get(index)->OnGenericCommandAdd(*this);
}
} }
Jupiter::GenericCommand::~GenericCommand() Jupiter::GenericCommand::~GenericCommand()

10
Jupiter/GenericCommand.h

@ -180,8 +180,14 @@ class CLASS : public Jupiter::GenericCommand { \
/** Instantiates a generic command. */ /** Instantiates a generic command. */
#define GENERIC_COMMAND_INIT(CLASS) \ #define GENERIC_COMMAND_INIT(CLASS) \
CLASS CLASS :: instance = CLASS (); \ class CLASS ## _Init : public CLASS { \
CLASS & CLASS ## _instance = CLASS :: instance; public: \
CLASS ## _Init() { \
for (size_t index = 0; index != Jupiter::plugins->size(); ++index) \
Jupiter::plugins->get(index)->OnGenericCommandAdd(*this); \
} }; \
CLASS ## _Init CLASS ## _instance = CLASS ## _Init (); \
CLASS & CLASS :: instance = CLASS ## _instance;
/** Re-enable warnings */ /** Re-enable warnings */
#if defined _MSC_VER #if defined _MSC_VER

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save