character death always interrupt long town wait
This commit is contained in:
@@ -1188,6 +1188,7 @@ void handle_alchemy(bool& need_redraw, bool& need_reprint) {
|
|||||||
|
|
||||||
static void handle_town_wait(bool& need_redraw, bool& need_reprint) {
|
static void handle_town_wait(bool& need_redraw, bool& need_reprint) {
|
||||||
std::vector<short> store_hp;
|
std::vector<short> store_hp;
|
||||||
|
std::vector<bool> store_alive;
|
||||||
sf::Event dummy_evt;
|
sf::Event dummy_evt;
|
||||||
need_reprint = true;
|
need_reprint = true;
|
||||||
need_redraw = true;
|
need_redraw = true;
|
||||||
@@ -1202,6 +1203,7 @@ static void handle_town_wait(bool& need_redraw, bool& need_reprint) {
|
|||||||
pause(10);
|
pause(10);
|
||||||
for(cPlayer& pc : univ.party) {
|
for(cPlayer& pc : univ.party) {
|
||||||
store_hp.push_back(pc.cur_health);
|
store_hp.push_back(pc.cur_health);
|
||||||
|
store_alive.push_back(pc.is_alive());
|
||||||
pc.status[eStatus::WEBS] = 0;
|
pc.status[eStatus::WEBS] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1212,14 +1214,19 @@ static void handle_town_wait(bool& need_redraw, bool& need_reprint) {
|
|||||||
do_monsters();
|
do_monsters();
|
||||||
do_monster_turn();
|
do_monster_turn();
|
||||||
int make_wand = get_ran(1,1,160 - univ.town->difficulty);
|
int make_wand = get_ran(1,1,160 - univ.town->difficulty);
|
||||||
if(make_wand == 10)
|
if(make_wand == 10){
|
||||||
create_wand_monst();
|
create_wand_monst();
|
||||||
for(int j = 0; j < 6; j++)
|
}
|
||||||
if(univ.party[j].cur_health < store_hp[j]) {
|
for(int j = 0; j < 6; j++){
|
||||||
|
// Interrupt long wait if anyone takes damage or dies.
|
||||||
|
// NOTE: A hilarious bug used to exist where PCs starting at HP 0 could die without interrupting
|
||||||
|
// the wait, because their cur_health would still equal the store_hp value. This is now fixed.
|
||||||
|
if(univ.party[j].cur_health < store_hp[j] || univ.party[j].is_alive() != store_alive[j]) {
|
||||||
interrupted = true;
|
interrupted = true;
|
||||||
j = 6;
|
j = 6;
|
||||||
add_string_to_buf(" Waiting interrupted.");
|
add_string_to_buf(" Waiting interrupted.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(party_sees_a_monst()) {
|
if(party_sees_a_monst()) {
|
||||||
interrupted = true;
|
interrupted = true;
|
||||||
add_string_to_buf(" Monster sighted!");
|
add_string_to_buf(" Monster sighted!");
|
||||||
|
Reference in New Issue
Block a user