Fixes to traits dialog
- Now updates properly (thanks to Erdos for helping to track down the cause of this) - No longer crashes if the PC has a monster race
This commit is contained in:
@@ -1288,7 +1288,7 @@ static bool edit_party_event_filter(cDialog& me, std::string item_hit, eKeyMod)
|
||||
else pick_pc_name(which_pc,&me);
|
||||
put_party_stats(me);
|
||||
} else if(item_hit == "trait") {
|
||||
pick_race_abil(&univ.party[which_pc],0);
|
||||
pick_race_abil(&univ.party[which_pc],0,&me);
|
||||
put_party_stats(me);
|
||||
} else if(item_hit == "train") {
|
||||
spend_xp(which_pc,0,&me);
|
||||
|
||||
@@ -605,7 +605,7 @@ static bool give_pc_info_event_filter(cDialog& me, std::string item_hit, short&
|
||||
static bool give_pc_extra_info(cDialog& me, std::string item_hit, const short pc) {
|
||||
if(item_hit == "seemage") display_pc(pc,0,&me);
|
||||
else if(item_hit == "seepriest") display_pc(pc,1,&me);
|
||||
else if(item_hit == "trait") pick_race_abil(&univ.party[pc],1);
|
||||
else if(item_hit == "trait") pick_race_abil(&univ.party[pc],1,&me);
|
||||
else if(item_hit == "alch") display_alchemy(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ void put_spec_item_info (short which_i);
|
||||
void put_quest_info(short which_i);
|
||||
|
||||
// These are defined in pc.editors.cpp since they are also used by the character editor
|
||||
void pick_race_abil(cPlayer *pc,short mode);
|
||||
void pick_race_abil(cPlayer *pc,short mode,cDialog* parent = nullptr);
|
||||
void display_pc(short pc_num,short mode,cDialog* parent_num);
|
||||
void display_alchemy(bool allowEdit);
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ bool create_pc(short spot,cDialog* parent) {
|
||||
if(spot == 6) return false;
|
||||
univ.party.new_pc(spot);
|
||||
|
||||
pick_race_abil(&univ.party[spot],0);
|
||||
pick_race_abil(&univ.party[spot],0,parent);
|
||||
|
||||
still_ok = spend_xp(spot,0,parent);
|
||||
if(!still_ok)
|
||||
|
||||
@@ -126,8 +126,10 @@ void display_pc(short pc_num,short mode, cDialog* parent) {
|
||||
static void display_traits_graphics(cDialog& me) {
|
||||
short i,store;
|
||||
|
||||
std::string race = "race" + boost::lexical_cast<std::string>(int(store_pc->race) + 1);
|
||||
dynamic_cast<cLedGroup&>(me["race"]).setSelected(race);
|
||||
if(store_pc->race <= eRace::VAHNATAI) {
|
||||
std::string race = "race" + boost::lexical_cast<std::string>(int(store_pc->race) + 1);
|
||||
dynamic_cast<cLedGroup&>(me["race"]).setSelected(race);
|
||||
}
|
||||
for(i = 0; i < 10; i++) {
|
||||
std::string id = "good" + boost::lexical_cast<std::string>(i + 1);
|
||||
eTrait trait = eTrait(i);
|
||||
@@ -182,7 +184,7 @@ static bool pick_race_select_led(cDialog& me, std::string item_hit, bool, const
|
||||
}
|
||||
|
||||
//mode; // 0 - edit 1 - just display 2 - can't change race
|
||||
void pick_race_abil(cPlayer *pc,short mode) {
|
||||
void pick_race_abil(cPlayer *pc,short mode,cDialog* parent) {
|
||||
using namespace std::placeholders;
|
||||
static const char*const start_str1 = "Click on button by name for description.";
|
||||
static const char*const start_str2 = "Click on advantage button to add/remove.";
|
||||
@@ -190,7 +192,7 @@ void pick_race_abil(cPlayer *pc,short mode) {
|
||||
store_pc = pc;
|
||||
make_cursor_sword();
|
||||
|
||||
cDialog pickAbil("pick-race-abil");
|
||||
cDialog pickAbil("pick-race-abil",parent);
|
||||
pickAbil["done"].attachClickHandler(std::bind(&cDialog::toast, &pickAbil, true));
|
||||
auto led_selector = std::bind(pick_race_select_led, _1, _2, _3, mode);
|
||||
pickAbil.attachFocusHandlers(led_selector, {"race", "bad1", "bad2", "bad3", "bad4", "bad5", "bad6", "bad7"});
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
|
||||
class cDialog;
|
||||
|
||||
void give_gold(short amount,bool print_result);
|
||||
bool take_gold(short amount,bool print_result);
|
||||
void give_spec_items();
|
||||
void pick_race_abil(cPlayer *pc,short mode);
|
||||
void pick_race_abil(cPlayer *pc,short mode,cDialog* parent = nullptr);
|
||||
void reset_boats();
|
||||
void edit_stuff_done();
|
||||
|
||||
Reference in New Issue
Block a user