move real deletion behavior into drop_pc(), keep buffer messages

This commit is contained in:
2024-08-23 21:37:41 -05:00
committed by Celtic Minstrel
parent 2513fc113b
commit 47ceeabddc
3 changed files with 19 additions and 28 deletions

View File

@@ -2627,21 +2627,24 @@ void switch_pc(short which) {
}
}
void drop_pc(short which) {
std::string choice;
choice = cChoiceDlog("delete-pc-confirm",{"yes","no"}).show();
if(choice == "no") {
add_string_to_buf("Delete PC: Cancelled.");
return;
void drop_pc() {
if(!prime_time()) {
ASB("Finish what you're doing first.");
print_buf();
}
else {
int choice = char_select_pc(1,"Delete who?");
if(choice < 6) {
std::string confirm = cChoiceDlog("delete-pc-confirm",{"yes","no"}).show();
if(confirm == "no"){
add_string_to_buf("Delete PC: Cancelled.");
}else if(confirm == "yes"){
add_string_to_buf("Delete PC: OK.");
kill_pc(univ.party[choice],eMainStatus::ABSENT);
draw_terrain();
}
}
}
add_string_to_buf("Delete PC: OK.");
kill_pc(univ.party[which],eMainStatus::ABSENT);
for(short i = which; i < 5; i++)
univ.party.swap_pcs(i, i + 1);
univ.party[5].main_status = eMainStatus::ABSENT;
set_stat_window(ITEM_WIN_PC1);
put_pc_screen();
}
void handle_death() {

View File

@@ -24,7 +24,7 @@ void do_save(short mode);
void increase_age();
void handle_hunting();
void switch_pc(short which);
void drop_pc(short which);
void drop_pc();
void handle_death();
void start_new_game(bool force = false);
location get_cur_direction(location the_point);

View File

@@ -689,19 +689,7 @@ void handle_menu_choice(eMenu item_hit) {
break;
case eMenu::OPTIONS_DELETE_PC:
if(!prime_time()) {
ASB("Finish what you're doing first.");
print_buf();
}
else {
choice = char_select_pc(1,"Delete who?");
if(choice < 6) {
std::string confirm = cChoiceDlog("delete-pc-confirm",{"yes","no"}).show();
if(confirm == "yes")
kill_pc(univ.party[choice],eMainStatus::ABSENT);
}
draw_terrain();
}
drop_pc();
break;