diff options
author | Bardur Arantsson <bardur@scientician.net> | 2019-02-15 19:20:25 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2019-02-15 19:20:25 +0100 |
commit | ca14a8b243f7963e52b2b92d584e25f7d5c21ed6 (patch) | |
tree | 5f8ada931dc9a72968dfe6b081201e0f5eb8b2c9 /src/birth.cc | |
parent | a0de18fbfeb1f4c746249c3f5508a27b54c05220 (diff) |
Add set_player_base()
This replaces the "set" + "mutate-in-place" approach to player_base
with a saner approach.
Diffstat (limited to 'src/birth.cc')
-rw-r--r-- | src/birth.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/birth.cc b/src/birth.cc index 7b8717ae..d9e65026 100644 --- a/src/birth.cc +++ b/src/birth.cc @@ -3121,10 +3121,14 @@ savefile_try_again: prt("Enter the name of the savefile that will hold this character: ", 23, 0); /* Ask the user for a string */ - if (!askfor_aux(&game->player_base, 15)) continue; + auto tmp = game->player_base; + if (!askfor_aux(&tmp, 15)) + { + continue; + } /* Process the player name */ - process_player_name(); + set_player_base(tmp); // If the savefile already exists, we do *NOT* want to // create a new game, so we'll need to return FALSE for @@ -3161,10 +3165,14 @@ savefile_try_again: prt("Enter the name of a savefile: ", 23, 0); /* Ask the user for a string */ - if (!askfor_aux(&game->player_base, 15)) continue; + auto tmp = game->player_base; + if (!askfor_aux(&tmp, 15)) + { + continue; + } /* Process the player name */ - process_player_name(); + set_player_base(tmp); return false; } @@ -3177,10 +3185,8 @@ savefile_try_again: if ((x < 2) || (x >= max)) continue; - game->player_base = savefile_names[savefile_idx[x - 2]]; - /* Process the player name */ - process_player_name(); + set_player_base(savefile_names[savefile_idx[x - 2]]); return false; } |