Camera centering and client drop message
This commit is contained in:
@@ -26,7 +26,9 @@
|
||||
|
||||
class LocalCharacter: public BaseCharacter {
|
||||
public:
|
||||
//
|
||||
LocalCharacter() = default;
|
||||
virtual ~LocalCharacter() = default;
|
||||
|
||||
private:
|
||||
//NOTE: NO MEMBERS
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user