Correct UB in Event constructors; use member initializer lists

This commit is contained in:
BigBahss 2021-02-16 10:49:14 -05:00
parent 40a7e23b34
commit 8e2388cf62

View file

@ -12,29 +12,25 @@ QString EventType::HiddenItem = "event_hidden_item";
QString EventType::SecretBase = "event_secret_base"; QString EventType::SecretBase = "event_secret_base";
QString EventType::HealLocation = "event_heal_location"; QString EventType::HealLocation = "event_heal_location";
Event::Event() Event::Event() :
{ spriteWidth(16),
this->spriteWidth = 16; spriteHeight(16),
this->spriteHeight = 16; usingSprite(false)
this->usingSprite = false; { }
}
Event::Event(const Event& toCopy) Event::Event(const Event& toCopy) :
{ values(toCopy.values),
Event(); customValues(toCopy.customValues),
this->values = toCopy.values; pixmap(toCopy.pixmap),
this->customValues = toCopy.customValues; spriteWidth(toCopy.spriteWidth),
this->pixmap = toCopy.pixmap; spriteHeight(toCopy.spriteHeight),
this->spriteWidth = toCopy.spriteWidth; frame(toCopy.frame),
this->spriteHeight = toCopy.spriteHeight; hFlip(toCopy.hFlip),
this->frame = toCopy.frame; usingSprite(toCopy.usingSprite)
this->hFlip = toCopy.hFlip; { }
this->usingSprite = toCopy.usingSprite;
}
Event::Event(QJsonObject obj, QString type) Event::Event(QJsonObject obj, QString type) : Event()
{ {
Event();
this->put("event_type", type); this->put("event_type", type);
this->readCustomValues(obj); this->readCustomValues(obj);
} }