27 lines
598 B
C++
27 lines
598 B
C++
|
#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;
|
||
|
}
|