26 lines
597 B
C++
26 lines
597 B
C++
#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;
|
|
}
|