More little fixes

- Fix timers triggering every turn after they expire
- More fixes for uninitialized data
- Fix attack 3 type changing to match attack 2 type when changed
- Fix last node in the node chain duplicating over the entire chain once you clicked OK
- Fix issue where finding an unused node returned the node currently being edited.
This commit is contained in:
2015-06-02 10:34:52 -04:00
parent 7dddcdb86e
commit 322e3b9e21
6 changed files with 18 additions and 13 deletions

View File

@@ -1876,6 +1876,7 @@ void special_increase_age(long length, bool queue) {
queue_special(eSpecCtx::PARTY_TIMER, which_type, univ.party.party_event_timers[i].node, null_loc);
else run_special(eSpecCtx::PARTY_TIMER,which_type,univ.party.party_event_timers[i].node,null_loc,&s1,&s2,&s3);
univ.party.party_event_timers[i].time = 0;
univ.party.party_event_timers[i].node = -1;
stat_area = true;
if(s3 > 0)
redraw = true;

View File

@@ -86,6 +86,7 @@ cItem::cItem(){
graphic_num = 0;
ability = eItemAbil::NONE;
abil_data[0] = 0;
abil_data[1] = 0;
type_flag = 0;
is_special = 0;
value = 0;

View File

@@ -381,6 +381,8 @@ std::map<eMonstAbil,uAbility>::iterator cMonster::addAbil(eMonstAbilTemplate wha
cMonster::cMonster(){
magic_res = poison_res = fire_res = cold_res = 100;
// TODO: Fill in
level = m_health = armor = skill = speed = 0;
mu = cl = 0;
see_spec = -1;
}

View File

@@ -101,8 +101,8 @@ union uAbility {
class cMonster {
public:
struct cAttack{
unsigned short dice, sides;
eMonstMelee type;
unsigned short dice = 0, sides = 0;
eMonstMelee type = eMonstMelee::SWING;
};
unsigned int level;
std::string m_name;

View File

@@ -781,9 +781,9 @@ static bool edit_monst_type_event_filter(cDialog& me,std::string hit,cMonster& m
}
} else if(hit == "picktype2") {
if(!save_monst_info(me,monst)) return false;
i = choose_text_res("monster-abilities",130,139,int(monst.a[1].type),&me,"Choose Attack 2 & 3 Type:");
i = choose_text_res("monster-abilities",130,139,int(monst.a[1].type),&me,"Choose Attack 2 Type:");
if(i >= 0) {
monst.a[1].type = monst.a[2].type = eMonstMelee(i);
monst.a[1].type = eMonstMelee(i);
put_monst_info_in_dlog(me,monst,which);
}
} else if(hit == "picktype3") {

View File

@@ -538,7 +538,8 @@ static void save_spec_enc(cDialog& me, node_stack_t& edit_stack) {
}
static bool commit_spec_enc(cDialog& me, std::string item_hit, node_stack_t& edit_stack) {
save_spec_enc(me, edit_stack);
if(item_hit != "unwind")
save_spec_enc(me, edit_stack);
int mode = edit_stack.top().mode, node = edit_stack.top().which;
switch(mode) {
case 0: scenario.scen_specials[node] = edit_stack.top().node; break;
@@ -734,7 +735,7 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
eStrType strt;
short str_adj = 0;
const char* title;
cSpecial node_to_change_to;
cSpecial* node_to_change_to;
switch(btn) {
case 'm':
choose_string = false;
@@ -759,14 +760,14 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
me[field].setTextToNum(store);
save_spec_enc(me, edit_stack);
if(mode == 0)
node_to_change_to = scenario.scen_specials[store];
node_to_change_to = &scenario.scen_specials[store];
else if(mode == 1)
node_to_change_to = current_terrain->specials[store];
node_to_change_to = &current_terrain->specials[store];
else if(mode == 2)
node_to_change_to = town->specials[store];
if(node_to_change_to.pic < 0)
node_to_change_to.pic = 0;
edit_stack.push({store,mode,node_to_change_to});
node_to_change_to = &town->specials[store];
if(node_to_change_to->pic < 0)
node_to_change_to->pic = 0;
edit_stack.push({store,mode,*node_to_change_to});
put_spec_enc_in_dlog(me, edit_stack);
me["back"].show();
return true;
@@ -890,7 +891,7 @@ short get_fresh_spec(short which_mode) {
store_node = current_terrain->specials[i];
if(which_mode == 2)
store_node = town->specials[i];
if(store_node.type == eSpecType::NONE && store_node.jumpto == -1)
if(store_node.type == eSpecType::NONE && store_node.jumpto == -1 && store_node.pic < 0)
return i;
}