diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-20 20:06:04 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-20 20:06:04 +0000 |
commit | 17c9dbde2c1c661099399df48d7754c2e267ae8f (patch) | |
tree | 1703dab71654af2af1d350421872b3382205fdf9 /crawl-ref/source/initfile.cc | |
parent | f494038250893bc8db8794809a2157e97c824cf9 (diff) | |
download | crawl-ref-17c9dbde2c1c661099399df48d7754c2e267ae8f.tar.gz crawl-ref-17c9dbde2c1c661099399df48d7754c2e267ae8f.zip |
Properly save and restore the starting wand or rod for the Artificer
class.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8630 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/initfile.cc')
-rw-r--r-- | crawl-ref/source/initfile.cc | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index ee3c194956..28ee46cf3d 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -240,7 +240,7 @@ static int _str_to_book( const std::string& str ) { if (str == "flame" || str == "fire") return (SBT_FIRE); - if (str == "cold" || str == "ice") + if (str == "frost" || str == "cold" || str == "ice") return (SBT_COLD); if (str == "summ" || str == "summoning") return (SBT_SUMM); @@ -296,6 +296,48 @@ static std::string _weapon_to_str( int weapon ) } } +static int _str_to_wand( const std::string& str ) +{ + if (str == "enslavement") + return (SWT_ENSLAVEMENT); + if (str == "confusion") + return (SWT_CONFUSION); + if (str == "magic darts" || str == "magicdarts") + return (SWT_MAGIC_DARTS); + if (str == "frost" || str == "cold" || str == "ice") + return (SWT_FROST); + if (str == "flame" || str == "fire") + return (SWT_FLAME); + if (str == "striking") + return (SWT_STRIKING); + if (str == "random") + return (SWT_RANDOM); + + return (SWT_NO_SELECTION); +} + +static std::string _wand_to_str( int weapon ) +{ + switch (weapon) + { + case SWT_ENSLAVEMENT: + return "enslavement"; + case SWT_CONFUSION: + return "confusion"; + case SWT_MAGIC_DARTS: + return "magic darts"; + case SWT_FROST: + return "frost"; + case SWT_FLAME: + return "flame"; + case SWT_STRIKING: + return "striking"; + case SWT_RANDOM: + default: + return "random"; + } +} + static fire_type _str_to_fire_types( const std::string &str ) { if (str == "launcher") @@ -465,6 +507,7 @@ void game_options::reset_startup_options() cls = 0; weapon = WPN_UNKNOWN; book = SBT_NO_SELECTION; + wand = SWT_NO_SELECTION; random_pick = false; good_random = true; chaos_knight = GOD_NO_GOD; @@ -655,6 +698,7 @@ void game_options::reset_options() prev_pr = GOD_NO_GOD; prev_weapon = WPN_UNKNOWN; prev_book = SBT_NO_SELECTION; + prev_wand = SWT_NO_SELECTION; prev_randpick = false; remember_name = true; @@ -1243,6 +1287,7 @@ void read_startup_prefs() Options.prev_cls = temp.cls; Options.prev_race = temp.race; Options.prev_book = temp.book; + Options.prev_wand = temp.wand; Options.prev_name = temp.player_name; #endif // !DISABLE_STICKY_STARTUP_OPTIONS } @@ -1294,6 +1339,9 @@ static void write_newgame_options(FILE *f) Options.prev_book == SBT_SUMM ? "summ" : "random"); } + + if (Options.prev_wand != SWT_NO_SELECTION) + fprintf(f, "wand = %s\n", _wand_to_str(Options.prev_wand).c_str()); } #endif // !DISABLE_STICKY_STARTUP_OPTIONS @@ -2183,6 +2231,11 @@ void game_options::read_option_line(const std::string &str, bool runscript) // Choose this book for classes that get choice. book = _str_to_book( field ); } + else if (key == "wand") + { + // Choose this wand for classes that get choice. + wand = _str_to_wand( field ); + } else if (key == "chaos_knight") { // Choose god for Chaos Knights. |