DarkflameServer/dGame/dPropertyBehaviors/ControlBehaviorMessages/StripUiPosition.cpp
David Markowitz d138b7b878
Make ControlBehavior messages far more modular (#991)
* Make case consistent

* How modular can you go?

Holy modular

* Add comments

* Initialize values
2023-02-16 11:30:33 -06:00

23 lines
615 B
C++

#include "StripUiPosition.h"
#include "AMFFormat.h"
StripUiPosition::StripUiPosition() {
xPosition = 0.0;
yPosition = 0.0;
}
StripUiPosition::StripUiPosition(AMFArrayValue* arguments, std::string uiKeyName) {
xPosition = 0.0;
yPosition = 0.0;
auto* uiArray = arguments->FindValue<AMFArrayValue>(uiKeyName);
if (!uiArray) return;
auto* xPositionValue = uiArray->FindValue<AMFDoubleValue>("x");
auto* yPositionValue = uiArray->FindValue<AMFDoubleValue>("y");
if (!xPositionValue || !yPositionValue) return;
yPosition = yPositionValue->GetDoubleValue();
xPosition = xPositionValue->GetDoubleValue();
}