diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-04-19 22:33:56 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-04-19 22:33:56 +0000 |
commit | eafcae549c51a843f20de2f83604216b89bf0efb (patch) | |
tree | 6a63b4c304878521f9edee520f99c8808a83a50a /crawl-ref/source/newgame.cc | |
parent | a2f3fb49a09de44357a61d09461d7e73412374df (diff) | |
download | crawl-ref-eafcae549c51a843f20de2f83604216b89bf0efb.tar.gz crawl-ref-eafcae549c51a843f20de2f83604216b89bf0efb.zip |
[2773135] Fixing bug where Options.weapon could specify a weapon that was not an available option for the character.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9663 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r-- | crawl-ref/source/newgame.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index b44d441a78..7e8fb62301 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -2379,18 +2379,29 @@ static bool _choose_weapon() for (int i = 0; i < num_choices; i++) startwep_restrictions[i] = _weapon_restriction(startwep[i]); - if (Options.weapon != WPN_UNKNOWN && Options.weapon != WPN_RANDOM - && (Options.weapon != WPN_UNARMED || claws_allowed)) + if (Options.weapon == WPN_UNARMED && claws_allowed) { - if (Options.weapon == WPN_UNARMED) - you.inv[0].quantity = 0; // no weapon - else - you.inv[0].sub_type = Options.weapon; - + you.inv[0].quantity = 0; // no weapon ng_weapon = Options.weapon; return (true); } + if (Options.weapon != WPN_UNKNOWN && Options.weapon != WPN_RANDOM + && Options.weapon != WPN_UNARMED) + { + // If Options.weapon is available, then use it. + for (int i = 0; i < num_choices; i++) + { + if (startwep[i] == Options.weapon + && startwep_restrictions[i] != CC_BANNED) + { + you.inv[0].sub_type = Options.weapon; + ng_weapon = Options.weapon; + return (true); + } + } + } + int keyin = 0; if (!Options.random_pick && Options.weapon != WPN_RANDOM) { |