Instructions Jenkins Doxygen

[Added] loading of jedi manager in director manager. 26/826/1
authorLoshult <loshult@swgemu.com>
Sat, 21 Sep 2013 05:07:12 +0000 (05:07 +0000)
committerLoshult <loshult@swgemu.com>
Sat, 21 Sep 2013 05:08:16 +0000 (05:08 +0000)
Change-Id: I4df9936e71634e86058ced882cdca09ccba62201

MMOCoreORB/src/server/zone/managers/director/DirectorManager.cpp
MMOCoreORB/src/server/zone/managers/director/DirectorManager.h
MMOCoreORB/src/server/zone/managers/director/tests/BasicScreenPlayTest.cpp
MMOCoreORB/src/server/zone/managers/jedi/JediManager.cpp
MMOCoreORB/src/server/zone/managers/jedi/JediManager.h
MMOCoreORB/src/server/zone/managers/jedi/tests/JediManagerTest.cpp

index 31afc8a..1b77efe 100644 (file)
@@ -53,6 +53,7 @@
 #include "server/zone/objects/scene/variables/ContainerPermissions.h"
 #include "server/zone/objects/tangible/deed/Deed.h"
 #include "server/zone/managers/gcw/GCWManager.h"
+#include "server/zone/managers/jedi/JediManager.h"
 
 
 int DirectorManager::DEBUG_MODE = 0;
@@ -1314,16 +1315,15 @@ Lua* DirectorManager::getLuaInstance() {
                lua = new Lua();
                initializeLuaEngine(lua);
                loadScreenPlays(lua);
+               JediManager::instance()->loadConfiguration(lua);
 
                localLua.set(lua);
        }
 
-       //lua->runFile("scripts/screenplays/screenplay.lua");
-
        return lua;
 }
 
-int DirectorManager::runLuaInstance() {
+int DirectorManager::runScreenPlays() {
        Lua* lua = localLua.get();
        int ret = 0;
 
index 82be116..14322e3 100644 (file)
@@ -69,7 +69,7 @@ namespace server {
                ConversationScreen* runScreenHandlers(const String& luaClass, ConversationTemplate* conversationTemplate, CreatureObject* conversingPlayer, CreatureObject* conversingNPC, int selectedOption, ConversationScreen* conversationScreen);
 
                Lua* getLuaInstance();
-               int runLuaInstance();
+               int runScreenPlays();
 
                static int writeScreenPlayData(lua_State* L);
                static int readScreenPlayData(lua_State* L);
@@ -130,6 +130,7 @@ namespace server {
        private:
                void initializeLuaEngine(Lua* luaEngine);
                int loadScreenPlays(Lua* luaEngine);
+               void loadJediManager(Lua* luaEngine);
        };
 
    }
index 795ee59..9c2652b 100644 (file)
@@ -33,7 +33,7 @@ public:
 
 TEST_F(BasicScreenPlayTest, ScreenPlayLuaInitialize) {
        DirectorManager::DEBUG_MODE = 1;
-       EXPECT_EQ(DirectorManager::instance()->runLuaInstance(), 0);
+       EXPECT_EQ(DirectorManager::instance()->runScreenPlays(), 0);
 }
 
 #endif /* BASICSCREENPLAYTEST_CPP_ */
index 9ed7cd3..ba837cd 100644 (file)
@@ -44,20 +44,18 @@ which carries forward this exception.
 
 #include "JediManager.h"
 
-JediManager::JediManager(Lua* lua) : Logger("JediManager") {
-       info("Loading...", true);
-
-       this->lua = lua;
+JediManager::JediManager() : Logger("JediManager") {
        jediProgressionType = NOJEDIPROGRESSION;
-
-       loadConfiguration();
 }
 
 JediManager::~JediManager() {
 
 }
 
-void JediManager::loadConfiguration() {
+void JediManager::loadConfiguration(Lua* luaEngine) {
+       lua = luaEngine;
+
+       info("Loading...", true);
        lua->runFile("scripts/managers/jedi_manager.lua");
 
        jediProgressionType = lua->getGlobalInt(String("jediProgressionType"));
index b49b10b..e385a4f 100644 (file)
@@ -55,7 +55,7 @@ namespace jedi {
 /**
  * Singleton class with a common interface for all different Jedi progression systems.
  */
-class JediManager : public Singleton<JediManager>, public Logger {
+class JediManager : public Singleton<JediManager>, public Logger, public Object {
 private:
        /**
         * Pointer to a Lua object.
@@ -67,11 +67,6 @@ private:
         */
        int jediProgressionType;
 
-       /**
-        * Load the Jedi Manager configuration.
-        */
-       void loadConfiguration();
-
 public:
        /**
         * Jedi progression not available.
@@ -95,15 +90,19 @@ public:
 
        /**
         * Constructor for the Jedi Manager.
-        * @param lua pointer to a Lua object. The lua object will be used until the
-        *            Jedi Manager itself is deleted.
         */
-       JediManager(Lua* lua);
+       JediManager();
 
        /**
         * Destructor for the Jedi Manager.
         */
        ~JediManager();
+
+       /**
+        * Load the Jedi Manager configuration.
+        * @param luaEngine the lua engine to use for loading the configuration.
+        */
+       void loadConfiguration(Lua* luaEngine);
 };
 
 }
index 7ea3344..5a1f182 100644 (file)
@@ -60,6 +60,7 @@ namespace tests {
 
 class JediManagerTest : public ::testing::Test {
 public:
+       JediManager* jediManager;
 
        JediManagerTest() {
                // Perform creation setup here.
@@ -71,10 +72,12 @@ public:
 
        void SetUp() {
                // Perform setup of common constructs here.
+               jediManager = new JediManager();
        }
 
        void TearDown() {
                // Perform clean up of common constructs here.
+               delete jediManager;
        }
 
        void constructorDefaults(MockLua& mockLua) {
@@ -91,9 +94,7 @@ TEST_F(JediManagerTest, ShouldRunFileJediManagerLuaAtCreation) {
 
        EXPECT_CALL(mockLua, runFile(String("scripts/managers/jedi_manager.lua"))).Times(1);
 
-       JediManager* jediManager = new JediManager(&mockLua);
-
-       delete jediManager;
+       jediManager->loadConfiguration(&mockLua);
 }
 
 TEST_F(JediManagerTest, ShouldReadTheJediProgressionTypeVariableAtCreation) {
@@ -103,9 +104,7 @@ TEST_F(JediManagerTest, ShouldReadTheJediProgressionTypeVariableAtCreation) {
 
        EXPECT_CALL(mockLua, getGlobalInt(String("jediProgressionType"))).WillOnce(Return(JediManager::NOJEDIPROGRESSION));
 
-       JediManager* jediManager = new JediManager(&mockLua);
-
-       delete jediManager;
+       jediManager->loadConfiguration(&mockLua);
 }
 
 TEST_F(JediManagerTest, ShouldRunTheHolocronJediManagerLuaFileIfHolocronJediProgressionIsConfigured) {
@@ -116,9 +115,7 @@ TEST_F(JediManagerTest, ShouldRunTheHolocronJediManagerLuaFileIfHolocronJediProg
        ON_CALL(mockLua, getGlobalInt(String("jediProgressionType"))).WillByDefault(Return(JediManager::HOLOCRONJEDIPROGRESSION));
        EXPECT_CALL(mockLua, runFile(String("scripts/managers/holocron_jedi_manager.lua"))).Times(1);
 
-       JediManager* jediManager = new JediManager(&mockLua);
-
-       delete jediManager;
+       jediManager->loadConfiguration(&mockLua);
 }
 
 TEST_F(JediManagerTest, ShouldRunTheVillageJediManagerLuaFileIfVillageJediProgressionIsConfigured) {
@@ -129,9 +126,7 @@ TEST_F(JediManagerTest, ShouldRunTheVillageJediManagerLuaFileIfVillageJediProgre
        ON_CALL(mockLua, getGlobalInt(String("jediProgressionType"))).WillByDefault(Return(JediManager::VILLAGEJEDIPROGRESSION));
        EXPECT_CALL(mockLua, runFile(String("scripts/managers/village_jedi_manager.lua"))).Times(1);
 
-       JediManager* jediManager = new JediManager(&mockLua);
-
-       delete jediManager;
+       jediManager->loadConfiguration(&mockLua);
 }
 
 TEST_F(JediManagerTest, ShouldReadTheCustomJediProgressionFileStringIfCustomJediProgressionIsConfigured) {
@@ -142,9 +137,7 @@ TEST_F(JediManagerTest, ShouldReadTheCustomJediProgressionFileStringIfCustomJedi
        ON_CALL(mockLua, getGlobalInt(String("jediProgressionType"))).WillByDefault(Return(JediManager::CUSTOMJEDIPROGRESSION));
        EXPECT_CALL(mockLua, getGlobalString(String("customJediProgressionFile"))).WillOnce(Return(String("scripts/managers/custom_jedi_manager.lua")));
 
-       JediManager* jediManager = new JediManager(&mockLua);
-
-       delete jediManager;
+       jediManager->loadConfiguration(&mockLua);
 }
 
 TEST_F(JediManagerTest, ShouldLoadTheCustomJediProgressionFileIfCustomJediProgressionIsConfigured) {
@@ -156,9 +149,7 @@ TEST_F(JediManagerTest, ShouldLoadTheCustomJediProgressionFileIfCustomJediProgre
        EXPECT_CALL(mockLua, getGlobalString(String("customJediProgressionFile"))).WillOnce(Return(String("scripts/managers/custom_jedi_manager.lua")));
        EXPECT_CALL(mockLua, runFile(String("scripts/managers/custom_jedi_manager.lua"))).Times(1);
 
-       JediManager* jediManager = new JediManager(&mockLua);
-
-       delete jediManager;
+       jediManager->loadConfiguration(&mockLua);
 }
 
 }