summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/skill_menu.cc
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2012-01-07 01:19:00 +0100
committerRaphael Langella <raphael.langella@gmail.com>2012-01-07 01:19:00 +0100
commitee9adb39adf07de7a8dba06a27a230c257ca9576 (patch)
tree46339fd4bfc4d5831cd99e3f1d75cd6abebf9221 /crawl-ref/source/skill_menu.cc
parentfe0275252be953f304396e1bc40dbf6aec89c433 (diff)
downloadcrawl-ref-ee9adb39adf07de7a8dba06a27a230c257ca9576.tar.gz
crawl-ref-ee9adb39adf07de7a8dba06a27a230c257ca9576.zip
Make it easier to switch between auto and manual skill mode.
The activation state of skills is saved separately. Makes sense since they are usually used very differently.
Diffstat (limited to 'crawl-ref/source/skill_menu.cc')
-rw-r--r--crawl-ref/source/skill_menu.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/crawl-ref/source/skill_menu.cc b/crawl-ref/source/skill_menu.cc
index fcd7d8a52b..5cee9f4e34 100644
--- a/crawl-ref/source/skill_menu.cc
+++ b/crawl-ref/source/skill_menu.cc
@@ -907,15 +907,18 @@ void SkillMenu::toggle(skill_menu_switch sw)
if (!m_switches[sw]->toggle())
return;
+ // XXX: should use a pointer instead.
+ FixedVector<int8_t, NUM_SKILLS> tmp;
+
switch (sw)
{
case SKM_MODE:
you.auto_training = !you.auto_training;
- // Skills are on by default in auto mode and off in manual.
- for (int i = 0; i < NUM_SKILLS; ++i)
- if (!you.train_set[i])
- you.train[i] = you.auto_training;
+ // Switch the skill train state with the saved version.
+ tmp = you.train;
+ you.train = you.train_alt;
+ you.train_alt = tmp;
reset_training();
if (get_state(SKM_VIEW) == SKM_VIEW_TRAINING)