summaryrefslogtreecommitdiffstats
path: root/src/ThreadGame.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-08-19 17:20:51 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-08-19 17:20:51 +0200
commitf24107368fa47f911f4491f644ff3755525c91e1 (patch)
tree02dc3583ed82d81139b17191af9a9bfae40c45a9 /src/ThreadGame.cpp
parent2017-08-18 (diff)
downloadAltCraft-f24107368fa47f911f4491f644ff3755525c91e1.tar
AltCraft-f24107368fa47f911f4491f644ff3755525c91e1.tar.gz
AltCraft-f24107368fa47f911f4491f644ff3755525c91e1.tar.bz2
AltCraft-f24107368fa47f911f4491f644ff3755525c91e1.tar.lz
AltCraft-f24107368fa47f911f4491f644ff3755525c91e1.tar.xz
AltCraft-f24107368fa47f911f4491f644ff3755525c91e1.tar.zst
AltCraft-f24107368fa47f911f4491f644ff3755525c91e1.zip
Diffstat (limited to '')
-rw-r--r--src/ThreadGame.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ThreadGame.cpp b/src/ThreadGame.cpp
index d3750ea..ef7a95e 100644
--- a/src/ThreadGame.cpp
+++ b/src/ThreadGame.cpp
@@ -19,13 +19,14 @@ void ThreadGame::Execute() {
listener.RegisterHandler(EventType::ConnectionSuccessfull, [this](EventData eventData) {
auto data = std::get<ConnectionSuccessfullData>(eventData);
- gs = new GameState(data.ptr);
+ gs = std::make_shared<GameState>(data.ptr);
+ gs->gs = gs;
});
listener.RegisterHandler(EventType::Disconnected, [this](EventData eventData) {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
- delete gs;
- gs = nullptr;
+ gs->gs.reset();
+ gs.reset();
});
listener.RegisterHandler(EventType::KeyPressed, [this](EventData eventData) {
@@ -100,5 +101,5 @@ void ThreadGame::Execute() {
}
timer.Update();
}
- delete gs;
+ gs.reset();
}