this->redraw = false;
this->use_mind = 0;
this->menu_line = (use_menu ? 1 : 0);
+ this->mind_ptr = NULL;
}
/*!
bool MindPowerGetter::get_mind_power(SPELL_IDX *sn, bool only_browse)
{
select_mind_description();
- COMMAND_CODE code;
- const mind_power *mind_ptr = &mind_powers[this->use_mind];
- *sn = -1;
- if (repeat_pull(&code)) {
- *sn = (SPELL_IDX)code;
- if (*sn == INVEN_FORCE)
- repeat_pull(&code);
-
- *sn = (SPELL_IDX)code;
- if (mind_ptr->info[*sn].min_lev <= this->caster_ptr->lev)
- return true;
+ if (select_spell_index(sn)) {
+ return true;
}
for (this->index = 0; this->index < MAX_MIND_POWERS; this->index++)
break;
}
}
+
+bool MindPowerGetter::select_spell_index(SPELL_IDX *sn)
+{
+ COMMAND_CODE code;
+ this->mind_ptr = &mind_powers[this->use_mind];
+ *sn = -1;
+ if (!repeat_pull(&code)) {
+ return false;
+ }
+
+ *sn = (SPELL_IDX)code;
+ if (*sn == INVEN_FORCE) {
+ (void)repeat_pull(&code);
+ }
+
+ *sn = (SPELL_IDX)code;
+ return mind_ptr->info[*sn].min_lev <= this->caster_ptr->lev;
+}
#include "system/angband.h"
+struct mind_power;
struct mind_type;
struct player_type;
class MindPowerGetter {
bool redraw;
int use_mind;
int menu_line;
+ const mind_power *mind_ptr;
void select_mind_description();
+ bool select_spell_index(SPELL_IDX *sn);
};