-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (36 loc) · 933 Bytes
/
main.cpp
File metadata and controls
43 lines (36 loc) · 933 Bytes
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
// This file is part of the course TPV2@UCM - Samir Genaim
#include <iostream>
#include <memory>
#include "./utils/checkML.h"
#include "./game/Game.h"
#include <GlassHouse.h>
#include <iostream>
void start() {
Game g(8000);
GlassHouse::init(SerializerType::Json, PersistorType::Local);
g.init();
try {
g.start();
}
catch(...)
{
GlassHouse::emergencyClose();
}
GlassHouse::close();
}
int main(int, char**) {
//memory leaks
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
try {
start();
} catch (const std::string &e) { // catch exceptions thrown as strings
std::cerr << e << std::endl;
} catch (const char *e) { // catch exceptions thrown as char*
std::cerr << e << std::endl;
} catch (const std::exception &e) { // catch exceptions thrown as a sub-type of std::exception
std::cerr << e.what();
} catch (...) {
std::cerr << "Caught an exception of unknown type ...";
}
return 0;
}