summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/newgame.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-06-13 19:11:09 -0400
committerNeil Moore <neil@s-z.org>2014-06-13 19:11:10 -0400
commit4ea94c40d51960e4fe72ce1151e8efcc99f5a6c3 (patch)
tree6fb2ef5dd1da8fb9bacc4515ab2063caa849ddaf /crawl-ref/source/newgame.cc
parente4b89ecd48b6e00fe65787224f8561f92c46326e (diff)
downloadcrawl-ref-4ea94c40d51960e4fe72ce1151e8efcc99f5a6c3.tar.gz
crawl-ref-4ea94c40d51960e4fe72ce1151e8efcc99f5a6c3.zip
Prompt for weapon choice if preselection was bad (#8577)
Previously we just aborted, which made the 'weapon' option kind of difficult to use (anything except "random" or "viable" would prevent selecting certain classes). It would be nice if the player could specify multiple values for the option, e.g. weapon = spear, trident, crossbow
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r--crawl-ref/source/newgame.cc24
1 files changed, 7 insertions, 17 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index f9e41d43b5..659b9f5c0f 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -1705,10 +1705,6 @@ static void _resolve_weapon(newgame_def* ng, newgame_def* ng_choice,
{
switch (ng_choice->weapon)
{
- case WPN_UNKNOWN:
- ng->weapon = WPN_UNKNOWN;
- return;
-
case WPN_VIABLE:
{
int good_choices = 0;
@@ -1729,16 +1725,9 @@ static void _resolve_weapon(newgame_def* ng, newgame_def* ng_choice,
return;
default:
- // Check this is a legal choice, in case it came
- // through command line options.
+ // _fixup_weapon will return WPN_UNKNOWN, allowing the player
+ // to select the weapon, if the weapon option is incompatible.
ng->weapon = _fixup_weapon(ng_choice->weapon, weapons);
- if (ng->weapon == WPN_UNKNOWN)
- {
- // Either an invalid combination was passed in through options,
- // or we messed up.
- end(1, false,
- "Incompatible weapon specified in options file.");
- }
return;
}
}
@@ -1779,13 +1768,14 @@ static bool _choose_weapon(newgame_def* ng, newgame_def* ng_choice,
return true;
}
- if (ng_choice->weapon == WPN_UNKNOWN
- && !_prompt_weapon(ng, ng_choice, defaults, weapons))
+ _resolve_weapon(ng, ng_choice, weapons);
+ if (ng->weapon == WPN_UNKNOWN)
{
- return false;
+ if (!_prompt_weapon(ng, ng_choice, defaults, weapons))
+ return false;
+ _resolve_weapon(ng, ng_choice, weapons);
}
- _resolve_weapon(ng, ng_choice, weapons);
return true;
}