Fix #396: Preferred owner name is not saved (#422)

This commit is contained in:
seifer7 2020-04-21 18:41:07 +10:00 committed by GitHub
parent a746af1b84
commit b9e51a950c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1954,7 +1954,7 @@ namespace openloco::ui::options
{
switch (i)
{
case widx::change_btn:
case widx::use_preferred_owner_name:
set_preferred_name(w, str);
break;
}
@ -1968,16 +1968,17 @@ namespace openloco::ui::options
strcpy(buffer, playerName);
buffer[strlen(playerName)] = '\0';
textinput::open_textinput(w, string_ids::preferred_owner_name, string_ids::enter_preferred_owner_name, string_ids::buffer_2039, 11, nullptr);
textinput::open_textinput(w, string_ids::preferred_owner_name, string_ids::enter_preferred_owner_name, string_ids::buffer_2039, widx::use_preferred_owner_name, nullptr);
}
// 0x004C1342
static void set_preferred_name(window* w, char* str)
{
if (strlen(str) == 0)
return;
auto& cfg = openloco::config::get();
if (strlen(str) == 0)
cfg.flags &= ~config::flags::use_preferred_owner_name;
strcpy(cfg.preferred_name, str);
cfg.preferred_name[strlen(str)] = '\0';