From 900f623f3be0ef9896f8bb9723c2b20c3b40540d Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 19 Dec 2014 20:33:09 +1100 Subject: [PATCH] Camera centering and client drop message --- client/entities/local_character.hpp | 4 +++- client/scenes/in_world.cpp | 8 +++++++- server/server_logic.cpp | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/client/entities/local_character.hpp b/client/entities/local_character.hpp index bef4edc..3cbff5f 100644 --- a/client/entities/local_character.hpp +++ b/client/entities/local_character.hpp @@ -26,7 +26,9 @@ class LocalCharacter: public BaseCharacter { public: - // + LocalCharacter() = default; + virtual ~LocalCharacter() = default; + private: //NOTE: NO MEMBERS }; diff --git a/client/scenes/in_world.cpp b/client/scenes/in_world.cpp index 6e2aa76..30a2e2b 100644 --- a/client/scenes/in_world.cpp +++ b/client/scenes/in_world.cpp @@ -145,6 +145,12 @@ void InWorld::Update() { it.second.Update(); } + //update the camera + if (localCharacter) { + camera.x = localCharacter->GetOrigin().x - camera.marginX; + camera.y = localCharacter->GetOrigin().y - camera.marginY; + } + //check the connection (heartbeat) if (Clock::now() - lastBeat > std::chrono::seconds(3)) { if (attemptedBeats > 2) { @@ -355,7 +361,7 @@ void InWorld::HandleLogoutResponse(ClientPacket* const argPacket) { characterIndex = -1; //reset the camera - camera.x = camera .y = 0; + camera.x = camera.y = 0; camera.marginX = camera.marginY = 0; SendDisconnectRequest(); diff --git a/server/server_logic.cpp b/server/server_logic.cpp index 0b20037..5408e94 100644 --- a/server/server_logic.cpp +++ b/server/server_logic.cpp @@ -183,6 +183,7 @@ void ServerApplication::Proc() { int disconnected = clientMgr.CheckConnections(); if (disconnected != -1) { FullClientUnload(disconnected); + std::cerr << "Client dropped: " << disconnected << std::endl; } //give the computer a break