mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Split out LUTriggers into it's own component (#986)
* Split out LUTriggers into it's own component * some cleanup * fix debug log * use emplace and tryParse * slight refactor to make the work on startup rather than at runtime Also TODO's for getting targets via all the possible methods * address feedback
This commit is contained in:
@@ -6,17 +6,20 @@
|
||||
|
||||
class Command;
|
||||
class Event;
|
||||
enum class eTriggerCommandType;
|
||||
enum class eTriggerEventType;
|
||||
|
||||
|
||||
namespace LUTriggers {
|
||||
struct Command {
|
||||
std::string id;
|
||||
eTriggerCommandType id;
|
||||
std::string target;
|
||||
std::string targetName;
|
||||
std::string args;
|
||||
};
|
||||
|
||||
struct Event {
|
||||
std::string eventID;
|
||||
eTriggerEventType id;
|
||||
std::vector<Command*> commands;
|
||||
};
|
||||
|
||||
|
@@ -14,6 +14,9 @@
|
||||
#include "Spawner.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
#include "eTriggerCommandType.h"
|
||||
#include "eTriggerEventType.h"
|
||||
|
||||
Zone::Zone(const LWOMAPID& mapID, const LWOINSTANCEID& instanceID, const LWOCLONEID& cloneID) :
|
||||
m_ZoneID(mapID, instanceID, cloneID) {
|
||||
m_NumberOfScenesLoaded = 0;
|
||||
@@ -296,11 +299,11 @@ std::vector<LUTriggers::Trigger*> Zone::LoadLUTriggers(std::string triggerFile,
|
||||
auto currentEvent = currentTrigger->FirstChildElement("event");
|
||||
while (currentEvent) {
|
||||
LUTriggers::Event* newEvent = new LUTriggers::Event();
|
||||
newEvent->eventID = currentEvent->Attribute("id");
|
||||
newEvent->id = TriggerEventType::StringToTriggerEventType(currentEvent->Attribute("id"));
|
||||
auto currentCommand = currentEvent->FirstChildElement("command");
|
||||
while (currentCommand) {
|
||||
LUTriggers::Command* newCommand = new LUTriggers::Command();
|
||||
newCommand->id = currentCommand->Attribute("id");
|
||||
newCommand->id = TriggerCommandType::StringToTriggerCommandType(currentCommand->Attribute("id"));
|
||||
newCommand->target = currentCommand->Attribute("target");
|
||||
if (currentCommand->Attribute("targetName") != NULL) {
|
||||
newCommand->targetName = currentCommand->Attribute("targetName");
|
||||
|
Reference in New Issue
Block a user