quest-wizard/models/events/qw_endlevelevent.cpp

26 lines
597 B
C++
Raw Permalink Normal View History

2023-02-09 08:41:24 -05:00
#include "qw_endlevelevent.h"
QWEndLevelEvent::QWEndLevelEvent(const QString &level) :
str_nlevel(level)
{
Q_ASSERT(!str_nlevel.isEmpty());
}
void QWEndLevelEvent::execute()
{
ptr_builder->saveGame();
ptr_builder->initLevel(str_nlevel);
}
////////////////////////
void QWEndLevelEvent::writeToJson(QJsonObject &event_data)
{
event_data.insert("id", tag());
event_data.insert("type", EVENT_TYPE::END_LEVEL);
event_data.insert("new_level", str_nlevel);
qDebug() << " The end_level event:\n" << " id " << tag()
<< "\n new_level " << str_nlevel;
}