mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Saving to database working
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "Amf3.h"
|
||||
#include "BehaviorStates.h"
|
||||
#include "ControlBehaviorMsgs.h"
|
||||
#include "tinyxml2.h"
|
||||
|
||||
PropertyBehavior::PropertyBehavior() {
|
||||
m_LastEditedState = BehaviorState::HOME_STATE;
|
||||
@@ -124,3 +125,17 @@ void PropertyBehavior::SendBehaviorBlocksToClient(AMFArrayValue& args) const {
|
||||
|
||||
// TODO Serialize the execution state of the behavior
|
||||
}
|
||||
|
||||
void PropertyBehavior::Serialize(tinyxml2::XMLElement& behavior) const {
|
||||
behavior.SetAttribute("id", m_BehaviorId);
|
||||
behavior.SetAttribute("name", m_Name.c_str());
|
||||
behavior.SetAttribute("isLocked", isLocked);
|
||||
behavior.SetAttribute("isLoot", isLoot);
|
||||
|
||||
for (const auto& [stateId, state] : m_States) {
|
||||
if (state.IsEmpty()) continue;
|
||||
auto* const stateElement = behavior.InsertNewChildElement("State");
|
||||
stateElement->SetAttribute("id", static_cast<uint32_t>(stateId));
|
||||
state.Serialize(*stateElement);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user