From 17cd92bc5b136c4b85314503554cb745efc53edd Mon Sep 17 00:00:00 2001 From: MangosArentLiterature <58055358+MangosArentLiterature@users.noreply.github.com> Date: Thu, 3 Jun 2021 14:16:52 -0500 Subject: [PATCH] Fix character being considered taken upon changing areas Fixes a bug that would cause the server to consider your character taken when switching to a new area, booting you to char select and preventing your original character from being reselected. --- core/src/aoclient.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/src/aoclient.cpp b/core/src/aoclient.cpp index 5ef7800..8371e11 100644 --- a/core/src/aoclient.cpp +++ b/core/src/aoclient.cpp @@ -116,23 +116,23 @@ void AOClient::changeArea(int new_area) server->areas[current_area]->changeCharacter(server->getCharID(current_char), -1); server->updateCharsTaken(server->areas[current_area]); } - server->areas[new_area]->clientJoinedArea(char_id); server->areas[current_area]->clientLeftArea(char_id); + bool character_taken = false; + if (server->areas[new_area]->charactersTaken().contains(server->getCharID(current_char))) { + current_char = ""; + char_id = -1; + character_taken = true; + } + server->areas[new_area]->clientJoinedArea(char_id); current_area = new_area; arup(ARUPType::PLAYER_COUNT, true); sendEvidenceList(server->areas[new_area]); sendPacket("HP", {"1", QString::number(server->areas[new_area]->defHP())}); sendPacket("HP", {"2", QString::number(server->areas[new_area]->proHP())}); sendPacket("BN", {server->areas[new_area]->background()}); - if (server->areas[current_area]->charactersTaken().contains(server->getCharID(current_char))) { - server->updateCharsTaken(server->areas[current_area]); - current_char = ""; + if (character_taken) { sendPacket("DONE"); } - else { - server->areas[current_area]->changeCharacter(-1, server->getCharID(current_char)); - server->updateCharsTaken(server->areas[current_area]); - } for (QTimer* timer : server->areas[current_area]->timers()) { int timer_id = server->areas[current_area]->timers().indexOf(timer) + 1; if (timer->isActive()) {