mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
Add loading from database
yahoo
This commit is contained in:
@@ -40,9 +40,40 @@ void Action::Serialize(tinyxml2::XMLElement& action) const {
|
||||
|
||||
if (m_ValueParameterName.empty()) return;
|
||||
|
||||
action.SetAttribute("ValueParameterName", m_ValueParameterName.c_str());
|
||||
|
||||
if (m_ValueParameterName == "Message") {
|
||||
action.SetAttribute(m_ValueParameterName.c_str(), m_ValueParameterString.c_str());
|
||||
action.SetAttribute("Value", m_ValueParameterString.c_str());
|
||||
} else {
|
||||
action.SetAttribute(m_ValueParameterName.c_str(), m_ValueParameterDouble);
|
||||
action.SetAttribute("Value", m_ValueParameterDouble);
|
||||
}
|
||||
}
|
||||
|
||||
void Action::Deserialize(const tinyxml2::XMLElement& action) {
|
||||
const char* type = nullptr;
|
||||
action.QueryAttribute("Type", &type);
|
||||
if (!type) {
|
||||
LOG("No type found for an action?");
|
||||
return;
|
||||
}
|
||||
|
||||
m_Type = type;
|
||||
|
||||
const char* valueParameterName = nullptr;
|
||||
action.QueryAttribute("ValueParameterName", &valueParameterName);
|
||||
if (valueParameterName) {
|
||||
m_ValueParameterName = valueParameterName;
|
||||
|
||||
if (m_ValueParameterName == "Message") {
|
||||
const char* value = nullptr;
|
||||
action.QueryAttribute("Value", &value);
|
||||
if (value) {
|
||||
m_ValueParameterString = value;
|
||||
} else {
|
||||
LOG("No value found for an action message?");
|
||||
}
|
||||
} else {
|
||||
action.QueryDoubleAttribute("Value", &m_ValueParameterDouble);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ public:
|
||||
void SendBehaviorBlocksToClient(AMFArrayValue& args) const;
|
||||
|
||||
void Serialize(tinyxml2::XMLElement& action) const;
|
||||
void Deserialize(const tinyxml2::XMLElement& action);
|
||||
private:
|
||||
double m_ValueParameterDouble{ 0.0 };
|
||||
std::string m_Type{ "" };
|
||||
|
@@ -27,3 +27,8 @@ void StripUiPosition::Serialize(tinyxml2::XMLElement& position) const {
|
||||
position.SetAttribute("x", m_XPosition);
|
||||
position.SetAttribute("y", m_YPosition);
|
||||
}
|
||||
|
||||
void StripUiPosition::Deserialize(const tinyxml2::XMLElement& position) {
|
||||
position.QueryDoubleAttribute("x", &m_XPosition);
|
||||
position.QueryDoubleAttribute("y", &m_YPosition);
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ public:
|
||||
[[nodiscard]] double GetY() const noexcept { return m_YPosition; }
|
||||
|
||||
void Serialize(tinyxml2::XMLElement& position) const;
|
||||
void Deserialize(const tinyxml2::XMLElement& position);
|
||||
private:
|
||||
double m_XPosition{ 0.0 };
|
||||
double m_YPosition{ 0.0 };
|
||||
|
Reference in New Issue
Block a user