blob: d15ced1773b2e3b9be6528aeb123c0179c6b63c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#include <QDebug>
#include "lobby.h"
#include "courtroom.h"
#include "networkmanager.h"
#include "aoapplication.h"
AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
{
net_manager = new NetworkManager(this);
}
AOApplication::~AOApplication()
{
destruct_lobby();
destruct_courtroom();
}
void AOApplication::construct_lobby()
{
if (lobby_constructed)
{
qDebug() << "W: lobby was attempted constructed when it already exists";
return;
}
w_lobby = new Lobby(this);
lobby_constructed = true;
}
void AOApplication::destruct_lobby()
{
if(!lobby_constructed)
{
qDebug() << "W: lobby was attempted destructed when it did not exist";
return;
}
delete w_lobby;
lobby_constructed = false;
}
void AOApplication::construct_courtroom()
{
if (courtroom_constructed)
{
qDebug() << "W: courtroom was attempted constructed when it already exists";
return;
}
w_courtroom = new Courtroom(this);
courtroom_constructed = true;
}
void AOApplication::destruct_courtroom()
{
if (!courtroom_constructed)
{
qDebug() << "W: courtroom was attempted destructed when it did not exist";
return;
}
delete w_courtroom;
courtroom_constructed = false;
}
|