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.
This commit is contained in:
MangosArentLiterature 2021-06-03 14:16:52 -05:00
parent 44519c0db3
commit 17cd92bc5b

View File

@ -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()) {