mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
Reset realm and character lists when switching servers
Add reset() to RealmScreen and CharacterScreen to clear stale selection state. Clear auth handler realm list on reconnect. Reset both screens when going back to login or back to realm selection, so switching servers shows fresh data instead of stale lists from the previous connection.
This commit is contained in:
parent
57ceb96275
commit
53e5aff4d2
4 changed files with 44 additions and 0 deletions
|
|
@ -34,6 +34,9 @@ bool AuthHandler::connect(const std::string& host, uint16_t port) {
|
|||
const std::string hostTrimmed = trimHost(host);
|
||||
LOG_INFO("Connecting to auth server: ", hostTrimmed, ":", port);
|
||||
|
||||
// Clear stale realm list from previous connection
|
||||
realms.clear();
|
||||
|
||||
socket = std::make_unique<network::TCPSocket>();
|
||||
|
||||
// Set up packet callback
|
||||
|
|
|
|||
|
|
@ -537,6 +537,11 @@ void Application::logoutToLogin() {
|
|||
music->stopMusic(0.0f);
|
||||
}
|
||||
}
|
||||
// Clear stale realm/character selection so switching servers starts fresh
|
||||
if (uiManager) {
|
||||
uiManager->getRealmScreen().reset();
|
||||
uiManager->getCharacterScreen().reset();
|
||||
}
|
||||
setState(AppState::AUTHENTICATION);
|
||||
}
|
||||
|
||||
|
|
@ -1733,6 +1738,12 @@ void Application::setupUICallbacks() {
|
|||
|
||||
// "Back" button on character screen
|
||||
uiManager->getCharacterScreen().setOnBack([this]() {
|
||||
// Disconnect from world server and reset UI state for fresh realm selection
|
||||
if (gameHandler) {
|
||||
gameHandler->disconnect();
|
||||
}
|
||||
uiManager->getRealmScreen().reset();
|
||||
uiManager->getCharacterScreen().reset();
|
||||
setState(AppState::REALM_SELECTION);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue