Detect server disconnect during character loading and show error

GameHandler::update() now detects when the socket closes mid-session
(e.g. Warden rejection) and transitions to DISCONNECTED state.
Character screen shows a disconnect message instead of hanging on
"Loading characters..." forever. Reverted SHA1(seed+module) fallback
to SHA1(seed) since neither is correct without module execution.
This commit is contained in:
Kelsi 2026-02-14 18:46:54 -08:00
parent 0ef4af9c99
commit f4f23eab7a
2 changed files with 24 additions and 6 deletions

View file

@ -59,6 +59,18 @@ void CharacterScreen::render(game::GameHandler& gameHandler) {
// Get character list
const auto& characters = gameHandler.getCharacters();
// Handle disconnected state (e.g. Warden kicked us)
if (gameHandler.getState() == game::WorldState::DISCONNECTED ||
gameHandler.getState() == game::WorldState::FAILED) {
ImGui::TextColored(ImVec4(1.0f, 0.4f, 0.4f, 1.0f), "Disconnected from server.");
ImGui::TextWrapped("The server closed the connection. This may be caused by "
"anti-cheat (Warden) verification failure.");
ImGui::Spacing();
if (ImGui::Button("Back", ImVec2(120, 36))) { if (onBack) onBack(); }
ImGui::End();
return;
}
// Request character list if not available.
// Also show a loading state while CHAR_LIST_REQUESTED is in-flight (characters may be cleared to avoid stale UI).
if (characters.empty() &&