quest-wizard/models/events/qw_quitgameevent.cpp

27 lines
598 B
C++
Raw Normal View History

2023-02-09 08:41:24 -05:00
#include <QCoreApplication>
#include "qw_quitgameevent.h"
QWQuitGameEvent::QWQuitGameEvent(bool savegame) :
b_savegame(savegame)
{}
void QWQuitGameEvent::execute()
{
if (b_savegame)
ptr_builder->saveGame();
QCoreApplication::quit();
}
////////////////////////
void QWQuitGameEvent::writeToJson(QJsonObject &event_data)
{
event_data.insert("id", tag());
event_data.insert("type", EVENT_TYPE::QUIT_GAME);
event_data.insert("save_game", b_savegame);
qDebug() << " The quit_game event:\n" << " id " << tag()
<< "\n save_game " << b_savegame;
}