update chars taken on area accordingly
Some checks are pending
CI / build-windows (push) Blocked by required conditions
CI / build-linux (push) Blocked by required conditions
CI / check-clang-format (push) Waiting to run

This commit is contained in:
simio 2025-03-02 07:24:25 -03:00
parent 81312b2ad3
commit dfb0ef2e58

View File

@ -228,7 +228,6 @@ void AOClient::changeArea(int new_area)
if (character() != "") { if (character() != "") {
server->getAreaById(areaId()) server->getAreaById(areaId())
->changeCharacter(server->getCharID(character()), -1); ->changeCharacter(server->getCharID(character()), -1);
server->updateCharsTaken(server->getAreaById(areaId()));
} }
server->getAreaById(areaId())->removeClient(m_char_id, clientId()); server->getAreaById(areaId())->removeClient(m_char_id, clientId());
bool l_character_taken = false; bool l_character_taken = false;
@ -238,8 +237,11 @@ void AOClient::changeArea(int new_area)
m_char_id = -1; m_char_id = -1;
l_character_taken = true; l_character_taken = true;
} }
int old_area_id = areaId();
server->getAreaById(new_area)->addClient(m_char_id, clientId()); server->getAreaById(new_area)->addClient(m_char_id, clientId());
setAreaId(new_area); setAreaId(new_area);
server->updateCharsTaken(server->getAreaById(old_area_id));
server->updateCharsTaken(server->getAreaById(new_area));
arup(ARUPType::PLAYER_COUNT, true); arup(ARUPType::PLAYER_COUNT, true);
sendEvidenceList(server->getAreaById(new_area)); sendEvidenceList(server->getAreaById(new_area));
sendPacket("HP", {"1", QString::number(server->getAreaById(new_area)->defHP())}); sendPacket("HP", {"1", QString::number(server->getAreaById(new_area)->defHP())});