Example #1
0
CharSpells::CharSpells(CharGenChoices &choices, Console *console) : CharGenBase(console) {
	_choices = &choices;
	load("cg_spells");

	_currentSpellLevel = SIZE_MAX;
	_abilityLimit = 0;

	_spellHelp = new CharHelp("cg_spellinfo", console);

	// TODO: Recommend button in the spell selection for the character generator.
	getWidget("RecommendButton", true)->setDisabled(true);
	// TODO: Reset button in the spell selection for the character generator.
	getWidget("ResetButton", true)->setDisabled(true);

	_availListBox = getListBox("AvailBox", true);
	_availListBox->setMode(WidgetListBox::kModeSelectable);
	_knownListBox = getListBox("KnownBox", true);
	_knownListBox->setMode(WidgetListBox::kModeSelectable);

	for (uint32 lvl = 0; lvl < 10; ++lvl) {
		WidgetButton *spellLvlButton = getButton("SpellLevel" + Common::composeString<uint32>(lvl), true);
		spellLvlButton->setTooltip(TalkMan.getString(68674 + lvl));
		spellLvlButton->setTooltipPosition(20.f, -40.f, -100.f);

		// TODO: The button should be render properly when pressed.
		spellLvlButton->setMode(WidgetButton::kModeUnchanged);
		spellLvlButton->setPressed(false);
	}

	makeSpellsList();
}