Camera centering and client drop message
This commit is contained in:
@@ -26,7 +26,9 @@
|
|||||||
|
|
||||||
class LocalCharacter: public BaseCharacter {
|
class LocalCharacter: public BaseCharacter {
|
||||||
public:
|
public:
|
||||||
//
|
LocalCharacter() = default;
|
||||||
|
virtual ~LocalCharacter() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//NOTE: NO MEMBERS
|
//NOTE: NO MEMBERS
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -145,6 +145,12 @@ void InWorld::Update() {
|
|||||||
it.second.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)
|
//check the connection (heartbeat)
|
||||||
if (Clock::now() - lastBeat > std::chrono::seconds(3)) {
|
if (Clock::now() - lastBeat > std::chrono::seconds(3)) {
|
||||||
if (attemptedBeats > 2) {
|
if (attemptedBeats > 2) {
|
||||||
@@ -355,7 +361,7 @@ void InWorld::HandleLogoutResponse(ClientPacket* const argPacket) {
|
|||||||
characterIndex = -1;
|
characterIndex = -1;
|
||||||
|
|
||||||
//reset the camera
|
//reset the camera
|
||||||
camera.x = camera .y = 0;
|
camera.x = camera.y = 0;
|
||||||
camera.marginX = camera.marginY = 0;
|
camera.marginX = camera.marginY = 0;
|
||||||
|
|
||||||
SendDisconnectRequest();
|
SendDisconnectRequest();
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ void ServerApplication::Proc() {
|
|||||||
int disconnected = clientMgr.CheckConnections();
|
int disconnected = clientMgr.CheckConnections();
|
||||||
if (disconnected != -1) {
|
if (disconnected != -1) {
|
||||||
FullClientUnload(disconnected);
|
FullClientUnload(disconnected);
|
||||||
|
std::cerr << "Client dropped: " << disconnected << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//give the computer a break
|
//give the computer a break
|
||||||
|
|||||||
Reference in New Issue
Block a user