Auto-select newly created character in selection screen

After creating a character, automatically select it in the character
list instead of defaulting to the previously selected character.

Changes:
- Added selectCharacterByName() method to CharacterScreen
- Store created character name in Application
- On creation success, auto-select the new character by name
- Falls back to saved selection if new character name doesn't match
This commit is contained in:
Kelsi 2026-02-09 22:51:13 -08:00
parent 743b9c7333
commit 5afc9a57d1
4 changed files with 39 additions and 4 deletions

View file

@ -581,6 +581,7 @@ void Application::setupUICallbacks() {
// Character create screen callbacks
uiManager->getCharacterCreateScreen().setOnCreate([this](const game::CharCreateData& data) {
pendingCreatedCharacterName_ = data.name; // Store name for auto-selection
gameHandler->createCharacter(data);
});
@ -591,9 +592,15 @@ void Application::setupUICallbacks() {
// Character create result callback
gameHandler->setCharCreateCallback([this](bool success, const std::string& msg) {
if (success) {
// Auto-select the newly created character
if (!pendingCreatedCharacterName_.empty()) {
uiManager->getCharacterScreen().selectCharacterByName(pendingCreatedCharacterName_);
pendingCreatedCharacterName_.clear();
}
setState(AppState::CHARACTER_SELECTION);
} else {
uiManager->getCharacterCreateScreen().setStatus(msg, true);
pendingCreatedCharacterName_.clear();
}
});