Remove a mostly-redundant static array
This commit is contained in:
@@ -24,31 +24,31 @@
|
|||||||
<text name='lbl3' top='106' left='24' width='97' height='16'/>
|
<text name='lbl3' top='106' left='24' width='97' height='16'/>
|
||||||
<text name='int' top='106' left='128' width='38' height='16'/>
|
<text name='int' top='106' left='128' width='38' height='16'/>
|
||||||
<text name='lbl4' top='129' left='24' width='97' height='16'/>
|
<text name='lbl4' top='129' left='24' width='97' height='16'/>
|
||||||
<text name='edge' top='129' left='128' width='38' height='16'/>
|
<text name='edged' top='129' left='128' width='38' height='16'/>
|
||||||
<text name='lbl5' top='147' left='24' width='97' height='16'/>
|
<text name='lbl5' top='147' left='24' width='97' height='16'/>
|
||||||
<text name='bash' top='147' left='128' width='38' height='16'/>
|
<text name='bashing' top='147' left='128' width='38' height='16'/>
|
||||||
<text name='lbl6' top='165' left='24' width='97' height='16'/>
|
<text name='lbl6' top='165' left='24' width='97' height='16'/>
|
||||||
<text name='pole' top='165' left='128' width='38' height='16'/>
|
<text name='pole' top='165' left='128' width='38' height='16'/>
|
||||||
<text name='lbl7' top='183' left='24' width='97' height='16'/>
|
<text name='lbl7' top='183' left='24' width='97' height='16'/>
|
||||||
<text name='thrown' top='183' left='128' width='38' height='16'/>
|
<text name='thrown' top='183' left='128' width='38' height='16'/>
|
||||||
<text name='lbl8' top='201' left='24' width='97' height='16'/>
|
<text name='lbl8' top='201' left='24' width='97' height='16'/>
|
||||||
<text name='bow' top='201' left='128' width='38' height='16'/>
|
<text name='archery' top='201' left='128' width='38' height='16'/>
|
||||||
<text name='lbl9' top='219' left='24' width='97' height='16'/>
|
<text name='lbl9' top='219' left='24' width='97' height='16'/>
|
||||||
<text name='def' top='219' left='128' width='38' height='16'/>
|
<text name='defense' top='219' left='128' width='38' height='16'/>
|
||||||
<text name='lbl10' top='70' left='171' width='92' height='16'/>
|
<text name='lbl10' top='70' left='171' width='92' height='16'/>
|
||||||
<text name='mage' top='70' left='266' width='38' height='16'/>
|
<text name='mage' top='70' left='266' width='38' height='16'/>
|
||||||
<text name='lbl11' top='88' left='171' width='92' height='16'/>
|
<text name='lbl11' top='88' left='171' width='92' height='16'/>
|
||||||
<text name='priest' top='88' left='266' width='38' height='16'/>
|
<text name='priest' top='88' left='266' width='38' height='16'/>
|
||||||
<text name='lbl12' top='106' left='171' width='92' height='16'/>
|
<text name='lbl12' top='106' left='171' width='92' height='16'/>
|
||||||
<text name='lore' top='106' left='266' width='38' height='16'/>
|
<text name='mage-lore' top='106' left='266' width='38' height='16'/>
|
||||||
<text name='lbl13' top='124' left='171' width='92' height='16'/>
|
<text name='lbl13' top='124' left='171' width='92' height='16'/>
|
||||||
<text name='alch' top='124' left='266' width='38' height='16'/>
|
<text name='alchemy' top='124' left='266' width='38' height='16'/>
|
||||||
<text name='lbl14' top='142' left='171' width='92' height='16'/>
|
<text name='lbl14' top='142' left='171' width='92' height='16'/>
|
||||||
<text name='item' top='142' left='266' width='38' height='16'/>
|
<text name='item-lore' top='142' left='266' width='38' height='16'/>
|
||||||
<text name='lbl15' top='165' left='171' width='92' height='16'/>
|
<text name='lbl15' top='165' left='171' width='92' height='16'/>
|
||||||
<text name='trap' top='165' left='266' width='38' height='16'/>
|
<text name='traps' top='165' left='266' width='38' height='16'/>
|
||||||
<text name='lbl16' top='183' left='171' width='92' height='16'/>
|
<text name='lbl16' top='183' left='171' width='92' height='16'/>
|
||||||
<text name='lock' top='183' left='266' width='38' height='16'/>
|
<text name='lockpick' top='183' left='266' width='38' height='16'/>
|
||||||
<text name='lbl17' top='201' left='171' width='92' height='16'/>
|
<text name='lbl17' top='201' left='171' width='92' height='16'/>
|
||||||
<text name='assassin' top='201' left='266' width='38' height='16'/>
|
<text name='assassin' top='201' left='266' width='38' height='16'/>
|
||||||
<text name='lbl18' top='219' left='171' width='92' height='16'/>
|
<text name='lbl18' top='219' left='171' width='92' height='16'/>
|
||||||
|
@@ -17,32 +17,32 @@
|
|||||||
<button name='dex-p' type='small' top='141' left='256'>+</button>
|
<button name='dex-p' type='small' top='141' left='256'>+</button>
|
||||||
<button name='int-m' type='small' top='163' left='231'>-</button>
|
<button name='int-m' type='small' top='163' left='231'>-</button>
|
||||||
<button name='int-p' type='small' top='163' left='256'>+</button>
|
<button name='int-p' type='small' top='163' left='256'>+</button>
|
||||||
<button name='edge-m' type='small' top='204' left='231'>-</button>
|
<button name='edged-m' type='small' top='204' left='231'>-</button>
|
||||||
<button name='edge-p' type='small' top='204' left='256'>+</button>
|
<button name='edged-p' type='small' top='204' left='256'>+</button>
|
||||||
<button name='bash-m' type='small' top='226' left='231'>-</button>
|
<button name='bashing-m' type='small' top='226' left='231'>-</button>
|
||||||
<button name='bash-p' type='small' top='226' left='256'>+</button>
|
<button name='bashing-p' type='small' top='226' left='256'>+</button>
|
||||||
<button name='pole-m' type='small' top='248' left='231'>-</button>
|
<button name='pole-m' type='small' top='248' left='231'>-</button>
|
||||||
<button name='pole-p' type='small' top='248' left='256'>+</button>
|
<button name='pole-p' type='small' top='248' left='256'>+</button>
|
||||||
<button name='thrown-m' type='small' top='270' left='231'>-</button>
|
<button name='thrown-m' type='small' top='270' left='231'>-</button>
|
||||||
<button name='thrown-p' type='small' top='270' left='256'>+</button>
|
<button name='thrown-p' type='small' top='270' left='256'>+</button>
|
||||||
<button name='bow-m' type='small' top='292' left='231'>-</button>
|
<button name='archery-m' type='small' top='292' left='231'>-</button>
|
||||||
<button name='bow-p' type='small' top='292' left='256'>+</button>
|
<button name='archery-p' type='small' top='292' left='256'>+</button>
|
||||||
<button name='def-m' type='small' top='314' left='231'>-</button>
|
<button name='defense-m' type='small' top='314' left='231'>-</button>
|
||||||
<button name='def-p' type='small' top='314' left='256'>+</button>
|
<button name='defense-p' type='small' top='314' left='256'>+</button>
|
||||||
<button name='mage-m' type='small' top='74' left='472'>-</button>
|
<button name='mage-m' type='small' top='74' left='472'>-</button>
|
||||||
<button name='mage-p' type='small' top='74' left='497'>+</button>
|
<button name='mage-p' type='small' top='74' left='497'>+</button>
|
||||||
<button name='priest-m' type='small' top='96' left='472'>-</button>
|
<button name='priest-m' type='small' top='96' left='472'>-</button>
|
||||||
<button name='priest-p' type='small' top='96' left='497'>+</button>
|
<button name='priest-p' type='small' top='96' left='497'>+</button>
|
||||||
<button name='lore-m' type='small' top='118' left='472'>-</button>
|
<button name='mage-lore-m' type='small' top='118' left='472'>-</button>
|
||||||
<button name='lore-p' type='small' top='118' left='497'>+</button>
|
<button name='mage-lore-p' type='small' top='118' left='497'>+</button>
|
||||||
<button name='alch-m' type='small' top='140' left='472'>-</button>
|
<button name='alchemy-m' type='small' top='140' left='472'>-</button>
|
||||||
<button name='alch-p' type='small' top='140' left='497'>+</button>
|
<button name='alchemy-p' type='small' top='140' left='497'>+</button>
|
||||||
<button name='item-m' type='small' top='162' left='472'>-</button>
|
<button name='item-lore-m' type='small' top='162' left='472'>-</button>
|
||||||
<button name='item-p' type='small' top='162' left='497'>+</button>
|
<button name='item-lore-p' type='small' top='162' left='497'>+</button>
|
||||||
<button name='trap-m' type='small' top='206' left='472'>-</button>
|
<button name='traps-m' type='small' top='206' left='472'>-</button>
|
||||||
<button name='trap-p' type='small' top='206' left='497'>+</button>
|
<button name='traps-p' type='small' top='206' left='497'>+</button>
|
||||||
<button name='lock-m' type='small' top='228' left='472'>-</button>
|
<button name='lockpick-m' type='small' top='228' left='472'>-</button>
|
||||||
<button name='lock-p' type='small' top='228' left='497'>+</button>
|
<button name='lockpick-p' type='small' top='228' left='497'>+</button>
|
||||||
<button name='assassin-m' type='small' top='250' left='472'>-</button>
|
<button name='assassin-m' type='small' top='250' left='472'>-</button>
|
||||||
<button name='assassin-p' type='small' top='250' left='497'>+</button>
|
<button name='assassin-p' type='small' top='250' left='497'>+</button>
|
||||||
<button name='poison-m' type='small' top='272' left='472'>-</button>
|
<button name='poison-m' type='small' top='272' left='472'>-</button>
|
||||||
@@ -61,19 +61,19 @@
|
|||||||
<text name='str' framed='true' top='121' left='194' width='28' height='16'/>
|
<text name='str' framed='true' top='121' left='194' width='28' height='16'/>
|
||||||
<text name='dex' framed='true' top='143' left='194' width='28' height='16'/>
|
<text name='dex' framed='true' top='143' left='194' width='28' height='16'/>
|
||||||
<text name='int' framed='true' top='165' left='194' width='28' height='16'/>
|
<text name='int' framed='true' top='165' left='194' width='28' height='16'/>
|
||||||
<text name='edge' framed='true' top='207' left='194' width='28' height='16'/>
|
<text name='edged' framed='true' top='207' left='194' width='28' height='16'/>
|
||||||
<text name='bash' framed='true' top='229' left='194' width='28' height='16'/>
|
<text name='bashing' framed='true' top='229' left='194' width='28' height='16'/>
|
||||||
<text name='pole' framed='true' top='251' left='194' width='28' height='16'/>
|
<text name='pole' framed='true' top='251' left='194' width='28' height='16'/>
|
||||||
<text name='thrown' framed='true' top='272' left='194' width='28' height='16'/>
|
<text name='thrown' framed='true' top='272' left='194' width='28' height='16'/>
|
||||||
<text name='bow' framed='true' top='294' left='194' width='28' height='16'/>
|
<text name='archery' framed='true' top='294' left='194' width='28' height='16'/>
|
||||||
<text name='def' framed='true' top='316' left='194' width='28' height='16'/>
|
<text name='defense' framed='true' top='316' left='194' width='28' height='16'/>
|
||||||
<text name='mage' framed='true' top='76' left='435' width='28' height='16'/>
|
<text name='mage' framed='true' top='76' left='435' width='28' height='16'/>
|
||||||
<text name='priest' framed='true' top='98' left='435' width='29' height='16'/>
|
<text name='priest' framed='true' top='98' left='435' width='29' height='16'/>
|
||||||
<text name='lore' framed='true' top='121' left='435' width='29' height='16'/>
|
<text name='mage-lore' framed='true' top='121' left='435' width='29' height='16'/>
|
||||||
<text name='alch' framed='true' top='142' left='435' width='29' height='16'/>
|
<text name='alchemy' framed='true' top='142' left='435' width='29' height='16'/>
|
||||||
<text name='item' framed='true' top='164' left='435' width='29' height='16'/>
|
<text name='item-lore' framed='true' top='164' left='435' width='29' height='16'/>
|
||||||
<text name='trap' framed='true' top='208' left='434' width='29' height='16'/>
|
<text name='traps' framed='true' top='208' left='434' width='29' height='16'/>
|
||||||
<text name='lock' framed='true' top='230' left='434' width='29' height='16'/>
|
<text name='lockpick' framed='true' top='230' left='434' width='29' height='16'/>
|
||||||
<text name='assassin' framed='true' top='252' left='434' width='29' height='16'/>
|
<text name='assassin' framed='true' top='252' left='434' width='29' height='16'/>
|
||||||
<text name='poison' framed='true' top='274' left='434' width='29' height='16'/>
|
<text name='poison' framed='true' top='274' left='434' width='29' height='16'/>
|
||||||
<text name='luck' framed='true' top='296' left='434' width='29' height='16'/>
|
<text name='luck' framed='true' top='296' left='434' width='29' height='16'/>
|
||||||
@@ -83,10 +83,7 @@
|
|||||||
<text size='large' top='185' left='38' width='133' height='17'>Warrior Skills:</text>
|
<text size='large' top='185' left='38' width='133' height='17'>Warrior Skills:</text>
|
||||||
<text size='large' top='53' left='292' width='133' height='17'>Magic Skills:</text>
|
<text size='large' top='53' left='292' width='133' height='17'>Magic Skills:</text>
|
||||||
<text size='large' top='185' left='292' width='133' height='17'>Other Skills:</text>
|
<text size='large' top='185' left='292' width='133' height='17'>Other Skills:</text>
|
||||||
<!--
|
<text top='365' left='6' width='382' height='16'>Cost: (Skill pts./Gold) Alt-click for description</text>
|
||||||
TODO: Change this to say alt instead of option
|
|
||||||
-->
|
|
||||||
<text top='365' left='6' width='382' height='16'>Cost: (Skill pts./Gold) Option-click for description</text>
|
|
||||||
<text top='344' left='71' width='68' height='16'>Skill Pts.:</text>
|
<text top='344' left='71' width='68' height='16'>Skill Pts.:</text>
|
||||||
<text top='344' left='252' width='42' height='16'>Gold:</text>
|
<text top='344' left='252' width='42' height='16'>Gold:</text>
|
||||||
<button name='help' type='help' def-key='help' top='6' left='506'/>
|
<button name='help' type='help' def-key='help' top='6' left='506'/>
|
||||||
|
@@ -32,7 +32,6 @@ short mage_spell_pos = 0,priest_spell_pos = 0,skill_pos = 0;
|
|||||||
extern std::map<eSkill,short> skill_cost;
|
extern std::map<eSkill,short> skill_cost;
|
||||||
extern std::map<eSkill,short> skill_max;
|
extern std::map<eSkill,short> skill_max;
|
||||||
extern std::map<eSkill,short> skill_g_cost;
|
extern std::map<eSkill,short> skill_g_cost;
|
||||||
extern const char* skill_ids[19];
|
|
||||||
extern short cur_town_talk_loaded;
|
extern short cur_town_talk_loaded;
|
||||||
extern sf::RenderWindow mainPtr;
|
extern sf::RenderWindow mainPtr;
|
||||||
extern short on_monst_menu[256];
|
extern short on_monst_menu[256];
|
||||||
@@ -516,7 +515,7 @@ static void display_pc_info(cDialog& me, const short pc) {
|
|||||||
int bonus = univ.party[pc].get_prot_level(eItemAbil::BOOST_STAT, i);
|
int bonus = univ.party[pc].get_prot_level(eItemAbil::BOOST_STAT, i);
|
||||||
to_draw << univ.party[pc].skills[skill];
|
to_draw << univ.party[pc].skills[skill];
|
||||||
if(bonus > 0) to_draw << '+' << bonus;
|
if(bonus > 0) to_draw << '+' << bonus;
|
||||||
me[skill_ids[i]].setText(to_draw.str());
|
me[boost::lexical_cast<std::string>(skill)].setText(to_draw.str());
|
||||||
to_draw.str("");
|
to_draw.str("");
|
||||||
}
|
}
|
||||||
me["encumb"].setTextToNum(total_encumbrance(pc));
|
me["encumb"].setTextToNum(total_encumbrance(pc));
|
||||||
|
@@ -51,14 +51,6 @@ extern std::map<eSkill,short> skill_cost;
|
|||||||
extern std::map<eSkill,short> skill_max;
|
extern std::map<eSkill,short> skill_max;
|
||||||
extern std::map<eSkill,short> skill_g_cost;
|
extern std::map<eSkill,short> skill_g_cost;
|
||||||
|
|
||||||
// These are the IDs used to refer to the skills in the dialog
|
|
||||||
const char* skill_ids[19] = {
|
|
||||||
"str","dex","int",
|
|
||||||
"edge","bash","pole","thrown","bow","def",
|
|
||||||
"mage","priest","lore","alch","item",
|
|
||||||
"trap","lock","assassin","poison","luck"
|
|
||||||
};
|
|
||||||
|
|
||||||
static void put_pc_spells(cDialog& me, short store_trait_mode) {
|
static void put_pc_spells(cDialog& me, short store_trait_mode) {
|
||||||
store_trait_mode %= 10;
|
store_trait_mode %= 10;
|
||||||
|
|
||||||
@@ -333,25 +325,16 @@ static bool can_change_skill(eSkill skill, xp_dlog_state& save, bool increase) {
|
|||||||
|
|
||||||
static void draw_xp_skills(cDialog& me,xp_dlog_state& save) {
|
static void draw_xp_skills(cDialog& me,xp_dlog_state& save) {
|
||||||
// TODO: Wouldn't it make more sense for it to be red when you can't buy the skill rather than red when you can?
|
// TODO: Wouldn't it make more sense for it to be red when you can't buy the skill rather than red when you can?
|
||||||
for(short i = 0; i < 19; i++) {
|
for(short i = 0; i <= 20; i++) {
|
||||||
cControl& cur = me[skill_ids[i]];
|
|
||||||
eSkill skill = eSkill(i);
|
eSkill skill = eSkill(i);
|
||||||
|
cControl& cur = me[boost::lexical_cast<std::string>(skill)];
|
||||||
if(can_change_skill(skill, save, true))
|
if(can_change_skill(skill, save, true))
|
||||||
cur.setColour(sf::Color::Red);
|
cur.setColour(sf::Color::Red);
|
||||||
else cur.setColour(me.getDefTextClr());
|
else cur.setColour(me.getDefTextClr());
|
||||||
cur.setTextToNum(save.skills[skill]);
|
if(i < 19)
|
||||||
|
cur.setTextToNum(save.skills[skill]);
|
||||||
|
else cur.setTextToNum(skill == eSkill::MAX_HP ? save.hp : save.sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
cControl& sp = me["sp"];
|
|
||||||
cControl& hp = me["hp"];
|
|
||||||
if(can_change_skill(eSkill::MAX_HP, save, true))
|
|
||||||
hp.setColour(sf::Color::Red);
|
|
||||||
else hp.setColour(me.getDefTextClr());
|
|
||||||
hp.setTextToNum(save.hp);
|
|
||||||
if(can_change_skill(eSkill::MAX_SP, save, true))
|
|
||||||
sp.setColour(sf::Color::Red);
|
|
||||||
else sp.setColour(me.getDefTextClr());
|
|
||||||
sp.setTextToNum(save.sp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_gold_skills(cDialog& me, xp_dlog_state& save) {
|
static void update_gold_skills(cDialog& me, xp_dlog_state& save) {
|
||||||
@@ -489,10 +472,11 @@ static bool spend_xp_event_filter(cDialog& me, std::string item_hit, eKeyMod mod
|
|||||||
draw_xp_skills(me,save);
|
draw_xp_skills(me,save);
|
||||||
} else {
|
} else {
|
||||||
eSkill which_skill = eSkill::INVALID;
|
eSkill which_skill = eSkill::INVALID;
|
||||||
for(int i = 0; i < 19; i++) {
|
// TODO: Even though it includes 19 and 20, these will never match since they're handled separately above
|
||||||
size_t n = strlen(skill_ids[i]);
|
for(int i = 0; i <= 20; i++) {
|
||||||
if(item_hit.length() < n + 2) continue;
|
std::string id_base = boost::lexical_cast<std::string>(eSkill(i));
|
||||||
if(item_hit.substr(0, item_hit.length() - 2) == skill_ids[i]) {
|
if(item_hit.length() < id_base.length() + 2) continue;
|
||||||
|
if(id_base.compare(0, id_base.length(), item_hit)) {
|
||||||
which_skill = eSkill(i);
|
which_skill = eSkill(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -533,7 +517,7 @@ static bool spend_xp_event_filter(cDialog& me, std::string item_hit, eKeyMod mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_gold_skills(me, save);
|
update_gold_skills(me, save);
|
||||||
me[skill_ids[int(which_skill)]].setTextToNum(save.skills[which_skill]);
|
me[boost::lexical_cast<std::string>(which_skill)].setTextToNum(save.skills[which_skill]);
|
||||||
draw_xp_skills(me,save);
|
draw_xp_skills(me,save);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,15 +542,16 @@ bool spend_xp(short pc_num, short mode, cDialog* parent) {
|
|||||||
xpDlog.addLabelFor("hp","Health (1/10)",LABEL_LEFT,75,true);
|
xpDlog.addLabelFor("hp","Health (1/10)",LABEL_LEFT,75,true);
|
||||||
xpDlog.addLabelFor("sp","Spell Pts. (1/15)",LABEL_LEFT,75,true);
|
xpDlog.addLabelFor("sp","Spell Pts. (1/15)",LABEL_LEFT,75,true);
|
||||||
auto spend_xp_filter = std::bind(spend_xp_event_filter,_1,_2,_3,std::ref(save));
|
auto spend_xp_filter = std::bind(spend_xp_event_filter,_1,_2,_3,std::ref(save));
|
||||||
std::string minus = "-m", plus = "-p";
|
static const std::string minus = "-m", plus = "-p";
|
||||||
for(int i = 54; i < 73; i++) {
|
for(int i = 54; i < 73; i++) {
|
||||||
std::ostringstream sout;
|
std::ostringstream sout;
|
||||||
eSkill skill = eSkill(i - 54);
|
eSkill skill = eSkill(i - 54);
|
||||||
|
std::string id = boost::lexical_cast<std::string>(skill);
|
||||||
sout << get_str("skills",1 + 2 * (i - 54)) << ' ' << '(';
|
sout << get_str("skills",1 + 2 * (i - 54)) << ' ' << '(';
|
||||||
sout << skill_cost[skill] << '/' << skill_g_cost[skill] << ')';
|
sout << skill_cost[skill] << '/' << skill_g_cost[skill] << ')';
|
||||||
xpDlog.addLabelFor(skill_ids[i - 54],sout.str(),LABEL_LEFT,(i < 63) ? 75 : 69,true);
|
xpDlog.addLabelFor(id,sout.str(),LABEL_LEFT,(i < 63) ? 75 : 69,true);
|
||||||
xpDlog[skill_ids[i - 54] + minus].attachClickHandler(spend_xp_filter);
|
xpDlog[id + minus].attachClickHandler(spend_xp_filter);
|
||||||
xpDlog[skill_ids[i - 54] + plus].attachClickHandler(spend_xp_filter);
|
xpDlog[id + plus].attachClickHandler(spend_xp_filter);
|
||||||
}
|
}
|
||||||
do_xp_draw(xpDlog,save);
|
do_xp_draw(xpDlog,save);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user