diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:14 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:14 +0200 |
commit | ef68a0c23ddb50de58ddb55f1f893095b78d7c4c (patch) | |
tree | 0662cb7a852680d65097e7989cd5fb8c7108edb7 | |
parent | 90ab4c37504bfa1f33246d963d40032b70ed39ac (diff) |
Clean up cheat option handling in loadsave.c
-rw-r--r-- | src/loadsave.cc | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/loadsave.cc b/src/loadsave.cc index 07e2c4fc..8166ab65 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -1670,29 +1670,14 @@ static void do_options(ls_flag_t flag) do_byte(&hitpoint_warn, flag); /*** Cheating options ***/ - if (flag == ls_flag_t::LOAD) /* There *MUST* be some nice way to unify this! */ - { - u16b c; - do_u16b(&c, ls_flag_t::LOAD); - if (c & 0x0002) wizard = TRUE; - cheat_peek = (c & 0x0100) ? TRUE : FALSE; - cheat_hear = (c & 0x0200) ? TRUE : FALSE; - cheat_room = (c & 0x0400) ? TRUE : FALSE; - cheat_xtra = (c & 0x0800) ? TRUE : FALSE; - cheat_live = (c & 0x2000) ? TRUE : FALSE; - } - if (flag == ls_flag_t::SAVE) - { - u16b c = 0; - if (wizard) c |= 0x0002; - if (cheat_peek) c |= 0x0100; - if (cheat_hear) c |= 0x0200; - if (cheat_room) c |= 0x0400; - if (cheat_xtra) c |= 0x0800; - if (cheat_live) c |= 0x2000; - do_u16b(&c, ls_flag_t::SAVE); - } - + do_bool(&wizard, flag); + do_bool(&cheat_peek, flag); + do_bool(&cheat_hear, flag); + do_bool(&cheat_room, flag); + do_bool(&cheat_xtra, flag); + do_bool(&cheat_live, flag); + + /*** Autosave options */ do_bool(&autosave_l, flag); do_bool(&autosave_t, flag); do_s16b(&autosave_freq, flag); |