show skill levels for bash/pick selection, highlight best
This commit is contained in:
@@ -864,7 +864,7 @@ void handle_bash_pick(location destination, bool& did_something, bool& need_redr
|
||||
else if(!is_unlockable(destination))
|
||||
add_string_to_buf(" Wrong terrain type.");
|
||||
else {
|
||||
short pc = select_pc(eSelectPC::ONLY_LIVING, isBash ? "Who will bash?" : "Who will pick the lock?");
|
||||
short pc = select_pc(eSelectPC::ONLY_LIVING, isBash ? "Who will bash?" : "Who will pick the lock?", isBash ? eSkill::STRENGTH : eSkill::LOCKPICKING);
|
||||
if(pc == 6) {
|
||||
add_string_to_buf(" Cancelled.");
|
||||
overall_mode = MODE_TOWN;
|
||||
@@ -2149,7 +2149,7 @@ void debug_kill_party() {
|
||||
size_t choice = cStringChoice({"Dead", "Dust", "Stone"}, "Kill how?").show(-1);
|
||||
if(choice == -1) return;
|
||||
eMainStatus death_type = static_cast<eMainStatus>(static_cast<size_t>(eMainStatus::DEAD) + choice);
|
||||
short pc = select_pc(eSelectPC::ONLY_LIVING, "Kill who?", true);
|
||||
short pc = select_pc(eSelectPC::ONLY_LIVING, "Kill who?", eSkill::INVALID, true);
|
||||
if(pc == 6) return;
|
||||
for(int i = 0; i < 6; ++i){
|
||||
if(i == pc || (univ.party[i].is_alive() && pc == 7)) {
|
||||
@@ -2177,7 +2177,7 @@ void debug_hurt_party() {
|
||||
record_action("debug_hurt_party", "");
|
||||
}
|
||||
|
||||
short pc = select_pc(eSelectPC::ONLY_LIVING, "Hurt who?", true);
|
||||
short pc = select_pc(eSelectPC::ONLY_LIVING, "Hurt who?", eSkill::INVALID, true);
|
||||
if(pc == 6) return;
|
||||
for(int i = 0; i < 6; ++i){
|
||||
if(i == pc || (univ.party[i].is_alive() && pc == 7)) {
|
||||
@@ -2216,7 +2216,7 @@ void debug_give_status() {
|
||||
}
|
||||
}
|
||||
|
||||
short pc = select_pc(eSelectPC::ONLY_LIVING, "Give status to who?", true);
|
||||
short pc = select_pc(eSelectPC::ONLY_LIVING, "Give status to who?", eSkill::INVALID, true);
|
||||
if(pc == 6) return;
|
||||
for(int i = 0; i < 6; ++i){
|
||||
if(i == pc || (univ.party[i].is_alive() && pc == 7)) {
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "boe.monster.hpp"
|
||||
#include "boe.main.hpp"
|
||||
#include "mathutil.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "dialogxml/dialogs/strdlog.hpp"
|
||||
#include "dialogxml/dialogs/strchoice.hpp"
|
||||
#include "dialogxml/dialogs/3choice.hpp"
|
||||
@@ -28,6 +29,7 @@
|
||||
#include "tools/winutil.hpp"
|
||||
#include "tools/cursors.hpp"
|
||||
#include "fileio/resmgr/res_dialog.hpp"
|
||||
#include "gfx/render_shapes.hpp"
|
||||
|
||||
extern short which_combat_type;
|
||||
extern eGameMode overall_mode;
|
||||
@@ -920,7 +922,7 @@ static bool select_pc_event_filter (cDialog& me, std::string item_hit, eKeyMod)
|
||||
return true;
|
||||
}
|
||||
|
||||
short select_pc(eSelectPC mode, std::string title, bool allow_choose_all) {
|
||||
short select_pc(eSelectPC mode, std::string title, eSkill highlight_highest, bool allow_choose_all) {
|
||||
short item_hit;
|
||||
|
||||
set_cursor(sword_curs);
|
||||
@@ -933,6 +935,10 @@ short select_pc(eSelectPC mode, std::string title, bool allow_choose_all) {
|
||||
selectPc["title"].setText(title);
|
||||
|
||||
bool any_options = false;
|
||||
std::array<short, 6> pc_skills = {0, 0, 0, 0, 0, 0};
|
||||
short highest_skill = 0;
|
||||
short last_skill = 0;
|
||||
bool all_pcs_equal = true;
|
||||
for(short i = 0; i < 6; i++) {
|
||||
std::string n = boost::lexical_cast<std::string>(i + 1);
|
||||
bool can_pick = true;
|
||||
@@ -984,6 +990,9 @@ short select_pc(eSelectPC mode, std::string title, bool allow_choose_all) {
|
||||
break;
|
||||
}
|
||||
selectPc["pc" + n].setText(univ.party[i].name);
|
||||
if(highlight_highest != eSkill::INVALID){
|
||||
selectPc["pc" + n].appendText(" ({{skill}})");
|
||||
}
|
||||
if(!can_pick) {
|
||||
selectPc["pick" + n].hide();
|
||||
if(disabled_reason.empty())
|
||||
@@ -991,6 +1000,13 @@ short select_pc(eSelectPC mode, std::string title, bool allow_choose_all) {
|
||||
else
|
||||
selectPc["pc" + n].appendText(": " + disabled_reason);
|
||||
} else {
|
||||
if(highlight_highest != eSkill::INVALID){
|
||||
short skill = univ.party[i].skills[highlight_highest];
|
||||
pc_skills[i] = skill;
|
||||
if(skill > highest_skill) highest_skill = skill;
|
||||
if(skill != last_skill) all_pcs_equal = false;
|
||||
last_skill = skill;
|
||||
}
|
||||
any_options = true;
|
||||
}
|
||||
}
|
||||
@@ -999,6 +1015,20 @@ short select_pc(eSelectPC mode, std::string title, bool allow_choose_all) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
if(highlight_highest != eSkill::INVALID){
|
||||
selectPc["hint"].replaceText("{{skill}}", get_str("skills", (int)highlight_highest * 2 + 1));
|
||||
|
||||
for(int i = 0; i < 6; i++){
|
||||
std::string n = boost::lexical_cast<std::string>(i + 1);
|
||||
selectPc["pc" + n].replaceText("{{skill}}", std::to_string(pc_skills[i]));
|
||||
if(pc_skills[i] == highest_skill && !all_pcs_equal){
|
||||
selectPc["pc" + n].setColour(Colours::LIGHT_GREEN);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
selectPc["hint"].hide();
|
||||
}
|
||||
|
||||
if(!allow_choose_all){
|
||||
selectPc["pick-all"].hide();
|
||||
selectPc["all"].hide();
|
||||
|
@@ -55,4 +55,4 @@ enum class eSelectPC {
|
||||
};
|
||||
// Prompt the player to choose a party member. Returns 0-5 for a pc, 6 for cancel, 7 for all, or 8 if no PCs fit the mode's filter.
|
||||
// Pass a string poiner to no_choice_reason to get the reason why no choices were available, if none are.
|
||||
short select_pc(eSelectPC mode, std::string title="", bool allow_choose_all = false);
|
||||
short select_pc(eSelectPC mode, std::string title="", eSkill highlight_highest = eSkill::INVALID, bool allow_choose_all = false);
|
||||
|
@@ -481,10 +481,12 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,
|
||||
can_enter = false;
|
||||
if(choice == "leave")
|
||||
break;
|
||||
if((door_pc = select_pc(eSelectPC::ONLY_LIVING)) < 6) {
|
||||
if(choice == "pick")
|
||||
if(choice == "pick"){
|
||||
if((door_pc = select_pc(eSelectPC::ONLY_LIVING, "Who will pick the lock?", eSkill::LOCKPICKING)) < 6)
|
||||
pick_lock(where_check,door_pc);
|
||||
else bash_door(where_check,door_pc);
|
||||
}else{
|
||||
if((door_pc = select_pc(eSelectPC::ONLY_LIVING, "Who will bash?", eSkill::STRENGTH)) < 6)
|
||||
bash_door(where_check,door_pc);
|
||||
}
|
||||
break;
|
||||
case eTerSpec::WILDERNESS_CAVE:
|
||||
|
Reference in New Issue
Block a user