Clean up outdoor wandering monsters function, removing a useless parameter
This commit is contained in:
@@ -856,7 +856,7 @@ static void handle_combat_switch(bool& did_something, bool& need_redraw, bool& n
|
||||
end_town_mode(0,univ.party.town_loc);
|
||||
play_sound(93);
|
||||
add_string_to_buf("End combat.");
|
||||
handle_wandering_specials(0,1);
|
||||
handle_wandering_specials(1);
|
||||
menu_activate();
|
||||
put_pc_screen();
|
||||
set_stat_window_for_pc(univ.cur_pc);
|
||||
@@ -940,7 +940,7 @@ static void handle_party_death() {
|
||||
// TODO: Should this only happen in outdoor combat? Or should we allow fleeing town during combat?
|
||||
end_town_mode(0,univ.party.town_loc);
|
||||
add_string_to_buf("End combat.");
|
||||
handle_wandering_specials(0,2);
|
||||
handle_wandering_specials(2);
|
||||
}
|
||||
if(!univ.party.is_alive() && univ.party.is_split()) {
|
||||
univ.party.end_split(0);
|
||||
@@ -1439,7 +1439,7 @@ void handle_monster_actions(bool& need_redraw, bool& need_reprint) {
|
||||
if(which_combat_type == 0) {
|
||||
end_town_mode(0,univ.party.out_loc);
|
||||
add_string_to_buf("Fled the combat.");
|
||||
handle_wandering_specials(0,2);
|
||||
handle_wandering_specials(2);
|
||||
}
|
||||
} else {
|
||||
if(need_redraw) {
|
||||
@@ -1466,7 +1466,7 @@ void handle_monster_actions(bool& need_redraw, bool& need_reprint) {
|
||||
if((adjacent(univ.party.out_loc,univ.party.out_c[i].m_loc) || univ.party.out_c[i].what_monst.forced)
|
||||
&& univ.party.in_boat < 0 && !flying()) {
|
||||
store_wandering_special = univ.party.out_c[i].what_monst;
|
||||
if(handle_wandering_specials(0,0))
|
||||
if(handle_wandering_specials(0))
|
||||
initiate_outdoor_combat(i);
|
||||
univ.party.out_c[i].exists = false;
|
||||
|
||||
|
@@ -80,28 +80,30 @@ static void start_cartoon() {
|
||||
cartoon_happening = true;
|
||||
}
|
||||
|
||||
// which is unused
|
||||
//short mode; // 0 - pre 1 - end by victory 2 - end by flight
|
||||
// wanderin spec 99 -> generic spec
|
||||
bool handle_wandering_specials (short /*which*/,short mode) {
|
||||
bool handle_wandering_specials(short mode) {
|
||||
|
||||
// TODO: Is loc_in_sec the correct location to pass here?
|
||||
// (I'm pretty sure it is, but I should verify it somehow.)
|
||||
// (It's either that or univ.party.p_loc.)
|
||||
short s1 = 0,s2 = 0,s3 = 0;
|
||||
// TODO: If s2 > 0, encounter is forced (monsters don't flee even if they're weak)
|
||||
|
||||
if((mode == 0) && (store_wandering_special.spec_on_meet >= 0)) { // When encountering
|
||||
run_special(eSpecCtx::OUTDOOR_ENC,1,store_wandering_special.spec_on_meet,univ.party.loc_in_sec,&s1,&s2,&s3);
|
||||
if(s1 > 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
if((mode == 1) && (store_wandering_special.spec_on_win >= 0)) {// After defeating
|
||||
run_special(eSpecCtx::WIN_ENCOUNTER,1,store_wandering_special.spec_on_win,univ.party.loc_in_sec,&s1,&s2,&s3);
|
||||
}
|
||||
if((mode == 2) && (store_wandering_special.spec_on_flee >= 0)) {// After fleeing like a buncha girly men
|
||||
run_special(eSpecCtx::FLEE_ENCOUNTER,1,store_wandering_special.spec_on_flee,univ.party.loc_in_sec,&s1,&s2,&s3);
|
||||
short dummy;
|
||||
switch(mode) {
|
||||
case 0: // pre-combat, possibly prevent the fight
|
||||
// TODO: If s2 > 0, encounter is forced (monsters don't flee even if they're weak)
|
||||
|
||||
if((mode == 0) && (store_wandering_special.spec_on_meet >= 0)) { // When encountering
|
||||
short prevent;
|
||||
run_special(eSpecCtx::OUTDOOR_ENC,1,store_wandering_special.spec_on_meet,univ.party.loc_in_sec,&prevent,&dummy,&dummy);
|
||||
if(prevent > 0)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 1: // end by victory
|
||||
run_special(eSpecCtx::WIN_ENCOUNTER,1,store_wandering_special.spec_on_win,univ.party.loc_in_sec,&dummy,&dummy,&dummy);
|
||||
break;
|
||||
case 2: // end by loss (flight or total party kill)
|
||||
run_special(eSpecCtx::FLEE_ENCOUNTER,1,store_wandering_special.spec_on_flee,univ.party.loc_in_sec,&dummy,&dummy,&dummy);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "creature.hpp"
|
||||
|
||||
bool handle_wandering_specials (short which,short mode);
|
||||
bool handle_wandering_specials(short mode);
|
||||
bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,bool *forced);
|
||||
void check_fields(location where_check,eSpecCtx mode,cPlayer& which_pc);
|
||||
void use_spec_item(short item);
|
||||
|
Reference in New Issue
Block a user