diff --git a/osx/BoE.xcodeproj/project.pbxproj b/osx/BoE.xcodeproj/project.pbxproj index fac99f08..8a48b635 100644 --- a/osx/BoE.xcodeproj/project.pbxproj +++ b/osx/BoE.xcodeproj/project.pbxproj @@ -349,21 +349,21 @@ 919DDC0E1900751C003E7FED /* freetype.framework in Copy Libraries and Frameworks */ = {isa = PBXBuildFile; fileRef = 919DDC091900750D003E7FED /* freetype.framework */; }; 919DDC0F1900751F003E7FED /* freetype.framework in Copy Libraries and Frameworks */ = {isa = PBXBuildFile; fileRef = 919DDC091900750D003E7FED /* freetype.framework */; }; 91A0B1601900FFE500EF438F /* mask.frag in Copy Shaders */ = {isa = PBXBuildFile; fileRef = 91A0B15A1900F73E00EF438F /* mask.frag */; }; - 91A32D160FDE049900C4E957 /* ticpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA270FB8C459001E34EA /* ticpp.cpp */; }; - 91A32D170FDE049900C4E957 /* tinystr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2E0FB8C459001E34EA /* tinystr.cpp */; }; - 91A32D180FDE049900C4E957 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2A0FB8C459001E34EA /* tinyxml.cpp */; }; - 91A32D190FDE049A00C4E957 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2C0FB8C459001E34EA /* tinyxmlerror.cpp */; }; - 91A32D1A0FDE049A00C4E957 /* tinyxmlparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2D0FB8C459001E34EA /* tinyxmlparser.cpp */; }; - 91A32D1B0FDE049F00C4E957 /* ticpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA270FB8C459001E34EA /* ticpp.cpp */; }; - 91A32D1C0FDE049F00C4E957 /* tinystr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2E0FB8C459001E34EA /* tinystr.cpp */; }; - 91A32D1D0FDE04A000C4E957 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2A0FB8C459001E34EA /* tinyxml.cpp */; }; - 91A32D1E0FDE04A000C4E957 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2C0FB8C459001E34EA /* tinyxmlerror.cpp */; }; - 91A32D1F0FDE04A100C4E957 /* tinyxmlparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2D0FB8C459001E34EA /* tinyxmlparser.cpp */; }; - 91A32D200FDE04A500C4E957 /* ticpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA270FB8C459001E34EA /* ticpp.cpp */; }; - 91A32D210FDE04A500C4E957 /* tinystr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2E0FB8C459001E34EA /* tinystr.cpp */; }; - 91A32D220FDE04A600C4E957 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2A0FB8C459001E34EA /* tinyxml.cpp */; }; - 91A32D230FDE04A600C4E957 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2C0FB8C459001E34EA /* tinyxmlerror.cpp */; }; - 91A32D240FDE04A600C4E957 /* tinyxmlparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2D0FB8C459001E34EA /* tinyxmlparser.cpp */; }; + 91A32D160FDE049900C4E957 /* ticpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA270FB8C459001E34EA /* ticpp.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D170FDE049900C4E957 /* tinystr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2E0FB8C459001E34EA /* tinystr.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D180FDE049900C4E957 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2A0FB8C459001E34EA /* tinyxml.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D190FDE049A00C4E957 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2C0FB8C459001E34EA /* tinyxmlerror.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D1A0FDE049A00C4E957 /* tinyxmlparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2D0FB8C459001E34EA /* tinyxmlparser.cpp */; settings = {COMPILER_FLAGS = "-Wno-error=parentheses -w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D1B0FDE049F00C4E957 /* ticpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA270FB8C459001E34EA /* ticpp.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D1C0FDE049F00C4E957 /* tinystr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2E0FB8C459001E34EA /* tinystr.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D1D0FDE04A000C4E957 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2A0FB8C459001E34EA /* tinyxml.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D1E0FDE04A000C4E957 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2C0FB8C459001E34EA /* tinyxmlerror.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D1F0FDE04A100C4E957 /* tinyxmlparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2D0FB8C459001E34EA /* tinyxmlparser.cpp */; settings = {COMPILER_FLAGS = "-Wno-error=parentheses -w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D200FDE04A500C4E957 /* ticpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA270FB8C459001E34EA /* ticpp.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D210FDE04A500C4E957 /* tinystr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2E0FB8C459001E34EA /* tinystr.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D220FDE04A600C4E957 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2A0FB8C459001E34EA /* tinyxml.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D230FDE04A600C4E957 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2C0FB8C459001E34EA /* tinyxmlerror.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91A32D240FDE04A600C4E957 /* tinyxmlparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA2D0FB8C459001E34EA /* tinyxmlparser.cpp */; settings = {COMPILER_FLAGS = "-Wno-error=parentheses -w -Xanalyzer -analyzer-disable-all-checks"; }; }; 91AC60800FA26A3B00EEAE67 /* regtown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91AC607F0FA26A3B00EEAE67 /* regtown.cpp */; }; 91AC60810FA26A3B00EEAE67 /* regtown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91AC607F0FA26A3B00EEAE67 /* regtown.cpp */; }; 91AC60820FA26A3B00EEAE67 /* regtown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91AC607F0FA26A3B00EEAE67 /* regtown.cpp */; }; @@ -410,9 +410,9 @@ 91BFA3D71901B18F001686E4 /* mask.vert in Copy Shaders */ = {isa = PBXBuildFile; fileRef = 91BFA3D61901B024001686E4 /* mask.vert */; }; 91BFA3DA1902B13D001686E4 /* tarball.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91BFA3D81902AD78001686E4 /* tarball.cpp */; }; 91BFA3DB1902B13F001686E4 /* tarball.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91BFA3D81902AD78001686E4 /* tarball.cpp */; }; - 91BFA3E919033E01001686E4 /* gzstream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91BFA3DE19033E01001686E4 /* gzstream.cpp */; }; - 91BFA3EA19033E01001686E4 /* gzstream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91BFA3DE19033E01001686E4 /* gzstream.cpp */; }; - 91BFA3EB19033E01001686E4 /* gzstream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91BFA3DE19033E01001686E4 /* gzstream.cpp */; }; + 91BFA3E919033E01001686E4 /* gzstream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91BFA3DE19033E01001686E4 /* gzstream.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91BFA3EA19033E01001686E4 /* gzstream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91BFA3DE19033E01001686E4 /* gzstream.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91BFA3EB19033E01001686E4 /* gzstream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91BFA3DE19033E01001686E4 /* gzstream.cpp */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; 91C1FCA60FCB6F7000EBAA65 /* button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA890FB8EC57001E34EA /* button.cpp */; }; 91C1FCA70FCB6F7100EBAA65 /* control.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA3C0FB8DA8E001E34EA /* control.cpp */; }; 91C1FCA80FCB6F7100EBAA65 /* dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 910BBA180FB8BECA001E34EA /* dialog.cpp */; }; @@ -2590,6 +2590,8 @@ "-Werror=format", "-ftemplate-backtrace-limit=0", "-Werror=return-type", + "-Werror=parentheses", + "-Werror=dangling-else", ); OTHER_LDFLAGS = ( "-lboost_filesystem", @@ -2643,6 +2645,8 @@ "-Werror=format", "-ftemplate-backtrace-limit=0", "-Werror=return-type", + "-Werror=parentheses", + "-Werror=dangling-else", ); OTHER_LDFLAGS = ( "-lboost_filesystem", diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index 5a5f0458..843a572c 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -351,7 +351,7 @@ bool handle_action(sf::Event event) if(the_point.in(bottom_buttons[i])) { button_hit = i; if (spell_forced == false) - main_button_click(overall_mode,bottom_buttons[i]); + main_button_click(bottom_buttons[i]); } break; @@ -363,7 +363,7 @@ bool handle_action(sf::Event event) if(the_point.in(town_buttons[i])) { button_hit = i; if (spell_forced == false) - main_button_click(overall_mode,town_buttons[i]); + main_button_click(town_buttons[i]); } break; @@ -376,7 +376,7 @@ bool handle_action(sf::Event event) if(the_point.in(combat_buttons[i])) { button_hit = i; if (spell_forced == false) - main_button_click(overall_mode,combat_buttons[i]); + main_button_click(combat_buttons[i]); } break; default: @@ -395,7 +395,7 @@ bool handle_action(sf::Event event) need_redraw = true; } if (overall_mode == MODE_OUTDOORS) { - cast_spell(button_hit,0); + cast_spell(button_hit); spell_forced = false; need_reprint = true; need_redraw = true; @@ -403,7 +403,7 @@ bool handle_action(sf::Event event) else if (overall_mode == MODE_TOWN) { for (i = 0; i < 6; i++) store_sp[i] = univ.party[i].cur_sp; - cast_spell(button_hit,1); + cast_spell(button_hit); spell_forced = false; need_reprint = true; need_redraw = true; @@ -684,7 +684,7 @@ bool handle_action(sf::Event event) destination = cur_loc; - if ((overall_mode == MODE_OUTDOORS) || (overall_mode == MODE_TOWN) || (overall_mode == MODE_COMBAT)) + if(overall_mode == MODE_OUTDOORS || overall_mode == MODE_TOWN || overall_mode == MODE_COMBAT) { if ((i == 4) & (j == 4)) { // Pausing if (overall_mode == MODE_COMBAT) { char_stand_ready(); @@ -812,6 +812,7 @@ bool handle_action(sf::Event event) } // MARK: End: Moving + } // MARK: Begin: Looking at something if ((overall_mode == MODE_LOOK_OUTDOORS) || (overall_mode == MODE_LOOK_TOWN) || (overall_mode == MODE_LOOK_COMBAT)) { @@ -841,7 +842,7 @@ bool handle_action(sf::Event event) if (destination == univ.town->sign_locs[k]) { need_reprint = true; if (adjacent(univ.town->sign_locs[k],univ.town.p_loc)==true) - do_sign(univ.town.num,k,(short) ter_looked_at,destination); + do_sign(univ.town.num,k,ter_looked_at); else add_string_to_buf(" Too far away to read sign. "); } k++; @@ -855,7 +856,7 @@ bool handle_action(sf::Event event) if (loc_in_sec == univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].sign_locs[k]) { need_reprint = true; if (adjacent(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].sign_locs[k],univ.party.loc_in_sec)==true) - do_sign((short) (200 + get_outdoor_num()),k,(short) ter_looked_at,destination); + do_sign((short) (200 + get_outdoor_num()),k,(short) ter_looked_at); else add_string_to_buf(" Too far away to read sign. "); } k++; @@ -1588,8 +1589,8 @@ bool handle_keystroke(sf::Event& event){ for (i = 0; i < 9; i++) if (chr2 == talk_chars[i] && (!talk_end_forced || i == 6 || i == 5)) { int j = talk_end_forced ? i - 5 : i; - pass_point.x = talk_words[i].rect.left + 9 + ul.x; - pass_point.y = talk_words[i].rect.top + 9 + ul.y; + pass_point.x = talk_words[j].rect.left + 9 + ul.x; + pass_point.y = talk_words[j].rect.top + 9 + ul.y; pass_event.mouseButton.x = pass_point.x; pass_event.mouseButton.y = pass_point.y; are_done = handle_action(pass_event); @@ -1909,13 +1910,13 @@ bool handle_keystroke(sf::Event& event){ case 'S': // TODO: Create a dedicated dialog for this. if (!in_scen_debug) break; cStrDlog("Enter Stuff Done Flag Part A (between 1 and 299)","","Which SDFa ?",130,PIC_DLOG).show(); - i = atoi(get_text_response(873,0).c_str()); + i = atoi(get_text_response().c_str()); if(i > 0 && i < 300){ cStrDlog("Enter Stuff Done Flag Part B (between 0 and 49)","","Which SDFb ?",130,PIC_DLOG).show(); - j = atoi(get_text_response(873,0).c_str()); + j = atoi(get_text_response().c_str()); if(j >= 0 && j < 50){ cStrDlog("Enter Stuff Done Flag Value (up to 255)","","Which value ?",130,PIC_DLOG).show(); - int x = atoi(get_text_response(873,0).c_str()); + int x = atoi(get_text_response().c_str()); if(x < 256 && x >= 0) PSD[i][j] = x; else if(x == -1){ @@ -1927,12 +1928,9 @@ bool handle_keystroke(sf::Event& event){ break; case 'T': - // TODO: Create a dedicated dialog for this? if(!in_scen_debug) break; short find_direction_from; - sout << "Enter Town Number (between 0 and " << scenario.num_towns - 1 << ')'; - cStrDlog(sout.str(),"","Which Town ?",130,PIC_DLOG).show(); - i = atoi(get_text_response(873,0).c_str()); + i = atoi(get_text_response(sout.str(), 130).c_str()); if(i >= 0 && i < scenario.num_towns ){ if (univ.party.direction == 0) find_direction_from = 2; else if (univ.party.direction == 4) find_direction_from = 0; @@ -2531,7 +2529,7 @@ void start_new_game() else init_party(0); //while (creation_done == false) { - edit_party(1,0); + edit_party(); /* if ((i > 0) || (in_startup_mode == false)) creation_done = true; if ((i == 0) && (in_startup_mode == false)) diff --git a/osx/boe.appleevents.mm b/osx/boe.appleevents.mm index 2764c3da..395f8f32 100644 --- a/osx/boe.appleevents.mm +++ b/osx/boe.appleevents.mm @@ -30,6 +30,7 @@ typedef NSAppleEventDescriptor AEDescr; -(void)handleQuit:(AEDescr*)theAppleEvent withReply: (AEDescr*)reply; @end +void set_up_apple_events(); // Suppress "no prototype" warning void set_up_apple_events() { AppleEventHandler* aeHandler = [[AppleEventHandler alloc] init]; NSAppleEventManager* AEmgr = [NSAppleEventManager sharedAppleEventManager]; @@ -44,10 +45,14 @@ void set_up_apple_events() { // TODO: Not sure, do I need to do anything with the reply event? @implementation AppleEventHandler -(void)handleOpenApp:(AEDescr*)theAppleEvent withReply: (AEDescr*)reply { + (void) theAppleEvent; // Suppress "unused parameter" warning + (void) reply; app_started_normally = true; } -(void)handleOpenDoc:(AEDescr*)theAppleEvent withReply: (AEDescr*)reply { + (void) theAppleEvent; // Suppress "unused parameter" warning + (void) reply; NSAppleEventDescriptor* docList = [theAppleEvent paramDescriptorForKeyword: keyDirectObject]; if(docList == nil) return; @@ -83,6 +88,8 @@ void set_up_apple_events() { } -(void)handleQuit:(AEDescr*)theAppleEvent withReply: (AEDescr*)reply { + (void) theAppleEvent; // Suppress "unused parameter" warning + (void) reply; if(overall_mode == MODE_STARTUP) { All_Done = true; return; diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index 1d1696a6..861c322d 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -588,10 +588,11 @@ void pc_attack(short who_att,short target)//// for (i = 0; i < 24; i++) if (((univ.party[who_att].items[i].variety == eItemType::ONE_HANDED) || (univ.party[who_att].items[i].variety == eItemType::TWO_HANDED)) && - (univ.party[who_att].equip[i] == true)) + univ.party[who_att].equip[i]) { if (weap1 == 24) weap1 = i; else weap2 = i; + } hit_adj = (-5 * minmax(-8,8,univ.party[who_att].status[eStatus::BLESS_CURSE])) + 5 * minmax(-8,8,which_m->status[eStatus::BLESS_CURSE]) - stat_adj(who_att,1) * 5 + (get_encumberance(who_att)) * 5; @@ -1005,38 +1006,38 @@ void do_combat_cast(location target)//// switch (spell_being_cast) { case 8: case 28: case 65: // web spells - place_spell_pattern(current_pat,target,1,false,current_pc); + place_spell_pattern(current_pat,target,1,current_pc); break; case 5: case 17: // fire wall spells - place_spell_pattern(current_pat,target,5,false,current_pc); + place_spell_pattern(current_pat,target,5,current_pc); break; case 15: case 66: // stink cloud - place_spell_pattern(current_pat,target,7,false,current_pc); + place_spell_pattern(current_pat,target,7,current_pc); break; case 25: case 44: case 126: // force walls - place_spell_pattern(current_pat,target,4,false,current_pc); + place_spell_pattern(current_pat,target,4,current_pc); break; case 37: case 64: // ice walls - place_spell_pattern(current_pat,target,8,false,current_pc); + place_spell_pattern(current_pat,target,8,current_pc); break; case 51: // antimagic - place_spell_pattern(current_pat,target,6,false,current_pc); + place_spell_pattern(current_pat,target,6,current_pc); break; case 19: case 67: // sleep clouds - place_spell_pattern(current_pat,target,12,false,current_pc); + place_spell_pattern(current_pat,target,12,current_pc); break; case 60: make_quickfire(target.x,target.y); break; case 45: // spray fields r1 = get_ran(1,0,14); - place_spell_pattern(current_pat,target,spray_type_array[r1],false,current_pc); + place_spell_pattern(current_pat,target,spray_type_array[r1],current_pc); break; case 159: // wall of blades - place_spell_pattern(current_pat,target,9,false,current_pc); + place_spell_pattern(current_pat,target,9,current_pc); break; case 145: case 119: case 18: // wall dispelling - place_spell_pattern(current_pat,target,11,false,current_pc); + place_spell_pattern(current_pat,target,11,current_pc); break; case 42: // Fire barrier play_sound(68); @@ -1065,7 +1066,7 @@ void do_combat_cast(location target)//// add_missile(target,9,1,0,0); store_sound = 11; r1 = min(18,(level * 7) / 10 + 2 * bonus); - place_spell_pattern(rad2,target,130 + r1,true,current_pc); + place_spell_pattern(rad2,target,130 + r1,current_pc); ashes_loc = target; break; @@ -1110,7 +1111,7 @@ void do_combat_cast(location target)//// r1 = (r1 * 14) / 10; else if (r1 > 10) r1 = (r1 * 8) / 10; if (r1 <= 0) r1 = 1; - place_spell_pattern(square,target,50 + r1,true,current_pc); + place_spell_pattern(square,target,50 + r1,current_pc); ashes_loc = target; break; case 40: @@ -1120,7 +1121,7 @@ void do_combat_cast(location target)//// r1 = min(12,1 + (level * 2) / 3 + bonus) + 2; if (r1 > 20) r1 = (r1 * 8) / 10; - place_spell_pattern(rad2,target,50 + r1,true,current_pc); + place_spell_pattern(rad2,target,50 + r1,current_pc); ashes_loc = target; break; case 48: // kill @@ -1525,8 +1526,7 @@ void fire_missile(location target) { //start_missile_anim(); //add_missile(target,2,1, 0, 0); //do_missile_anim(100,pc_pos[missile_firer], 5); - place_spell_pattern(rad2,target, - 50 + univ.party[missile_firer].items[ammo_inv_slot].ability_strength * 2,true,missile_firer); + place_spell_pattern(rad2,target, 50 + univ.party[missile_firer].items[ammo_inv_slot].ability_strength * 2,missile_firer); do_explosion_anim(5,0); //end_missile_anim(); handle_marked_damage(); @@ -2143,17 +2143,17 @@ void do_monster_turn() // Place fields for monsters that create them. Only done when monst sees foe if ((target != 6) && (can_see_light(cur_monst->cur_loc,targ_space,sight_obscurity) < 5)) { //// if ((cur_monst->radiate_1 == 1) && (get_ran(1,1,100) < cur_monst->radiate_2)) - place_spell_pattern(square,cur_monst->cur_loc,5,false,7); + place_spell_pattern(square,cur_monst->cur_loc,5,7); if ((cur_monst->radiate_1 == 2) && (get_ran(1,1,100) < cur_monst->radiate_2)) - place_spell_pattern(square,cur_monst->cur_loc,8,false,7); + place_spell_pattern(square,cur_monst->cur_loc,8,7); if ((cur_monst->radiate_1 == 3) && (get_ran(1,1,100) < cur_monst->radiate_2)) - place_spell_pattern(square,cur_monst->cur_loc,4,false,7); + place_spell_pattern(square,cur_monst->cur_loc,4,7); if ((cur_monst->radiate_1 == 4) && (get_ran(1,1,100) < cur_monst->radiate_2)) - place_spell_pattern(square,cur_monst->cur_loc,6,false,7); + place_spell_pattern(square,cur_monst->cur_loc,6,7); if ((cur_monst->radiate_1 == 5) && (get_ran(1,1,100) < cur_monst->radiate_2)) - place_spell_pattern(square,cur_monst->cur_loc,12,false,7); + place_spell_pattern(square,cur_monst->cur_loc,12,7); if ((cur_monst->radiate_1 == 6) && (get_ran(1,1,100) < cur_monst->radiate_2)) - place_spell_pattern(square,cur_monst->cur_loc,7,false,7); + place_spell_pattern(square,cur_monst->cur_loc,7,7); if ((cur_monst->radiate_1 == 10) && (get_ran(1,1,100) < 5)){ if (summon_monster(cur_monst->radiate_2, cur_monst->cur_loc,130,cur_monst->attitude) == true) @@ -2623,7 +2623,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor ASB("Creature breathes."); run_a_missile(source,targ_space,0,0,44, 0,0,100); - place_spell_pattern(rad2,targ_space,12,false,7); + place_spell_pattern(rad2,targ_space,12,7); } else if (level == 14) { // vapors //play_sound(44); @@ -3015,7 +3015,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// break; case 4: // flame cloud run_a_missile(l,vict_loc,2,1,11,0,0,80); - place_spell_pattern(single,vict_loc,5,false,7); + place_spell_pattern(single,vict_loc,5,7); break; case 5: // flame run_a_missile(l,vict_loc,2,1,11,0,0,80); @@ -3043,7 +3043,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// break; case 9: // scloud run_a_missile(l,target,0,0,25,0,0,80); - place_spell_pattern(square,target,7,false,7); + place_spell_pattern(square,target,7,7); break; case 10: // summon beast r1 = get_summon_monster(1); @@ -3058,14 +3058,14 @@ bool monst_cast_mage(cCreature *caster,short targ)//// break; case 11: // conflagration run_a_missile(l,target,13,1,25,0,0,80); - place_spell_pattern(rad2,target,5,false,7); + place_spell_pattern(rad2,target,5,7); break; case 12: // fireball r1 = 1 + (caster->level * 3) / 4; if (r1 > 29) r1 = 29; run_a_missile(l,target,2,1,11,0,0,80); start_missile_anim(); - place_spell_pattern(square,target,50 + r1,true,7); + place_spell_pattern(square,target,50 + r1,7); ashes_loc = target; break; case 13: case 20: case 26:// summon @@ -3100,7 +3100,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// break; case 14: // web play_sound(25); - place_spell_pattern(rad2,target,1,false,7); + place_spell_pattern(rad2,target,1,7); break; case 15: // poison run_a_missile(l,vict_loc,11,0,25,0,0,80); @@ -3145,7 +3145,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// r1 = 1 + (caster->level * 3) / 4 + 3; if (r1 > 29) r1 = 29; start_missile_anim(); - place_spell_pattern(rad2,target,50 + r1,true,7); + place_spell_pattern(rad2,target,50 + r1,7); ashes_loc = target; break; @@ -3154,7 +3154,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// case 21: // shockstorm run_a_missile(l,target,6,1,11,0,0,80); - place_spell_pattern(rad2,target,4,false,7); + place_spell_pattern(rad2,target,4,7); break; case 22: // m. poison run_a_missile(l,vict_loc,11,1,11,0,0,80); @@ -3311,11 +3311,11 @@ bool monst_cast_priest(cCreature *caster,short targ) break; case 4: // stumble play_sound(24); - place_spell_pattern(single,vict_loc,1,false,7); + place_spell_pattern(single,vict_loc,1,7); break; case 1: case 5: // Blesses play_sound(24); - caster->status[eStatus::BLESS_CURSE] = min(8,caster->status[eStatus::BLESS_CURSE] + (spell == 1) ? 3 : 5); + caster->status[eStatus::BLESS_CURSE] = min(8,caster->status[eStatus::BLESS_CURSE] + ((spell == 1) ? 3 : 5)); play_sound(4); break; case 6: // curse @@ -3450,7 +3450,7 @@ bool monst_cast_priest(cCreature *caster,short targ) run_a_missile(l,target,2,0,11,0,0,80); r1 = 2 + caster->level / 2 + 2; start_missile_anim(); - place_spell_pattern(square,target,50 + r1,true,7); + place_spell_pattern(square,target,50 + r1,7); ashes_loc = target; break; @@ -3486,7 +3486,7 @@ bool monst_cast_priest(cCreature *caster,short targ) r1 = (caster->level * 3) / 4 + 5; if (r1 > 29) r1 = 29; start_missile_anim(); - place_spell_pattern(rad2,target,130 + r1,true,7 ); + place_spell_pattern(rad2,target,130 + r1,7 ); ashes_loc = target; break; } @@ -3608,10 +3608,10 @@ bool monst_near(short m_num,location where,short radius,short active) void fireball_space(location loc,short dam) { - place_spell_pattern(square,loc,50 + dam,false,7); + place_spell_pattern(square,loc,50 + dam,7); } -void place_spell_pattern(effect_pat_type pat,location center,short type,bool prep_for_anim,short who_hit) +void place_spell_pattern(effect_pat_type pat,location center,short type,short who_hit) //type; // 0 - take codes in pattern, OW make all nonzero this type // Types 0 - Null 1 - web 2 - fire barrier 3 - force barrier 4 - force wall 5 - fire wall // 6 - anti-magic field 7 - stink cloud 8 - ice wall 9 - blade wall 10 - quickfire @@ -3791,11 +3791,12 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre } void handle_item_spell(location loc,short num) { -// switch (num) { -// case 82: // Pyhrrus -// place_spell_pattern(rad2,loc,9,false,6); -// break; -// } + // TODO: This function is currently unused + switch (num) { + case 82: // Pyhrrus + place_spell_pattern(rad2,loc,9,6); + break; + } } @@ -4124,7 +4125,7 @@ bool combat_cast_mage_spell() if (spell_forced == false) - spell_num = pick_spell(current_pc,0,2); + spell_num = pick_spell(current_pc,0); else { if (repeat_cast_ok(0) == false) return false; @@ -4320,7 +4321,7 @@ bool combat_cast_priest_spell() return false; } if (spell_forced == false) - spell_num = pick_spell(current_pc,1,2); + spell_num = pick_spell(current_pc,1); else { if (repeat_cast_ok(1) == false) return false; @@ -4432,7 +4433,7 @@ bool combat_cast_priest_spell() univ.party[current_pc].cur_sp -= s_cost[1][spell_num]; play_sound(24); add_string_to_buf(" Protective field created."); - place_spell_pattern(protect_pat,pc_pos[current_pc],0,false,6); + place_spell_pattern(protect_pat,pc_pos[current_pc],0,6); break; } } diff --git a/osx/boe.combat.h b/osx/boe.combat.h index e13b1d4c..ba2dad6c 100644 --- a/osx/boe.combat.h +++ b/osx/boe.combat.h @@ -26,7 +26,7 @@ short count_levels(location where,short radius); bool pc_near(short pc_num,location where,short radius); bool monst_near(short m_num,location where,short radius,short active); void fireball_space(location loc,short dam); -void place_spell_pattern(effect_pat_type pat,location center,short type,bool prep_for_anim,short who_hit); +void place_spell_pattern(effect_pat_type pat,location center,short type,short who_hit); void handle_item_spell(location loc,short num); void modify_pattern(effect_pat_type *pat,short type); void do_shockwave(location target); diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index 7ad880d9..ad656b16 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -160,7 +160,7 @@ void start_shop_mode(short shop_type,short shop_min,short shop_max,short cost_ad give_help(26,27); } -void update_last_talk(int new_node) { +static void update_last_talk(int new_node) { // Store last node in the Go Back button for(word_rect_t& word : talk_words) { if(word.word != "Go Back") continue; @@ -578,7 +578,7 @@ void end_talk_mode() void handle_talk_event(location p) { - short i,j,get_pc,s1 = -1,s2 = -1,s3 = -1; + short i,get_pc,s1 = -1,s2 = -1,s3 = -1; char asked[4]; std::string place_string1, place_string2; @@ -676,7 +676,7 @@ void handle_talk_event(location p) case TALK_BACK: // only if there's nothing to go back to return; // so, there's nothing to do here case TALK_ASK: // ask about - place_string1 = get_text_response(1017,0); + place_string1 = get_text_response("Ask about what?", 8); strncpy(asked, place_string1.c_str(), 4); if(strncmp(asked, "name", 4) == 0) goto SPECIAL_NAME; if(strncmp(asked, "look", 4) == 0) goto SPECIAL_LOOK; @@ -993,13 +993,14 @@ void store_responses() } -void do_sign(short town_num, short which_sign, short sign_type,location sign_loc) +void do_sign(short town_num, short which_sign, short sign_type) //town_num; // Will be 0 - 200 for town, 200 - 290 for outdoors //short sign_type; // terrain type { char sign_text[256]; location view_loc; + // TODO: Why is this line here? The location isn't used anywhere. view_loc = (is_out()) ? univ.party.p_loc : univ.town.p_loc; make_cursor_sword(); @@ -1077,7 +1078,7 @@ void save_prefs(bool resetHelp){ } } -static bool prefs_event_filter (cDialog& me, std::string id, eKeyMod mods) +static bool prefs_event_filter (cDialog& me, std::string id, eKeyMod) { // TODO: I should no longer need done_yet as this now only handles the okay and cancel buttons; the LEDs are now handled automatically by the cLed class (and the cLedGroup class, for LED groups). bool done_yet = false,did_cancel = false,reset_help = false; @@ -1232,7 +1233,7 @@ static void put_party_stats(cDialog& me) draw_startup(0); } -static bool edit_party_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) +static bool edit_party_event_filter(cDialog& me, std::string item_hit, eKeyMod) { if(item_hit == "done") { me.toast(); @@ -1252,7 +1253,7 @@ static bool edit_party_event_filter(cDialog& me, std::string item_hit, eKeyMod m else pick_pc_name(which_pc,&me); put_party_stats(me); } else if(item_hit == "trait") { - pick_race_abil(&univ.party[which_pc],0,&me); + pick_race_abil(&univ.party[which_pc],0); put_party_stats(me); } else if(item_hit == "train") { spend_xp(which_pc,0,&me); @@ -1283,7 +1284,7 @@ static bool edit_party_event_filter(cDialog& me, std::string item_hit, eKeyMod m } extern bool pc_gworld_loaded; -void edit_party(short can_create,short can_cancel) +void edit_party() { bool munch_pc_graphic = false; @@ -1322,7 +1323,7 @@ void edit_party(short can_create,short can_cancel) } -static bool tip_of_day_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) +static bool tip_of_day_event_filter(cDialog& me, std::string item_hit, eKeyMod) { std::string place_str; @@ -1396,7 +1397,7 @@ static void put_scen_info(cDialog& me) } } -static static bool pick_a_scen_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) +static static bool pick_a_scen_event_filter(cDialog& me, std::string item_hit, eKeyMod) { if(item_hit == "cancel") { me.setResult(-1); diff --git a/osx/boe.dlgutil.h b/osx/boe.dlgutil.h index 6c9d7163..a9cde06d 100644 --- a/osx/boe.dlgutil.h +++ b/osx/boe.dlgutil.h @@ -12,10 +12,10 @@ void end_talk_mode(); void handle_talk_event(location p); void handle_talk_spec(short ttype,char* place_string1,char* place_string2); void store_responses(); -void do_sign(short town_num, short which_sign, short sign_type,location sign_loc); +void do_sign(short town_num, short which_sign, short sign_type); void do_talk(short personality, unsigned short m_num); void put_party_stats(); -void edit_party(short can_create,short can_cancel); +void edit_party(); void pick_preferences() ; //void check_pref_file() ; //long open_pref_file(); diff --git a/osx/boe.fileio.cpp b/osx/boe.fileio.cpp index 4f7a1f0b..25c0c674 100644 --- a/osx/boe.fileio.cpp +++ b/osx/boe.fileio.cpp @@ -189,7 +189,7 @@ void finish_load_party(){ force_barrier = true; if (univ.town.is_quickfire(j,k) == true) quickfire = true; - if ((scenario.ter_types[univ.town->terrain(j,k)].special == TER_SPEC_CONVEYOR)) + if(scenario.ter_types[univ.town->terrain(j,k)].special == TER_SPEC_CONVEYOR) belt_present = true; } force_wall = true; diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index 8e6fadfa..e8d9574f 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -474,7 +474,7 @@ void draw_start_button(short which_position,short which_button) win_draw_string(mainPtr,to_rect,button_labels[which_position],eTextMode::CENTRE,style,ul); } -void main_button_click(short mode,RECT button_rect) +void main_button_click(RECT button_rect) { button_rect.offset(ul); mainPtr.setActive(); @@ -699,7 +699,7 @@ void draw_text_bar(short mode) remember_tiny_text = 500; if (is_out()) { for (i = 0; i < 8; i++) - if (loc.in(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].info_rect[i])) + if(loc.in(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].info_rect[i])) { if ((remember_tiny_text == i) && (mode == 0)) return; else { @@ -707,6 +707,7 @@ void draw_text_bar(short mode) remember_tiny_text = i; return; } + } // TODO: I'm pretty sure this brace location is correct, but must verify it if (remember_tiny_text != 50 + univ.party.i_w_c.x + univ.party.i_w_c.y) { put_text_bar((char *) univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].out_strs(0)); remember_tiny_text = 50 + univ.party.i_w_c.x + univ.party.i_w_c.y; @@ -714,7 +715,7 @@ void draw_text_bar(short mode) } if (is_town()) { for (i = 0; i < 16; i++) - if (loc.in(univ.town->room_rect(i))) + if(loc.in(univ.town->room_rect(i))) { if ((remember_tiny_text == 200 + i) && (mode == 0)) return; else { @@ -722,6 +723,7 @@ void draw_text_bar(short mode) remember_tiny_text = 200 + i; return; } + } // TODO: I'm pretty sure this brace location is correct, but must verify it if (remember_tiny_text != 250) { put_text_bar((char *) univ.town->town_name); //// remember_tiny_text = 250; @@ -1026,7 +1028,7 @@ void draw_terrain(short mode) if ((overall_mode < MODE_COMBAT) || (overall_mode == MODE_LOOK_OUTDOORS) || ((overall_mode == MODE_LOOK_TOWN) && (point_onscreen(univ.town.p_loc,center) == true)) || (overall_mode == MODE_RESTING)) - draw_party_symbol(mode,center); + draw_party_symbol(center); else if (overall_mode != MODE_LOOK_TOWN) draw_pcs(center,0); @@ -1300,7 +1302,7 @@ bool extend_road_terrain(ter_num_t ter) return false; } -bool can_build_roads_on(ter_num_t ter) { +static bool can_build_roads_on(ter_num_t ter) { if(impassable(ter)) return false; if(scenario.ter_types[ter].special == TER_SPEC_BRIDGE) return false; return true; diff --git a/osx/boe.graphics.h b/osx/boe.graphics.h index b295cf2d..1422acad 100644 --- a/osx/boe.graphics.h +++ b/osx/boe.graphics.h @@ -23,7 +23,7 @@ void draw_startup(short but_type); void draw_anim(); void place_anim(); void draw_start_button(short which_position,short which_button); -void main_button_click(short mode,RECT button_rect); +void main_button_click(RECT button_rect); void arrow_button_click(RECT button_rect); void end_startup(); void Set_up_win (); diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index cde968c3..347e6b8a 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -542,13 +542,10 @@ void draw_fields(location where){ Draw_Some_Item(fields_gworld,calc_rect(2,0),terrain_screen_gworld,where_draw,1,0); } -void draw_party_symbol(short mode,location center) -// mode currently unused -{ +void draw_party_symbol(location center) { RECT source_rect; location target(4,4); short i = 0; - short dir_array[8] = {0,3,3,3,2,1,1,1}; if (can_draw_pcs == false) return; diff --git a/osx/boe.graphutil.h b/osx/boe.graphutil.h index 4dbfaa1a..bfd5daa3 100644 --- a/osx/boe.graphutil.h +++ b/osx/boe.graphutil.h @@ -4,7 +4,7 @@ void play_see_monster_str(unsigned short m); void draw_pcs(location center,short mode); void draw_outd_boats(location center); void draw_town_boat(location center) ; -void draw_party_symbol(short mode,location center); +void draw_party_symbol(location center); RECT get_monster_rect (pic_num_t type_wanted,short mode) ; RECT get_monster_template_rect (pic_num_t type_wanted,short mode,short which_part) ; RECT get_item_template_rect (short type_wanted); diff --git a/osx/boe.infodlg.cpp b/osx/boe.infodlg.cpp index 6f8528a4..379c32fc 100644 --- a/osx/boe.infodlg.cpp +++ b/osx/boe.infodlg.cpp @@ -28,9 +28,6 @@ #include "prefs.hpp" short mage_spell_pos = 0,priest_spell_pos = 0,skill_pos = 0; -cCreature *store_m; -short store_trait_mode,store_item_pc,store_pc_num; -cItemRec store_i; extern short spell_w_cast[2][62]; extern short spell_level[62]; @@ -70,9 +67,8 @@ short store_str2b; short store_page_on,store_num_i; // Misc dialog vars -short store_displayed_item,position,num_entries; +short position,num_entries; unsigned short cur_entry; -cCreature hold_m; static void put_spell_info(cDialog& me, short display_mode) { @@ -101,8 +97,7 @@ static void put_spell_info(cDialog& me, short display_mode) } -static bool display_spells_event_filter(cDialog& me, std::string item_hit, eKeyMod mods, short display_mode) -{ +static bool display_spells_event_filter(cDialog& me, std::string item_hit, short display_mode) { short store; if(item_hit == "done") { me.toast(); @@ -135,7 +130,7 @@ void display_spells(short mode,short force_spell,cDialog* parent) make_cursor_sword(); cDialog spellInfo("spell-info.xml", parent); - spellInfo.attachClickHandlers(std::bind(display_spells_event_filter,_1,_2,_3,mode), {"done","left","right"}); + spellInfo.attachClickHandlers(std::bind(display_spells_event_filter,_1,_2,mode), {"done","left","right"}); dynamic_cast(spellInfo["icon"]).setPict(14 + mode); put_spell_info(spellInfo, mode); @@ -166,8 +161,7 @@ static void put_skill_info(cDialog& me) } -static bool display_skills_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool display_skills_event_filter(cDialog& me, std::string item_hit, eKeyMod) { if(item_hit == "done") { me.toast(); } else { @@ -199,13 +193,9 @@ void display_skills(short force_skill,cDialog* parent) skillDlog.run(); } -static void put_item_info(cDialog& me,short pc,short item)//// -{ +static void put_item_info(cDialog& me,const cItemRec& s_i) { char store_text[256]; std::string desc_str; - cItemRec s_i; - - s_i = store_i; cPict& pic = dynamic_cast(me["pic"]); if (s_i.graphic_num >= 1000) // was 150 @@ -214,11 +204,11 @@ static void put_item_info(cDialog& me,short pc,short item)//// // id? magic? cLed& id = dynamic_cast(me["id"]); - if (store_i.magic && store_i.ident) + if(s_i.magic && s_i.ident) id.setState(led_red); else id.setState(led_off); cLed& magic = dynamic_cast(me["magic"]); - if (store_i.ident) + if(s_i.ident) magic.setState(led_red); else magic.setState(led_off); me["type"].setText(get_str("item-types-display", (int)s_i.variety)); @@ -316,12 +306,7 @@ static void put_item_info(cDialog& me,short pc,short item)//// } -static bool display_pc_item_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ - short item,pc_num; - - item = store_displayed_item; - pc_num = store_item_pc; +static bool display_pc_item_event_filter(cDialog& me, std::string item_hit, cItemRec& store_i, short& item, const short pc_num) { if(item_hit == "done") { me.toast(); @@ -329,34 +314,32 @@ static bool display_pc_item_event_filter(cDialog& me, std::string item_hit, eKey do { item = (item == 0) ? 23 : item - 1; } while (univ.party[pc_num].items[item].variety == eItemType::NO_ITEM); - store_displayed_item = item; store_i = univ.party[pc_num].items[item]; - put_item_info(me,pc_num,item); + put_item_info(me,item); } else if(item_hit == "right") { do { item = (item == 23) ? 0 : item + 1; } while (univ.party[pc_num].items[item].variety == eItemType::NO_ITEM); - store_displayed_item = item; store_i = univ.party[pc_num].items[item]; - put_item_info(me,pc_num,item); + put_item_info(me,item); } return true; } void display_pc_item(short pc_num,short item,cItemRec si,cDialog* parent) { - store_item_pc = pc_num; + using namespace std::placeholders; + cItemRec store_i; if (pc_num == 6) store_i = si; else store_i = univ.party[pc_num].items[item]; - store_displayed_item = item; make_cursor_sword(); cDialog itemInfo("item-info.xml",parent); // By attaching the click handler to "id" and "magic", we suppress normal LED behaviour - itemInfo.attachClickHandlers(display_pc_item_event_filter, {"done","left","right","id","magic"}); + itemInfo.attachClickHandlers(std::bind(display_pc_item_event_filter, _1, _2, std::ref(store_i), std::ref(item), pc_num), {"done","left","right","id","magic"}); - if (store_item_pc >= 6) { + if(pc_num >= 6) { itemInfo["left"].hide(); itemInfo["right"].hide(); } @@ -376,26 +359,26 @@ void display_pc_item(short pc_num,short item,cItemRec si,cDialog* parent) itemInfo["desc"].hide(); - put_item_info(itemInfo,pc_num,item); + put_item_info(itemInfo,si); itemInfo.run(); } -static void put_monst_info(cDialog& me) +static void put_monst_info(cDialog& me, const cCreature& store_m) { std::string store_text; std::string str; short abil,i; cPict& pic = dynamic_cast(me["pic"]); - if ( store_m->spec_skill == MONSTER_INVISIBLE) + if(store_m.spec_skill == MONSTER_INVISIBLE) pic.setPict(400,PIC_MONST);// TODO: should probably be PICT_BLANK? - else if (store_m->picture_num < 1000) - pic.setPict(store_m->picture_num,PIC_MONST); + else if(store_m.picture_num < 1000) + pic.setPict(store_m.picture_num,PIC_MONST); else { ePicType type_g = PIC_CUSTOM_MONST; - short size_g = store_m->picture_num / 1000; + short size_g = store_m.picture_num / 1000; switch(size_g){ case 2: type_g += PIC_WIDE; @@ -408,47 +391,47 @@ static void put_monst_info(cDialog& me) type_g += PIC_TALL; break; } - pic.setPict(store_m->picture_num % 1000, type_g); + pic.setPict(store_m.picture_num % 1000, type_g); } - store_text = get_m_name(store_m->number); + store_text = get_m_name(store_m.number); me["name"].setText(store_text); // TODO: More descriptive ability descriptions, taking into account potential variation - abil = store_m->spec_skill; + abil = store_m.spec_skill; str = get_str("monster-abilities",abil + 1); me["abil1"].setText(str); - str = get_str("monster-abilities",store_m->radiate_1 + 50); + str = get_str("monster-abilities",store_m.radiate_1 + 50); me["abil2"].setText(str); for(i = 0; i < 3; i++) { - if (store_m->a[i] > 0) { - if(store_m->a[i].sides == 0) continue; + if(store_m.a[i] > 0) { + if(store_m.a[i].sides == 0) continue; std::ostringstream sout(std::ios_base::ate); - sout << store_m->a[i]; + sout << store_m.a[i]; store_text = sout.str(); sout.str("attack"); sout << i + 1; me[sout.str()].setText(store_text); } } - me["lvl"].setTextToNum(store_m->level); - me["hp"].setTextToNum(store_m->health); - me["sp"].setTextToNum(store_m->mp); - me["def"].setTextToNum(store_m->armor); - me["skill"].setTextToNum(store_m->skill); - me["morale"].setTextToNum(store_m->morale); - me["ap"].setTextToNum(store_m->speed); - me["mage"].setTextToNum(store_m->mu); - me["priest"].setTextToNum(store_m->cl); - me["poison"].setTextToNum(store_m->poison); + me["lvl"].setTextToNum(store_m.level); + me["hp"].setTextToNum(store_m.health); + me["sp"].setTextToNum(store_m.mp); + me["def"].setTextToNum(store_m.armor); + me["skill"].setTextToNum(store_m.skill); + me["morale"].setTextToNum(store_m.morale); + me["ap"].setTextToNum(store_m.speed); + me["mage"].setTextToNum(store_m.mu); + me["priest"].setTextToNum(store_m.cl); + me["poison"].setTextToNum(store_m.poison); // 2140 - lit 2141 - dark // immunities for(i = 0; i < 8; i++) { std::string id = "immune" + boost::lexical_cast(i + 1); cLed& led = dynamic_cast(me[id]); // TODO: What's this s_pow nonsense? Isn't this just 1 << i? Also, why not make it a C++ bitfield? - if (store_m->immunities & (char)(s_pow(2,i))) + if(store_m.immunities & (char)(s_pow(2,i))) led.setState(led_red); else led.setState(led_off); } @@ -456,8 +439,7 @@ static void put_monst_info(cDialog& me) } -static bool display_monst_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool display_monst_event_filter(cDialog& me, std::string item_hit, cCreature& store_m) { short i,dummy = 0; if(item_hit == "done") { @@ -472,17 +454,17 @@ static bool display_monst_event_filter(cDialog& me, std::string item_hit, eKeyMo if (on_monst_menu[position] < 0) position = 0; - store_m->number = on_monst_menu[position]; - *store_m = *store_m; // to fill in fields that wouldn't otherwise be filled in; replaces return_monster_template - put_monst_info(me); + store_m.number = on_monst_menu[position]; + store_m = store_m; // to fill in fields that wouldn't otherwise be filled in; replaces return_monster_template + put_monst_info(me, store_m); } else if(item_hit == "right") { position++; if (on_monst_menu[position] < 0) position = 0; - store_m->number = on_monst_menu[position]; - *store_m = *store_m; // no, this is not redundant + store_m.number = on_monst_menu[position]; + store_m = store_m; // no, this is not redundant // TODO: It may not be redudndant, but it looks pretty stupid; change it - put_monst_info(me); + put_monst_info(me, store_m); } return true; } @@ -491,26 +473,28 @@ void display_monst(short array_pos,cCreature *which_m,short mode) //creature_data_type *which_m; // if NULL, show full roster //short mode; // if 1, full roster, else use monster from store_m { + using namespace std::placeholders; position = array_pos; full_roster = false; + cCreature store_m; if (mode == 1) { full_roster = true; - store_m = &hold_m; - store_m->number = on_monst_menu[array_pos]; - *store_m = *store_m; // yes, this DOES do something + store_m = cCreature(); + store_m.number = on_monst_menu[array_pos]; + store_m = store_m; // yes, this DOES do something } else { - hold_m = *which_m; - store_m = which_m; + store_m = *which_m; } make_cursor_sword(); cDialog monstInfo("monster-info.xml"); - monstInfo.attachClickHandlers(display_monst_event_filter, {"done", "left", "right"}); + auto event_filter = std::bind(display_monst_event_filter, _1, _2,std::ref(store_m)); + monstInfo.attachClickHandlers(event_filter, {"done", "left", "right"}); // Also add the click handler to the LEDs to suppress normal LED behaviour - monstInfo.attachClickHandlers(display_monst_event_filter, {"immune1", "immune2", "immune3", "immune4"}); - monstInfo.attachClickHandlers(display_monst_event_filter, {"immune5", "immune6", "immune7", "immune8"}); + monstInfo.attachClickHandlers(event_filter, {"immune1", "immune2", "immune3", "immune4"}); + monstInfo.attachClickHandlers(event_filter, {"immune5", "immune6", "immune7", "immune8"}); if (full_roster == false) { monstInfo["left"].hide(); @@ -542,14 +526,13 @@ void display_monst(short array_pos,cCreature *which_m,short mode) monstInfo.addLabelFor("immune6", "Immune To Cold", LABEL_LEFT, 45, false); monstInfo.addLabelFor("immune7", "Poison Resistant", LABEL_LEFT, 45, false); monstInfo.addLabelFor("immune8", "Immune To Poison", LABEL_LEFT, 45, false); - put_monst_info(monstInfo); + put_monst_info(monstInfo, store_m); monstInfo.run(); } // TODO: Create a dedicated dialog for alchemy info -static bool display_alchemy_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool display_alchemy_event_filter(cDialog& me, std::string item_hit, eKeyMod) { std::string get_text; if(item_hit == "done") { @@ -586,17 +569,13 @@ void display_alchemy() alchemy.run(); } -static void display_pc_info(cDialog& me) -{ +static void display_pc_info(cDialog& me, const short pc) { short i,store; char str[256]; - short pc; char to_draw[60]; short weap1 = 24,weap2 = 24,hit_adj = 0, dam_adj = 0,skill_item; - pc = store_pc_num; - store = pc_carry_weight(pc); i = amount_pc_can_carry(pc); sprintf ((char *) to_draw, "%s is carrying %d stones out of %d.",univ.party[pc].name.c_str(),store,i); @@ -681,46 +660,41 @@ static void display_pc_info(cDialog& me) } } -static bool give_pc_info_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ - short pc; - - pc = store_pc_num; +static bool give_pc_info_event_filter(cDialog& me, std::string item_hit, short& store_pc_num) { if(item_hit == "done") me.toast(); else if(item_hit == "left") { // TODO: Put braces on these do-whiles... o.O do store_pc_num = (store_pc_num == 0) ? 5 : store_pc_num - 1; while(univ.party[store_pc_num].main_status != eMainStatus::ALIVE); - display_pc_info(me); + display_pc_info(me, store_pc_num); } else if(item_hit == "right") { do store_pc_num = (store_pc_num + 1) % 6; while(univ.party[store_pc_num].main_status != eMainStatus::ALIVE); - display_pc_info(me); + display_pc_info(me, store_pc_num); } return true; } -static bool give_pc_extra_info(cDialog& me, std::string item_hit, eKeyMod mods) { - short pc = store_pc_num; +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,&me); + else if(item_hit == "trait") pick_race_abil(&univ.party[pc],1); else if(item_hit == "alch") display_alchemy(false); return true; } void give_pc_info(short pc_num) { + using namespace std::placeholders; short i; std::string str; - store_pc_num = pc_num; make_cursor_sword(); cDialog pcInfo("pc-info.xml"); - pcInfo.attachClickHandlers(give_pc_info_event_filter, {"done", "left", "right"}); + pcInfo.attachClickHandlers(std::bind(give_pc_info_event_filter, _1, _2, std::ref(pc_num)), {"done", "left", "right"}); pcInfo.attachClickHandlers(give_pc_extra_info, {"seemage", "seepriest", "trait", "alch"}); for (i = 0; i < 19; i++) { @@ -728,12 +702,12 @@ void give_pc_info(short pc_num) str = get_str("skills",1 + i * 2); pcInfo[lbl].setText(str); } - display_pc_info(pcInfo); + display_pc_info(pcInfo, pc_num); pcInfo.run(); } -static bool adventure_notes_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) +static bool adventure_notes_event_filter(cDialog& me, std::string item_hit, eKeyMod) { unsigned short i; std::string place_str; @@ -896,8 +870,7 @@ static void put_talk(cDialog& me) } } -static bool talk_notes_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool talk_notes_event_filter(cDialog& me, std::string item_hit, eKeyMod) { if(item_hit == "done") me.toast(); else if(item_hit == "left") { if (store_page_on == 0) @@ -945,8 +918,7 @@ void talk_notes() talkNotes.run(); } -static bool journal_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool journal_event_filter(cDialog& me, std::string item_hit, eKeyMod) { short i; char place_str[256]; diff --git a/osx/boe.infodlg.h b/osx/boe.infodlg.h index a9d0409e..362d071e 100644 --- a/osx/boe.infodlg.h +++ b/osx/boe.infodlg.h @@ -23,7 +23,7 @@ void put_spec_item_info (short which_i); //void display_strings_with_nums(short a1,short a2, short b1, short b2, char *title,short sound_num,short graphic_num,short graphic_type,short parent_num); // These are defined in pc.editors.cpp since they are also used by the character editor -void pick_race_abil(cPlayer *pc,short mode,cDialog* parent); +void pick_race_abil(cPlayer *pc,short mode); void display_pc(short pc_num,short mode,cDialog* parent_num); void display_alchemy(bool allowEdit); diff --git a/osx/boe.itemdata.cpp b/osx/boe.itemdata.cpp index 61ad0ad2..a7558aeb 100644 --- a/osx/boe.itemdata.cpp +++ b/osx/boe.itemdata.cpp @@ -59,8 +59,7 @@ cItemRec get_food() } -cItemRec pull_item_of_type(short loot_max,short min_val,short max_val,eItemType t1, eItemType t2, eItemType t3) -{ +cItemRec pull_item_of_type(unsigned int loot_max,short min_val,short max_val,eItemType t1, eItemType t2, eItemType t3) { short i,j,val; cItemRec temp_i; @@ -84,8 +83,7 @@ cItemRec pull_item_of_type(short loot_max,short min_val,short max_val,eItemType return temp_i; } -cItemRec get_weapon(short loot,short level) -{ +cItemRec get_weapon(short loot) { cItemRec weapon; if (loot == 0) @@ -96,8 +94,7 @@ cItemRec get_weapon(short loot,short level) } -cItemRec get_armor(short loot,short level) -{ +cItemRec get_armor(short loot) { short r1; cItemRec armor; @@ -157,8 +154,7 @@ cItemRec get_missile(short loot) } -cItemRec get_poison(short loot,short level) -{ +cItemRec get_poison(short loot) { return pull_item_of_type(loot,loot_min[loot],loot_max[loot],eItemType::WEAPON_POISON); } diff --git a/osx/boe.itemdata.h b/osx/boe.itemdata.h index 65deedb7..397cb3fe 100644 --- a/osx/boe.itemdata.h +++ b/osx/boe.itemdata.h @@ -1,7 +1,7 @@ cItemRec get_stored_item(short which); cItemRec get_food(); -cItemRec get_weapon(short loot,short level); -cItemRec get_armor(short loot,short level); +cItemRec get_weapon(short loot); +cItemRec get_armor(short loot); cItemRec get_helm(short loot); cItemRec get_gloves(short loot); cItemRec get_boots(short loot); @@ -9,9 +9,9 @@ cItemRec get_shield(short loot); cItemRec get_potion(short loot); cItemRec get_scroll(short loot); cItemRec get_missile(short loot); -cItemRec get_poison(short loot,short level); +cItemRec get_poison(short loot); cItemRec get_wand(short loot); cItemRec get_ring(short loot); cItemRec get_necklace(short loot); //item_record_type convert_item (short_item_record_type s_item); -cItemRec pull_item_of_type(short loot_max,short min_val,short max_val,eItemType t1, eItemType t2 = eItemType::NO_ITEM, eItemType t3 = eItemType::NO_ITEM); +cItemRec pull_item_of_type(unsigned int loot_max,short min_val,short max_val,eItemType t1, eItemType t2 = eItemType::NO_ITEM, eItemType t3 = eItemType::NO_ITEM); diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index a062d8d1..3ef996df 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -295,8 +295,7 @@ bool party_take_abil(short abil) // returns true is party has item of given item class // mode - 0 - take one of them, 1 - don't take -bool party_check_class(short item_class,short mode) //// -{ +bool party_check_class(unsigned int item_class,short mode) { short i,j; if (item_class == 0) @@ -512,8 +511,8 @@ void enchant_weapon(short pc_num,short item_hit,short enchant_type,short new_val void equip_item(short pc_num,short item_num) { - short num_equipped_of_this_type = 0; - short num_hands_occupied = 0; + unsigned short num_equipped_of_this_type = 0; + unsigned short num_hands_occupied = 0; short i; short equip_item_type = 0; @@ -964,8 +963,7 @@ static void put_item_graphics(cDialog& me) } -static bool display_item_event_filter(cDialog& me, std::string id, eKeyMod mods) -{ +static bool display_item_event_filter(cDialog& me, std::string id, eKeyMod) { cItemRec item; if(id == "done") { @@ -1166,8 +1164,7 @@ short custom_choice_dialog(std::array& strs,short pic_num,ePicTy // return i; //} -static bool get_num_of_items_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool get_num_of_items_event_filter(cDialog& me, std::string, eKeyMod) { me.setResult(me["number"].getTextAsNum()); return true; } @@ -1325,11 +1322,11 @@ void place_treasure(location where,short level,short loot,short mode) max = 200; - new_item = return_treasure(treas_chart[loot][j],level,mode); + new_item = return_treasure(treas_chart[loot][j]); if ((item_val(new_item) < min) || (item_val(new_item) > max)) { - new_item = return_treasure(treas_chart[loot][j],level,mode); + new_item = return_treasure(treas_chart[loot][j]); if ((item_val(new_item) < min) || (item_val(new_item) > max)) { - new_item = return_treasure(treas_chart[loot][j],level,mode); + new_item = return_treasure(treas_chart[loot][j]); if (item_val(new_item) > max) new_item.variety = eItemType::NO_ITEM; } @@ -1347,7 +1344,7 @@ void place_treasure(location where,short level,short loot,short mode) // if forced, keep dipping until a treasure comes up if ((mode == 1) && (max >= 20)) { - do new_item = return_treasure(treas_chart[loot][j],level,mode); + do new_item = return_treasure(treas_chart[loot][j]); while(new_item.variety == eItemType::NO_ITEM || item_val(new_item) > max); } @@ -1376,9 +1373,7 @@ short luck_total() return i; } -cItemRec return_treasure(short loot,short level,short mode) -//short mode; // 0 - normal 1 - force -{ +cItemRec return_treasure(short loot) { cItemRec treas; static const short which_treas_chart[48] = { 1,1,1,1,1,2,2,2,2,2, @@ -1397,8 +1392,8 @@ cItemRec return_treasure(short loot,short level,short mode) r1 += 3; switch (which_treas_chart[r1]) { case 1: treas = get_food(); break; - case 2: treas = get_weapon(loot,level); break; - case 3: treas = get_armor(loot,level); break; + case 2: treas = get_weapon(loot); break; + case 3: treas = get_armor(loot); break; case 4: treas = get_shield(loot); break; case 5: treas = get_helm(loot); break; case 6: treas = get_missile(loot); break; @@ -1407,7 +1402,7 @@ cItemRec return_treasure(short loot,short level,short mode) case 9: treas = get_wand(loot); break; case 10: treas = get_ring(loot); break; case 11: treas = get_necklace(loot); break; - case 12: treas = get_poison(loot,level); break; + case 12: treas = get_poison(loot); break; case 13: treas = get_gloves(loot); break; case 14: treas = get_boots(loot); break; } @@ -1424,7 +1419,7 @@ void refresh_store_items() for (i = 0; i < 5; i++) for (j = 0; j < 10; j++) { - univ.party.magic_store_items[i][j] = return_treasure(loot_index[j],7,1); + univ.party.magic_store_items[i][j] = return_treasure(loot_index[j]); if(univ.party.magic_store_items[i][j].variety == eItemType::GOLD || univ.party.magic_store_items[i][j].variety == eItemType::FOOD) univ.party.magic_store_items[i][j] = cItemRec(); @@ -1434,23 +1429,20 @@ void refresh_store_items() } -static bool get_text_response_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool get_text_response_event_filter(cDialog& me, std::string, eKeyMod) { me.toast(); me.setResult(me["response"].getText()); return true; } -std::string get_text_response(short dlg,short parent_num) -{ +std::string get_text_response(std::string prompt, pic_num_t pic) { make_cursor_sword(); cDialog strPanel("get-response.xml"); strPanel.attachClickHandlers(get_text_response_event_filter, {"okay"}); - // FIXME: A sort of hack to change the prompt and graphic if the other text response dialog was requested. - if(dlg == 1017) { - dynamic_cast(strPanel["pic"]).setPict(8); - strPanel["prompt"].setText("Ask about what?"); + if(!prompt.empty()) { + dynamic_cast(strPanel["pic"]).setPict(pic); + strPanel["prompt"].setText(prompt); } strPanel.run(); diff --git a/osx/boe.items.h b/osx/boe.items.h index 23cfb781..2231b18d 100644 --- a/osx/boe.items.h +++ b/osx/boe.items.h @@ -13,7 +13,7 @@ short pc_has_abil_equip(short pc_num,short abil); short pc_has_abil(short pc_num,short abil); bool party_has_abil(short abil); bool party_take_abil(short abil); -bool party_check_class(short item_class,short mode); +bool party_check_class(unsigned int item_class,short mode); short pc_carry_weight(short pc_num); short amount_pc_can_carry(short pc_num); void give_food(short amount,bool print_result); @@ -51,9 +51,9 @@ short item_val(cItemRec item); bool give_to_party(cItemRec item, short print_result); void place_treasure(location where,short level,short loot,short mode); short luck_total(); -cItemRec return_treasure(short loot,short level,short mode); +cItemRec return_treasure(short loot); void refresh_store_items(); -std::string get_text_response(short dlg,short parent_num); +std::string get_text_response(std::string prompt = "", pic_num_t pic = 16); // These are defined in pc.editors.cpp since they are also used by the character editor short char_select_pc(short active_only,short free_inv_only,const char *title); diff --git a/osx/boe.locutils.cpp b/osx/boe.locutils.cpp index 1ed70063..8bff434a 100644 --- a/osx/boe.locutils.cpp +++ b/osx/boe.locutils.cpp @@ -70,10 +70,11 @@ bool point_onscreen(location center,location check) short set_direction (location old_pt, location new_pt) { - if (old_pt.x == new_pt.x) + if (old_pt.x == new_pt.x) { if (old_pt.y > new_pt.y) return DIR_N; else return DIR_S; + } if (old_pt.x > new_pt.x) { if (old_pt.y > new_pt.y) return DIR_NW; diff --git a/osx/boe.main.cpp b/osx/boe.main.cpp index 39ea0f36..125fed25 100644 --- a/osx/boe.main.cpp +++ b/osx/boe.main.cpp @@ -143,7 +143,7 @@ bool sleep_field; // Main body of program Exile // -int main(int argc, char* argv[]) { +int main(int /*argc*/, char* argv[]) { #if 0 void debug_oldstructs(); debug_oldstructs(); @@ -267,7 +267,6 @@ void Initialize(void) void Handle_One_Event() { - static const long fiveTicks = time_in_ticks(5).asMilliseconds(); static const long twentyTicks = time_in_ticks(20).asMilliseconds(); static const long fortyTicks = time_in_ticks(40).asMilliseconds(); @@ -375,6 +374,8 @@ void Handle_One_Event() } } #endif + default: + break; // There's several events we don't need to handle at all } flushingInput = false; // TODO: Could there be a case when the key and mouse input that needs to be flushed has other events interspersed? mainPtr.display(); // TODO: I'm assuming this needs to be SOMEWHERE, at least. @@ -390,7 +391,7 @@ void Handle_Update() } -void handleUpdateWhileScrolling(volatile bool& doneScrolling, int refresh) { +static void handleUpdateWhileScrolling(volatile bool& doneScrolling, int refresh) { while(!doneScrolling) { sf::sleep(sf::milliseconds(10)); redraw_screen(refresh); diff --git a/osx/boe.menus.mac.mm b/osx/boe.menus.mac.mm index 054fd1e5..94adafcd 100644 --- a/osx/boe.menus.mac.mm +++ b/osx/boe.menus.mac.mm @@ -326,6 +326,7 @@ void handle_menu_spell(short spell_picked,short spell_type); } -(void) onlineHelp:(id) sender { + (void) sender; // Suppress "unused parameter" warning [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: @"https://calref.net/~sylae/boe-doc/game/Contents.html"]]; } diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index 486c4916..cf71083a 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -102,7 +102,7 @@ void create_wand_monst() location p_loc; r1 = get_ran(1,0,3); - if (overall_mode == MODE_OUTDOORS) + if(overall_mode == MODE_OUTDOORS) { if (!univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering[r1].isNull()) { r2 = get_ran(1,0,3); while ((point_onscreen(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering_locs[r2], @@ -112,29 +112,29 @@ void create_wand_monst() place_outd_wand_monst(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering_locs[r2], univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering[r1],0); } - else // won't place wandering is more than 50 monsters - if ((!univ.town->wandering[r1].isNull()) && (univ.town.countMonsters() <= 50) - && (univ.party.m_killed[univ.town.num] < univ.town->max_num_monst)) { - r2 = get_ran(1,0,3); - while (point_onscreen(univ.town->wandering_locs[r2],univ.town.p_loc) && - !loc_off_act_area(univ.town->wandering_locs[r2]) && (num_tries++ < 100)) - r2 = get_ran(1,0,3); - for (i = 0; i < 4; i++) { - if (univ.town->wandering[r1].monst[i] != 0) { // place a monster - p_loc = univ.town->wandering_locs[r2]; - p_loc.x += get_ran(1,0,4) - 2; - p_loc.y += get_ran(1,0,4) - 2; - if (!is_blocked(p_loc)) - place_monster(univ.town->wandering[r1].monst[i],p_loc); - } - p_loc = univ.town->wandering_locs[r2]; - p_loc.x += get_ran(1,0,4) - 2; - p_loc.y += get_ran(1,0,4) - 2; - r3 = get_ran(1,0,3); - if ((r3 >= 2) && (!is_blocked(p_loc))) // place extra monsters? - place_monster(univ.town->wandering[r1].monst[3],p_loc); - } + } else if(!univ.town->wandering[r1].isNull() && univ.town.countMonsters() <= 50 + && univ.party.m_killed[univ.town.num] < univ.town->max_num_monst) { + // won't place wandering if more than 50 monsters + r2 = get_ran(1,0,3); + while(point_onscreen(univ.town->wandering_locs[r2],univ.town.p_loc) && + !loc_off_act_area(univ.town->wandering_locs[r2]) && num_tries++ < 100) + r2 = get_ran(1,0,3); + for(i = 0; i < 4; i++) { + if(univ.town->wandering[r1].monst[i] != 0) { // place a monster + p_loc = univ.town->wandering_locs[r2]; + p_loc.x += get_ran(1,0,4) - 2; + p_loc.y += get_ran(1,0,4) - 2; + if(!is_blocked(p_loc)) + place_monster(univ.town->wandering[r1].monst[i],p_loc); } + p_loc = univ.town->wandering_locs[r2]; + p_loc.x += get_ran(1,0,4) - 2; + p_loc.y += get_ran(1,0,4) - 2; + r3 = get_ran(1,0,3); + if(r3 >= 2 && !is_blocked(p_loc)) // place extra monsters? + place_monster(univ.town->wandering[r1].monst[3],p_loc); + } + } } void place_outd_wand_monst(location where,cOutdoors::cWandering group,short forced) @@ -345,15 +345,15 @@ bool monst_hate_spot(short which_m,location *good_loc) if (univ.town.is_fire_barr(loc.x,loc.y) || univ.town.is_force_barr(loc.x,loc.y) || univ.town.is_quickfire(loc.x,loc.y) || univ.town.is_blade_wall(loc.x,loc.y) // hate regular fields || (univ.town.is_ice_wall(loc.x,loc.y) && (univ.town.monst[which_m].radiate_1 != 2) - && (univ.town.monst[which_m].immunities & 32 == 0)) // hate ice wall? + && ((univ.town.monst[which_m].immunities & 32) == 0)) // hate ice wall? || (univ.town.is_fire_wall(loc.x,loc.y) && (univ.town.monst[which_m].radiate_1 != 1) - && (univ.town.monst[which_m].immunities & 8 == 0)) // hate fire wall? + && ((univ.town.monst[which_m].immunities & 8) == 0)) // hate fire wall? || (univ.town.is_scloud(loc.x,loc.y) && (univ.town.monst[which_m].radiate_1 != 6) - && (univ.town.monst[which_m].immunities & 3 == 0)) // hate stink cloud? + && ((univ.town.monst[which_m].immunities & 3) == 0)) // hate stink cloud? || (univ.town.is_sleep_cloud(loc.x,loc.y) && (univ.town.monst[which_m].radiate_1 != 5) - && (univ.town.monst[which_m].immunities & 3 == 0)) // hate sleep cloud? + && ((univ.town.monst[which_m].immunities & 3) == 0)) // hate sleep cloud? || (univ.town.is_force_wall(loc.x,loc.y) && (univ.town.monst[which_m].radiate_1 != 3) - && (univ.town.monst[which_m].immunities & 3 == 0)) // hate shock cloud? + && ((univ.town.monst[which_m].immunities & 3) == 0)) // hate shock cloud? || (((univ.town.monst[which_m].mu > 0) || (univ.town.monst[which_m].cl > 0)) && univ.town.is_antimagic(loc.x,loc.y))) // hate antimagic { @@ -1366,7 +1366,7 @@ bool summon_monster(m_num_t which,location where,short duration,short given_atti return true; } -void activate_monsters(short code,short attitude) +void activate_monsters(short code,short /*attitude*/) { short i; diff --git a/osx/boe.newgraph.cpp b/osx/boe.newgraph.cpp index d7998ab0..ee78a190 100644 --- a/osx/boe.newgraph.cpp +++ b/osx/boe.newgraph.cpp @@ -556,7 +556,7 @@ short get_missile_direction(location origin_point,location the_point) return dir; } -void do_explosion_anim(short sound_num,short special_draw) +void do_explosion_anim(short /*sound_num*/,short special_draw) // sound_num currently ignored // special_draw - 0 normal 1 - first half 2 - second half { @@ -943,7 +943,7 @@ void refresh_shopping() } } -void place_talk_face() { +static void place_talk_face() { RECT face_rect = {6,6,38,38}; face_rect.offset(talk_area_rect.topLeft()); face_rect.offset(ul); @@ -1075,8 +1075,8 @@ void get_item_interesting_string(cItemRec item,char *message) case eItemType::HELM: case eItemType::GLOVES: case eItemType::SHIELD_2: - case eItemType::BOOTS: - sprintf(message,"Blocks %d-%d damage.",item.item_level + (item.protection > 0) ? 1 : 0, + case eItemType::BOOTS: // TODO: Verify that this is displayed correctly + sprintf(message,"Blocks %d-%d damage.",item.item_level + ((item.protection > 0) ? 1 : 0), item.item_level + item.protection); break; case eItemType::BOW: @@ -1201,7 +1201,6 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col std::vector hilites; std::vector nodes; int wordStart = 0, wordEnd = 0; - bool inClickable = false; for(size_t i = 0; i < str.length(); i++) { char c = str[i]; if(isalpha(c) || c == '-' || c == '\'') { diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index eb6bcbc7..6b3d563e 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -149,7 +149,7 @@ extern sf::Texture pc_gworld; char c_line[60]; // Variables for spell selection -short store_situation,store_last_target_darkened,on_which_spell_page = 0; +short on_which_spell_page = 0; short store_last_cast_mage = 6,store_last_cast_priest = 6; short buttons_on[38] = {1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0}; // buttons_on determines which buttons can be hit when on the second spell page @@ -159,9 +159,6 @@ short spell_index[38] = {38,39,40,41,42,43,44,45,90,90,46,47,48,49,50,51,52,53,9 bool can_choose_caster; // Dialog vars -short store_mage_store ; -short store_priest_store ; -short store_store_target; short store_graphic_pc_num ; short store_graphic_mode ; short store_pc_graphic; @@ -542,7 +539,7 @@ bool create_pc(short spot,cDialog* parent) univ.party[spot] = cPlayer(); - pick_race_abil(&univ.party[spot],0,parent); + pick_race_abil(&univ.party[spot],0); // TODO: Not sure if these initial draws are needed // if (parent != NULL) @@ -1010,9 +1007,8 @@ bool is_weapon(short pc_num,short item) } -void cast_spell(short type,short situation) +void cast_spell(short type) //short type; // 0 - mage 1 - priest -//short situation; // 0 - out 1 - town { short spell; @@ -1022,7 +1018,7 @@ void cast_spell(short type,short situation) } if (spell_forced == false) - spell = pick_spell(6, type, situation); + spell = pick_spell(6, type); else { if (repeat_cast_ok(type) == false) return; @@ -1576,12 +1572,13 @@ void do_priest_spell(short pc_num,short spell_num) //// sprintf ((char *) c_line," Your items glow. "); } - if (!PSD[SDF_RESURRECT_NO_BALM] && ((spell_num == 40) || (spell_num == 56))) + if(!PSD[SDF_RESURRECT_NO_BALM] && (spell_num == 40 || spell_num == 56)) { if ((item = pc_has_abil(pc_num,160)) == 24) { add_string_to_buf(" Need resurrection balm. "); spell_num = 500; } else take_item(pc_num,item); + } if (spell_num == 40) { if(univ.party[target].main_status == eMainStatus::DEAD) if (get_ran(1,1,univ.party[pc_num].level / 2) == 1) { @@ -1714,7 +1711,7 @@ void cast_town_spell(location where) //// case 119: case 145: case 18: add_string_to_buf(" You attempt to dispel. "); - place_spell_pattern(current_pat,where,11,false,7); + place_spell_pattern(current_pat,where,11,7); break; case 116: // Move M. add_string_to_buf(" You blast the area. "); @@ -1982,8 +1979,7 @@ bool pc_can_cast_spell(short pc_num,short type,short spell_num) // MARK: Begin spellcasting dialog -static void draw_caster_buttons(cDialog& me) -{ +static void draw_caster_buttons(cDialog& me, const short store_situation) { short i; for(i = 0; i < 6; i++) { @@ -2007,8 +2003,7 @@ static void draw_caster_buttons(cDialog& me) } } -static void draw_spell_info(cDialog& me) -{ +static void draw_spell_info(cDialog& me, const short store_situation) { if (((store_situation == 0) && (store_mage == 70)) || @@ -2086,8 +2081,8 @@ static void put_pc_caster_buttons(cDialog& me) } } } -static void put_pc_target_buttons(cDialog& me) -{ + +static void put_pc_target_buttons(cDialog& me, short& store_last_target_darkened) { if (store_spell_target < 6) { std::string n = boost::lexical_cast(store_spell_target + 1); @@ -2103,8 +2098,7 @@ static void put_pc_target_buttons(cDialog& me) } // TODO: This stuff may be better handled by using an LED group with a custom focus handler -static void put_spell_led_buttons(cDialog& me) -{ +static void put_spell_led_buttons(cDialog& me, const short store_situation) { short i,spell_for_this_button; for (i = 0; i < 38; i++) { @@ -2127,8 +2121,7 @@ static void put_spell_led_buttons(cDialog& me) } } -static void put_spell_list(cDialog& me) -{ +static void put_spell_list(cDialog& me, const short store_situation) { short i; char add_text[256]; @@ -2178,21 +2171,20 @@ static void put_spell_list(cDialog& me) } -static void put_pick_spell_graphics(cDialog& me) -{ +static void put_pick_spell_graphics(cDialog& me, const short store_situation, short& last_darkened) { short i; - put_spell_list(me); + put_spell_list(me, store_situation); put_pc_caster_buttons(me); - put_pc_target_buttons(me); - put_spell_led_buttons(me); + put_pc_target_buttons(me, last_darkened); + put_spell_led_buttons(me, store_situation); for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) draw_pc_effects(10 + i); // TODO: This line might mean that the "kludge" from the old code is already handled here; verify? } -static bool pick_spell_caster(cDialog& me, std::string id, eKeyMod mods) { +static bool pick_spell_caster(cDialog& me, std::string id, const short store_situation, short& last_darkened) { short item_hit = id[id.length() - 1] - '1'; // TODO: This visibility check is probably not needed; wouldn't the dialog framework only trigger on visible elements? if(me[id].isVisible()) { @@ -2204,16 +2196,16 @@ static bool pick_spell_caster(cDialog& me, std::string id, eKeyMod mods) { else store_priest = 70; store_spell_target = 6; } - draw_spell_info(me); + draw_spell_info(me, store_situation); draw_spell_pc_info(me); - put_spell_led_buttons(me); + put_spell_led_buttons(me, store_situation); put_pc_caster_buttons(me); - put_pc_target_buttons(me); + put_pc_target_buttons(me, last_darkened); } return true; } -static bool pick_spell_target(cDialog& me, std::string id, eKeyMod mods) { +static bool pick_spell_target(cDialog& me, std::string id, const short store_situation, short& last_darkened) { static const char*const no_target = " No target needed."; static const char*const bad_target = " Can't cast on him/her."; static const char*const got_target = " Target selected."; @@ -2227,34 +2219,25 @@ static bool pick_spell_target(cDialog& me, std::string id, eKeyMod mods) { } else { me["feedback"].setText(got_target); store_spell_target = item_hit; - draw_spell_info(me); - put_pc_target_buttons(me); + draw_spell_info(me, store_situation); + put_pc_target_buttons(me, last_darkened); } return true; } -void finish_pick_spell(cDialog& me, bool spell_toast); - -static bool pick_spell_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) { - bool spell_toast = false,dialog_done = false; - if(item_hit == "cancel") { - spell_toast = true; - dialog_done = true; - } else if(item_hit == "cast") { - dialog_done = true; - } else if(item_hit == "other") { +static bool pick_spell_event_filter(cDialog& me, std::string item_hit, const short store_situation) { + if(item_hit == "other") { on_which_spell_page = 1 - on_which_spell_page; - put_spell_list(me); - put_spell_led_buttons(me); + put_spell_list(me, store_situation); + put_spell_led_buttons(me, store_situation); } else if(item_hit == "help") { univ.party.help_received[7] = 0; give_help(207,8,me); } - if(dialog_done) finish_pick_spell(me, spell_toast); return true; } -static bool pick_spell_select_led(cDialog& me, std::string id, eKeyMod mods) { +static bool pick_spell_select_led(cDialog& me, std::string id, eKeyMod mods, const short store_situation, short& last_darkened) { static const char*const choose_target = " Now pick a target."; static const char*const bad_spell = " Spell not available."; short item_hit = boost::lexical_cast(id.substr(5)) - 1; @@ -2269,34 +2252,34 @@ static bool pick_spell_select_led(cDialog& me, std::string id, eKeyMod mods) { if (store_situation == 0) store_mage = (on_which_spell_page == 0) ? item_hit : spell_index[item_hit]; else store_priest = (on_which_spell_page == 0) ? item_hit : spell_index[item_hit]; - draw_spell_info(me); - put_spell_led_buttons(me); + draw_spell_info(me, store_situation); + put_spell_led_buttons(me, store_situation); if (store_spell_target < 6) { std::string targ = "target" + boost::lexical_cast(store_spell_target + 1); if(!me[targ].isVisible()) { store_spell_target = 6; - draw_spell_info(me); - put_pc_target_buttons(me); + draw_spell_info(me, store_situation); + put_pc_target_buttons(me, last_darkened); } } // Cute trick now... if a target is needed, caster can always be picked std::string targ = "target" + boost::lexical_cast(pc_casting + 1); if ((store_spell_target == 6) && me[targ].isVisible()) { me["feedback"].setText(choose_target); - draw_spell_info(me); + draw_spell_info(me, store_situation); play_sound(45); // formerly force_play_sound } else if(!me[targ].isVisible()) { store_spell_target = 6; - put_pc_target_buttons(me); + put_pc_target_buttons(me, last_darkened); } } return true; } -void finish_pick_spell(cDialog& me, bool spell_toast) { +static bool finish_pick_spell(cDialog& me, bool spell_toast, const short store_store_target, const short store_mage_store, const short store_priest_store, const short store_situation) { if (spell_toast == true) { store_mage = store_mage_store; store_priest = store_priest_store; @@ -2306,7 +2289,7 @@ void finish_pick_spell(cDialog& me, bool spell_toast) { else store_last_cast_priest = pc_casting; me.toast(); me.setResult(70); - return; + return true; } if (((store_situation == 0) && (store_mage == 70)) || @@ -2317,21 +2300,21 @@ void finish_pick_spell(cDialog& me, bool spell_toast) { store_spell_target = store_store_target ; me.toast(); me.setResult(70); - return; + return true; } if ((store_situation == 0) && (mage_need_select[store_mage] == 0)) { store_last_cast_mage = pc_casting; pc_last_cast[store_situation][pc_casting] = store_mage; me.toast(); me.setResult(store_mage); - return; + return true; } if ((store_situation == 1) && (priest_need_select[store_priest] == 0)) { store_last_cast_priest = pc_casting; pc_last_cast[store_situation][pc_casting] = store_priest; me.toast(); me.setResult(store_priest); - return; + return true; } if (store_spell_target == 6) { add_string_to_buf("Cast: Need to select target."); @@ -2341,7 +2324,7 @@ void finish_pick_spell(cDialog& me, bool spell_toast) { me.toast(); give_help(39,0,me); me.setResult(70); - return; + return true; } me.setResult((store_situation == 0) ? store_mage : store_priest); if (store_situation == 0) @@ -2349,18 +2332,20 @@ void finish_pick_spell(cDialog& me, bool spell_toast) { else store_last_cast_priest = pc_casting; pc_last_cast[store_situation][pc_casting] = ((store_situation == 0) ? store_mage : store_priest); me.toast(); + return true; } -short pick_spell(short pc_num,short type,short situation) // 70 - no spell OW spell num +short pick_spell(short pc_num,short type) // 70 - no spell OW spell num //short pc_num; // if 6, anyone //short type; // 0 - mage 1 - priest //short situation; // 0 - out 1 - town 2 - combat { - store_mage_store = store_mage; - store_priest_store = store_priest; - store_store_target = store_spell_target; - store_situation = type; - store_last_target_darkened = 6; + using namespace std::placeholders; + short former_mage = store_mage; + short former_priest = store_priest; + short former_target = store_spell_target; +// store_situation = type; + short dark = 6; can_choose_caster = (pc_num < 6) ? false : true; pc_casting = (type == 0) ? store_last_cast_mage : store_last_cast_priest; @@ -2440,9 +2425,11 @@ short pick_spell(short pc_num,short type,short situation) // 70 - no spell OW s cDialog castSpell("cast-spell.xml"); - castSpell.attachClickHandlers(pick_spell_caster, {"caster1","caster2","caster3","caster4","caster5","caster6"}); - castSpell.attachClickHandlers(pick_spell_target, {"target1","target2","target3","target4","target5","target6"}); - castSpell.attachClickHandlers(pick_spell_event_filter, {"cancel", "cast", "other", "help"}); + castSpell.attachClickHandlers(std::bind(pick_spell_caster, _1, _2, type, std::ref(dark)), {"caster1","caster2","caster3","caster4","caster5","caster6"}); + castSpell.attachClickHandlers(std::bind(pick_spell_target,_1,_2, type, dark), {"target1","target2","target3","target4","target5","target6"}); + castSpell.attachClickHandlers(std::bind(pick_spell_event_filter, _1, _2, type), {"other", "help"}); + castSpell["cast"].attachClickHandler(std::bind(finish_pick_spell, _1, false, former_target, former_mage, former_priest, type)); + castSpell["cancel"].attachClickHandler(std::bind(finish_pick_spell, _1, true, former_target, former_mage, former_priest, type)); dynamic_cast(castSpell["pic"]).setPict(14 + type,PIC_DLOG); for(int i = 0; i < 38; i++) { @@ -2453,15 +2440,15 @@ short pick_spell(short pc_num,short type,short situation) // 70 - no spell OW s cLed& led = dynamic_cast(castSpell[id]); led.setState((pc_can_cast_spell(pc_casting,type, (on_which_spell_page == 0) ? i : spell_index[i])) ? led_red : led_green); - led.attachClickHandler(pick_spell_select_led); + led.attachClickHandler(std::bind(pick_spell_select_led, _1, _2, _3, type, dark)); } - put_spell_list(castSpell); - draw_spell_info(castSpell); + put_spell_list(castSpell, type); + draw_spell_info(castSpell, type); put_pc_caster_buttons(castSpell); draw_spell_pc_info(castSpell); - draw_caster_buttons(castSpell); - put_spell_led_buttons(castSpell); + draw_caster_buttons(castSpell, type); + put_spell_led_buttons(castSpell, type); if (univ.party.help_received[7] == 0) { // TODO: Not sure if this initial draw is needed @@ -2614,8 +2601,7 @@ void do_alchemy() //// } -static bool alch_choice_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool alch_choice_event_filter(cDialog& me, std::string item_hit, eKeyMod) { if(item_hit == "help") { univ.party.help_received[20] = 0; give_help(20,21,me); @@ -2692,8 +2678,7 @@ bool pick_pc_graphic(short pc_num,short mode,cDialog* parent) return choice != 36; } -static bool pc_name_event_filter(cDialog& me, std::string item_hit, eKeyMod mods, short store_train_pc) -{ +static bool pc_name_event_filter(cDialog& me, short store_train_pc) { std::string pcName = me["name"].getText(); if(!isalpha(pcName[0])) { @@ -2716,7 +2701,7 @@ bool pick_pc_name(short pc_num,cDialog* parent) cDialog pcPickName("pick-pc-name.xml", parent); pcPickName["name"].setText(univ.party[pc_num].name); - pcPickName["okay"].attachClickHandler(std::bind(pc_name_event_filter, _1, _2, _3, pc_num)); + pcPickName["okay"].attachClickHandler(std::bind(pc_name_event_filter, _1, pc_num)); pcPickName.run(); diff --git a/osx/boe.party.h b/osx/boe.party.h index 1b49365e..9569843c 100644 --- a/osx/boe.party.h +++ b/osx/boe.party.h @@ -23,7 +23,7 @@ void drain_pc(short which_pc,short how_much); short mage_lore_total(); bool poison_weapon( short pc_num, short how_much,short safe); bool is_weapon(short pc_num,short item); -void cast_spell(short type,short situation); +void cast_spell(short type); bool repeat_cast_ok(short type); void give_party_spell(short which); void do_mage_spell(short pc_num,short spell_num); @@ -34,7 +34,7 @@ void crumble_wall(location where); void do_mindduel(short pc_num,cCreature *monst); void dispel_fields(short i,short j,short mode); bool pc_can_cast_spell(short pc_num,short type,short spell_num); -short pick_spell(short pc_num,short type,short situation) ; +short pick_spell(short pc_num,short type); short stat_adj(short pc_num,short which); void set_town_spell(short s_num,short who_c); void do_alchemy(); diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index 88202b56..57d22fda 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -97,7 +97,7 @@ short abil_chart[200] = { -bool town_specials(short which,short t_num) +bool town_specials(short which,short /*t_num*/) //short which; // number, 0 - 49, of special { bool can_enter = true; @@ -117,7 +117,7 @@ bool town_specials(short which,short t_num) return can_enter; } -bool handle_wandering_specials (short which,short mode) +bool handle_wandering_specials (short /*which*/,short mode) // which is unused //short mode; // 0 - pre 1 - end by victory 2 - end by flight // wanderin spec 99 -> generic spec @@ -403,6 +403,8 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short case eStatus::ACID: // Should say "Your skin tingles pleasantly." / "Your skin burns!"? acid_pc(i,ter_flag1.u); break; + case eStatus::MAIN: case eStatus::CHARM: // These magic values are illegal in this context + break; } if(mode == 2) break; // only damage once in combat! } @@ -1299,8 +1301,7 @@ bool adj_town_look(location where) } // PSOE - place_special_outdoor_encounter -void PSOE(short str1a,short str1b,short str2a,short str2b, - short which_special,unsigned char *stuff_done_val,short where_put) +void PSOE(short which_special,unsigned char *stuff_done_val,short where_put) // if always, stuff_done_val is NULL { short i,j,graphic_num = 0; @@ -2187,8 +2188,9 @@ void general_spec(short which_mode,cSpecial cur_node,short cur_spec_type, } */ +// TODO: What was next_spec_type for? Is it still needed? void oneshot_spec(short which_mode,cSpecial cur_node,short cur_spec_type, - short *next_spec,short *next_spec_type,short *a,short *b,short *redraw) + short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw) { bool check_mess = true,set_sd = true; std::array strs; @@ -2367,8 +2369,9 @@ void oneshot_spec(short which_mode,cSpecial cur_node,short cur_spec_type, } +// TODO: What was next_spec_type for? Is it still needed? void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, - short *next_spec,short *next_spec_type,short *a,short *b,short *redraw) + short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw) { bool check_mess = true; short i,pc = 6,r1; @@ -2602,8 +2605,9 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, } } +// TODO: What was next_spec_type for? Is it still needed? void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, - short *next_spec,short *next_spec_type,short *a,short *b,short *redraw) + short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw) { bool check_mess = false; std::string str1, str2, str3; @@ -2668,7 +2672,7 @@ void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, break; l.x = spec.ex1a; l.y = spec.ex1b; for (i = 0; i < NUM_TOWN_ITEMS; i++) - if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].special_class == spec.ex2a + if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].special_class == (unsigned)spec.ex2a && (l == univ.town.items[i].item_loc)) *next_spec = spec.ex2b; break; @@ -2680,7 +2684,7 @@ void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) for (j = 0; j < 24; j++) - if(univ.party[i].items[j].variety != eItemType::NO_ITEM && univ.party[i].items[j].special_class == spec.ex1a + if(univ.party[i].items[j].variety != eItemType::NO_ITEM && univ.party[i].items[j].special_class == (unsigned)spec.ex1a && (univ.party[i].equip[j] == true)) *next_spec = spec.ex1b; break; @@ -2701,7 +2705,7 @@ void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, break; l.x = spec.ex1a; l.y = spec.ex1b; for (i = 0; i < NUM_TOWN_ITEMS; i++) - if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].special_class == spec.ex2a + if(univ.town.items[i].variety != eItemType::NO_ITEM && univ.town.items[i].special_class == (unsigned)spec.ex2a && (l == univ.town.items[i].item_loc)) { *next_spec = spec.ex2b; *redraw = 1; @@ -2716,7 +2720,7 @@ void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) for (j = 0; j < 24; j++) - if(univ.party[i].items[j].variety != eItemType::NO_ITEM && univ.party[i].items[j].special_class == spec.ex1a + if(univ.party[i].items[j].variety != eItemType::NO_ITEM && univ.party[i].items[j].special_class == (unsigned)spec.ex1a && (univ.party[i].equip[j] == true)) { *next_spec = spec.ex1b; *redraw = 1; @@ -2759,7 +2763,7 @@ void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, break; case SPEC_IF_TEXT_RESPONSE: // text response check_mess = false; - str3 = get_text_response(873,0); + str3 = get_text_response(); j = 1; k = 1; spec.pic = minmax(0,8,spec.pic); get_strs(str1,str2,0,spec.ex1a,spec.ex2a); @@ -2786,8 +2790,9 @@ void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, } } +// TODO: What was next_spec_type for? Is it still needed? void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, - short *next_spec,short *next_spec_type,short *a,short *b,short *redraw) + short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw) { static const char*const stairDlogs[8] = { "basic-stair-up.xml", "basic-stair-down.xml", @@ -3130,8 +3135,9 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, } } +// TODO: What was next_spec_type for? Is it still needed? void rect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, - short *next_spec,short *next_spec_type,short *a,short *b,short *redraw){ + short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw){ bool check_mess = true; short i,j,k; cSpecial spec; @@ -3277,8 +3283,9 @@ void rect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, } } +// TODO: What was next_spec_type for? Is it still needed? void outdoor_spec(short which_mode,cSpecial cur_node,short cur_spec_type, - short *next_spec,short *next_spec_type,short *a,short *b,short *redraw){ + short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw){ bool check_mess = false; std::string str1, str2; cSpecial spec; diff --git a/osx/boe.specials.h b/osx/boe.specials.h index 87e05db5..9bdc0d4f 100644 --- a/osx/boe.specials.h +++ b/osx/boe.specials.h @@ -7,8 +7,7 @@ void use_spec_item(short item); void use_item(short pc,short item); bool use_space(location where); bool adj_town_look(location where); -void PSOE(short str1a,short str1b,short str2a,short str2b, - short which_special,unsigned char *stuff_done_val,short where_put); +void PSOE(short which_special,unsigned char *stuff_done_val,short where_put); bool damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, eDamageType dam_type, short sound_type); void kill_monst(cCreature *which_m,short who_killed); void special_increase_age(); diff --git a/osx/boe.text.h b/osx/boe.text.h index afbb8c7f..e99344d2 100644 --- a/osx/boe.text.h +++ b/osx/boe.text.h @@ -41,7 +41,6 @@ void restore_mode(); void through_sending(); RECT coord_to_rect(short i,short j); void make_cursor_sword() ; -std::string get_str(std::string list, short j); short calc_day(); bool day_reached(unsigned char which_day, unsigned char which_event); void Draw_Some_Item (sf::Texture& src_gworld, RECT src_rect, sf::RenderTarget& targ_gworld, location target, char masked, short main_win); diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index ee300256..4e590beb 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -716,8 +716,7 @@ location end_town_mode(short switching_level,location destination) // returns n } // actually, entry_dir is non zero is town is dead - kludge! -void handle_town_specials(short town_number, short entry_dir,location start_loc) -{ +void handle_town_specials(short /*town_number*/, short entry_dir,location /*start_loc*/) { //if (entry_dir > 0) // run_special(5,2,univ.town.town.spec_on_entry_if_dead,start_loc,&s1,&s2,&s3); @@ -731,8 +730,7 @@ void handle_town_specials(short town_number, short entry_dir,location start_loc) special_queue[0].trigger_time = univ.party.age; // TODO: Simply pushing into slot 0 seems like a bad idea } -void handle_leave_town_specials(short town_number, short which_spec,location start_loc) -{ +void handle_leave_town_specials(short /*town_number*/, short which_spec,location /*start_loc*/) { //run_special(6,2,which_spec,start_loc,&s1,&s2,&s3); special_queue[1].spec = which_spec; @@ -883,7 +881,7 @@ void create_town_combat_terrain() combat_terrain[where.x][where.y] = univ.town->terrain(where.x,where.y); } -void create_out_combat_terrain(short type,short num_walls,short spec_code) +void create_out_combat_terrain(short type,short num_walls,short /*spec_code*/) // spec_code is encounter's spec_code { short i,j,k,r1,ter_type; diff --git a/osx/classes/location.cpp b/osx/classes/location.cpp index 50b7a3ba..31e281d2 100644 --- a/osx/classes/location.cpp +++ b/osx/classes/location.cpp @@ -175,7 +175,7 @@ rectangle rect(location tl, location br){ return rectangle(tl,br); } -rectangle rect(char top, char left, char bottom, char right){ +rectangle rect(int top, int left, int bottom, int right) { return rectangle(top, left, bottom, right); } diff --git a/osx/classes/monster.cpp b/osx/classes/monster.cpp index 67b5ac84..c0b83b83 100644 --- a/osx/classes/monster.cpp +++ b/osx/classes/monster.cpp @@ -130,7 +130,7 @@ cCreature& cCreature::operator = (legacy::creature_data_type old){ return *this; } -cMonster::cAttack::operator int(){ +cMonster::cAttack::operator int() const { return dice * 100 + sides; } @@ -140,7 +140,7 @@ cMonster::cAttack& cMonster::cAttack::operator=(int n){ return *this; } -std::ostream& operator<<(std::ostream& out, cMonster::cAttack& att) { +std::ostream& operator<<(std::ostream& out, const cMonster::cAttack& att) { out << int(att.dice) << 'd' << int(att.sides); return out; } @@ -174,6 +174,7 @@ std::istream& operator >> (std::istream& in, eRace& e){ extern cUniverse univ; extern cScenario scenario; +// TODO: Any setup where "x = x" does something is probably a bad idea... cCreature& cCreature::operator = (const cCreature& other){ // replaces return_monster_template() from boe.monsters.cpp id = other.id; number = other.number; @@ -216,6 +217,8 @@ cMonster::cAbility::operator std::string(){ std::ostringstream sout; short i = 0; switch(abil){ + case MONST_NO_ABIL: + break; case MONST_THROWS_DARTS: sout << "Throws darts (" << extra1 << 'd' << extra2 << ')'; break; @@ -472,7 +475,7 @@ cMonster::cAbility::operator std::string(){ sout << "Unusual ability"; break; } - return "*ERROR INVALID ABILITY*"; + return sout.str(); } std::string cMonster::getAbil1Name() { @@ -496,11 +499,11 @@ bool cMonster::hasAbil(eMonstAbil what, unsigned char* x1, unsigned char* x2){ return false; } -void cMonster::writeTo(std::ostream& file) { +void cMonster::writeTo(std::ostream& /*file*/) { // TODO: Implement this (low priority since only used for exported summons) } -void cMonster::readFrom(std::istream& file) { +void cMonster::readFrom(std::istream& /*file*/) { // TODO: Implement this (low priority since only used for exported summons) } diff --git a/osx/classes/monster.h b/osx/classes/monster.h index 93e1c163..3786ad48 100644 --- a/osx/classes/monster.h +++ b/osx/classes/monster.h @@ -97,7 +97,7 @@ public: struct cAttack{ unsigned char dice, sides, type; // TODO: Remove the need for these operators by changing the code that uses them - operator int(); + operator int() const; cAttack& operator=(int n); }; struct cAbility{ @@ -189,5 +189,5 @@ std::ostream& operator << (std::ostream& out, eRace& e); std::istream& operator >> (std::istream& in, eRace& e); std::ostream& operator << (std::ostream& out, eMonstAbil& e); std::istream& operator >> (std::istream& in, eMonstAbil& e); -std::ostream& operator<<(std::ostream& out, cMonster::cAttack& att); +std::ostream& operator<<(std::ostream& out, const cMonster::cAttack& att); #endif \ No newline at end of file diff --git a/osx/classes/tmpltown.cpp b/osx/classes/tmpltown.cpp index de14695c..90ea199d 100644 --- a/osx/classes/tmpltown.cpp +++ b/osx/classes/tmpltown.cpp @@ -13,15 +13,15 @@ #include "classes.h" -ter_num_t& cBigTemplTown::terrain(size_t x, size_t y){ +ter_num_t& cBigTemplTown::terrain(size_t /*x*/, size_t /*y*/){ return _terrain[0][0]; // TODO: will need to calculate the terrain somehow } -void cBigTemplTown::writeTerrainTo(std::ostream& file) { +void cBigTemplTown::writeTerrainTo(std::ostream& /*file*/) { // TODO: Write out the terrain somehow; } -void cBigTemplTown::readTerrainFrom(std::istream& file) { +void cBigTemplTown::readTerrainFrom(std::istream& /*file*/) { // TODO: Read in the terrain somehow } diff --git a/osx/classes/town.cpp b/osx/classes/town.cpp index c6e6da10..cb07db58 100644 --- a/osx/classes/town.cpp +++ b/osx/classes/town.cpp @@ -14,9 +14,9 @@ #include "classes.h" #include "oldstructs.h" -void cTown::append(legacy::big_tr_type& old){} -void cTown::append(legacy::ave_tr_type& old){} -void cTown::append(legacy::tiny_tr_type& old){} +void cTown::append(legacy::big_tr_type&){} +void cTown::append(legacy::ave_tr_type&){} +void cTown::append(legacy::tiny_tr_type&){} cTown& cTown::operator = (legacy::town_record_type& old){ int i; @@ -82,7 +82,7 @@ cTown& cTown::operator = (legacy::town_record_type& old){ cTown::cTown(){} short max_dim[3] = {64,48,32}; -cTown::cTown(short size){ +cTown::cTown(short){ short i,s; location d_loc(100,0); cTown::cWandering d_wan = {0,0,0,0}; diff --git a/osx/dialogxml/button.cpp b/osx/dialogxml/button.cpp index 0dfc4f23..65a74723 100644 --- a/osx/dialogxml/button.cpp +++ b/osx/dialogxml/button.cpp @@ -22,7 +22,7 @@ extern sf::Texture bg_gworld; -void cButton::attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported){ +void cButton::attachFocusHandler(focus_callback_t) throw(xHandlerNotSupported){ throw xHandlerNotSupported(true); } @@ -30,7 +30,7 @@ void cButton::attachClickHandler(click_callback_t f) throw(){ onClick = f; } -bool cButton::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where){ +bool cButton::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods){ if(onClick) return onClick(me,id,mods); return false; } @@ -95,7 +95,7 @@ short cButton::getFormat(eFormat prop) throw(xUnsupportedProp){ else throw xUnsupportedProp(prop); } -void cButton::setColour(sf::Color clr) throw(xUnsupportedProp) { +void cButton::setColour(sf::Color) throw(xUnsupportedProp) { // TODO: Colour is not supported } @@ -208,7 +208,7 @@ bool cLed::triggerFocusHandler(cDialog& me, std::string id, bool losing){ return true; } -bool cLed::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where){ +bool cLed::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods){ bool result; eLedState oldState = state; if(onClick != NULL) result = onClick(me,id,mods); @@ -337,11 +337,11 @@ bool cLedGroup::handleClick(location where) { return true; } -bool cLedGroup::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where){ +bool cLedGroup::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods){ std::string which_clicked = clicking; clicking = ""; - if(choices[which_clicked]->triggerClickHandler(me,which_clicked,mods,where)){ + if(choices[which_clicked]->triggerClickHandler(me,which_clicked,mods)){ eLedState a, b; if(curSelect.empty()) a = led_off; else { @@ -372,11 +372,11 @@ bool cLedGroup::triggerFocusHandler(cDialog& me, std::string id, bool losingFocu return true; } -void cLedGroup::disable(std::string id) { +void cLedGroup::disable(std::string /*id*/) { // TODO: Implement this } -void cLedGroup::enable(std::string id) { +void cLedGroup::enable(std::string /*id*/) { // TODO: Implement this } @@ -388,7 +388,7 @@ void cLedGroup::hide(std::string id){ choices[id]->hide(); } -void cLedGroup::setFormat(eFormat prop, short val) throw(xUnsupportedProp) { +void cLedGroup::setFormat(eFormat prop, short) throw(xUnsupportedProp) { throw xUnsupportedProp(prop); } @@ -396,7 +396,7 @@ short cLedGroup::getFormat(eFormat prop) throw(xUnsupportedProp) { throw xUnsupportedProp(prop); } -void cLedGroup::setColour(sf::Color clr) throw(xUnsupportedProp) { +void cLedGroup::setColour(sf::Color) throw(xUnsupportedProp) { // TODO: Colour is not supported } diff --git a/osx/dialogxml/button.h b/osx/dialogxml/button.h index 83b2feb5..e30fcd22 100644 --- a/osx/dialogxml/button.h +++ b/osx/dialogxml/button.h @@ -41,7 +41,7 @@ public: static void init(); void attachClickHandler(click_callback_t f) throw(); void attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported); - bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where); + bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods); //virtual void setPict(short pict, short type) = 0; void setFormat(eFormat prop, short val) throw(xUnsupportedProp); short getFormat(eFormat prop) throw(xUnsupportedProp); @@ -76,7 +76,7 @@ public: static void init(); void attachClickHandler(click_callback_t f) throw(); void attachFocusHandler(focus_callback_t f) throw(); - bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where); + bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods); bool triggerFocusHandler(cDialog& me, std::string id, bool losingFocus); void setFormat(eFormat prop, short val) throw(xUnsupportedProp); short getFormat(eFormat prop) throw(xUnsupportedProp); @@ -109,7 +109,7 @@ class cLedGroup : public cControl { public: void attachClickHandler(click_callback_t f) throw(); // activated whenever a click is received, even on the currently active LED void attachFocusHandler(focus_callback_t f) throw(); // activated only when the selection changes - bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where); + bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods); bool triggerFocusHandler(cDialog& me, std::string id, bool losingFocus); void addChoice(cLed* ctrl, std::string key); void disable(std::string id); diff --git a/osx/dialogxml/control.cpp b/osx/dialogxml/control.cpp index 0e488f2f..7518926e 100644 --- a/osx/dialogxml/control.cpp +++ b/osx/dialogxml/control.cpp @@ -178,7 +178,7 @@ void cControl::setActive(bool active) { depressed = active; } -bool cControl::handleClick(location where){ +bool cControl::handleClick(location){ sf::Event e; bool done = false, clicked = false; inWindow->setActive(); @@ -256,11 +256,11 @@ cControl::cControl(eControlType t, cDialog& p) : parent(&p), inWindow(&p.win), t cControl::cControl(eControlType t, sf::RenderWindow& p) : parent(NULL), inWindow(&p), type(t), visible(true), key({false, 0, mod_none}), frameStyle(0) {} -bool cControl::triggerClickHandler(cDialog&, std::string, eKeyMod, location){ +bool cControl::triggerClickHandler(cDialog&, std::string, eKeyMod){ return true; } -bool cControl::triggerFocusHandler(cDialog& me, std::string id, bool losingFocus){ +bool cControl::triggerFocusHandler(cDialog&, std::string, bool){ return true; } diff --git a/osx/dialogxml/control.h b/osx/dialogxml/control.h index 66058f1d..ad4071d2 100644 --- a/osx/dialogxml/control.h +++ b/osx/dialogxml/control.h @@ -75,7 +75,7 @@ public: cKey getAttachedKey(); virtual void attachClickHandler(click_callback_t f) throw(xHandlerNotSupported) = 0; virtual void attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported) = 0; - virtual bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where); + virtual bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods); virtual bool triggerFocusHandler(cDialog& me, std::string id, bool losingFocus); //virtual void setPict(short pict, short type) = 0; virtual void show(); // cd_activate_item true diff --git a/osx/dialogxml/dialog.cpp b/osx/dialogxml/dialog.cpp index 59c901db..74097336 100644 --- a/osx/dialogxml/dialog.cpp +++ b/osx/dialogxml/dialog.cpp @@ -1054,7 +1054,7 @@ void cDialog::run(){ if(kb::isKeyPressed(kb::LShift)) key.mod += mod_shift; if(kb::isKeyPressed(kb::RShift)) key.mod += mod_shift; where = {currentEvent.mouseButton.x, currentEvent.mouseButton.y}; - itemHit = process_click(where, key.mod); + itemHit = process_click(where); break; case sf::Event::MouseMoved: set_cursor(sword_curs); @@ -1065,11 +1065,13 @@ void cDialog::run(){ } } break; + default: // To silence warning of unhandled enum values + break; } if(itemHit.empty()) continue;; ctrlIter ctrl = controls.find(itemHit); // TODO: Should it do something with the boolean return value? - if(ctrl != controls.end()) ctrl->second->triggerClickHandler(*this,itemHit,key.mod,where); + if(ctrl != controls.end()) ctrl->second->triggerClickHandler(*this,itemHit,key.mod); itemHit.clear(); } win.setVisible(false); @@ -1214,7 +1216,7 @@ std::string cDialog::process_keystroke(cKey keyHit){ return ""; } -std::string cDialog::process_click(location where, eKeyMod mods){ +std::string cDialog::process_click(location where){ ctrlIter iter = controls.begin(); while(iter != controls.end()){ if(iter->second->isVisible() && iter->second->isClickable() && where.in(iter->second->getBounds())){ diff --git a/osx/dialogxml/dialog.h b/osx/dialogxml/dialog.h index c87b8b2a..1a97eede 100644 --- a/osx/dialogxml/dialog.h +++ b/osx/dialogxml/dialog.h @@ -74,7 +74,7 @@ public: private: void draw(); std::string process_keystroke(cKey keyHit); - std::string process_click(location where, eKeyMod mods); + std::string process_click(location where); bool dialogNotToast; RECT winRect; std::string defaultButton; diff --git a/osx/dialogxml/dlogutil.cpp b/osx/dialogxml/dlogutil.cpp index ea706077..276b98d0 100644 --- a/osx/dialogxml/dlogutil.cpp +++ b/osx/dialogxml/dlogutil.cpp @@ -53,11 +53,10 @@ cPictChoice::cPictChoice(pic_num_t first, pic_num_t last, ePicType t, cDialog* p } void cPictChoice::attachClickHandlers() { - using namespace std::placeholders; - dlg["left"].attachClickHandler(std::bind(&cPictChoice::onLeft,this,_1,_2)); - dlg["right"].attachClickHandler(std::bind(&cPictChoice::onRight,this,_1,_2)); - dlg["done"].attachClickHandler(std::bind(&cPictChoice::onOkay,this,_1,_2)); - dlg["cancel"].attachClickHandler(std::bind(&cPictChoice::onCancel,this,_1,_2)); + dlg["left"].attachClickHandler(std::bind(&cPictChoice::onLeft,this)); + dlg["right"].attachClickHandler(std::bind(&cPictChoice::onRight,this)); + dlg["done"].attachClickHandler(std::bind(&cPictChoice::onOkay,this)); + dlg["cancel"].attachClickHandler(std::bind(&cPictChoice::onCancel,this)); } cDialog* cPictChoice::operator->() { @@ -81,7 +80,7 @@ pic_num_t cPictChoice::show(pic_num_t fallback, pic_num_t cur_sel){ void cPictChoice::fillPage(){ cLedGroup& group = dynamic_cast(dlg["group"]); group.setSelected(""); // unselect all LEDs, since the currently selected one may be on another page - for(int i = 0; i < per_page; i++){ + for(size_t i = 0; i < per_page; i++){ std::ostringstream sout; sout << "led" << i + 1; if(page * per_page + i >= picts.size()) @@ -100,28 +99,28 @@ void cPictChoice::fillPage(){ } } -bool cPictChoice::onLeft(cDialog& m, std::string ide){ +bool cPictChoice::onLeft(){ if(page == 0) page = (picts.size() - 1) / per_page; else page--; fillPage(); return true; } -bool cPictChoice::onRight(cDialog& me, std::string id){ +bool cPictChoice::onRight(){ if(page == (picts.size() - 1) / per_page) page = 0; else page++; fillPage(); return true; } -bool cPictChoice::onCancel(cDialog& me, std::string id){ - me.toast(); +bool cPictChoice::onCancel(){ + dlg.toast(); return true; } -bool cPictChoice::onOkay(cDialog& me, std::string id){ +bool cPictChoice::onOkay(){ dlg.setResult(picts[cur].first); - me.toast(); + dlg.toast(); return true; } @@ -351,7 +350,7 @@ void cThreeChoice::init_buttons(cBasicButtonType btn1, cBasicButtonType btn2, cB btn->setText(btns[i]->label); btn->setType(btns[i]->type); btn->attachClickHandler(std::bind(&cChoiceDlog::onClick,this,_1,_2)); - switch(type){ + switch(btns[i]->type){ case BTN_HELP: cur_btn_rect.bottom = cur_btn_rect.top + 13; break; @@ -369,7 +368,7 @@ void cThreeChoice::init_buttons(cBasicButtonType btn1, cBasicButtonType btn2, cB default: // in fact, this case should be the only one reachable, ideally cur_btn_rect.bottom = cur_btn_rect.top + 23; } - switch(type){ + switch(btns[i]->type){ case BTN_SM: cur_btn_rect.left = cur_btn_rect.right - 23; break; @@ -469,18 +468,18 @@ cStrDlog::cStrDlog(std::string str1,std::string str2,std::string title,pic_num_t }else if(str2 != "") dlg["str1"].setText(str2); if(title != "") dlg["title"].setText(title); dlg["record"].hide(); - dlg["record"].attachClickHandler(std::bind(&cStrDlog::onRecord, this, _1, _2)); - dlg["done"].attachClickHandler(std::bind(&cStrDlog::onDismiss, this, _1, _2)); + dlg["record"].attachClickHandler(std::bind(&cStrDlog::onRecord, this, _2)); + dlg["done"].attachClickHandler(std::bind(&cStrDlog::onDismiss, this)); } -bool cStrDlog::onRecord(cDialog& me, std::string id){ - if(hasRecord) rec_f(me); - else me[id].hide(); +bool cStrDlog::onRecord(std::string id){ + if(hasRecord) rec_f(dlg); + else dlg[id].hide(); return hasRecord; } -bool cStrDlog::onDismiss(cDialog& me, std::string id){ - me.toast(); +bool cStrDlog::onDismiss(){ + dlg.toast(); return true; } diff --git a/osx/dialogxml/dlogutil.h b/osx/dialogxml/dlogutil.h index 532cb4a7..0455ef13 100644 --- a/osx/dialogxml/dlogutil.h +++ b/osx/dialogxml/dlogutil.h @@ -29,8 +29,8 @@ class cStrDlog { record_callback_t rec_f; bool hasRecord; const ePicType type; - bool onRecord(cDialog& me, std::string id); - bool onDismiss(cDialog& me, std::string id); + bool onRecord(std::string id); + bool onDismiss(); public: cStrDlog(std::string str1,std::string str2,std::string title,pic_num_t pic,ePicType t,cDialog* parent = NULL); cStrDlog& setSound(snd_num_t num); @@ -104,10 +104,10 @@ class cPictChoice { static const size_t per_page; cDialog dlg; void attachClickHandlers(); - bool onLeft(cDialog& me, std::string id); - bool onRight(cDialog& me, std::string id); - bool onCancel(cDialog& me, std::string id); - bool onOkay(cDialog& me, std::string id); + bool onLeft(); + bool onRight(); + bool onCancel(); + bool onOkay(); void fillPage(); std::vector> picts; size_t page, cur; diff --git a/osx/dialogxml/field.cpp b/osx/dialogxml/field.cpp index 80446c6b..2143c2b3 100644 --- a/osx/dialogxml/field.cpp +++ b/osx/dialogxml/field.cpp @@ -11,7 +11,7 @@ #include "dialog.h" #include "graphtool.h" -void cTextField::attachClickHandler(click_callback_t f) throw(xHandlerNotSupported){ +void cTextField::attachClickHandler(click_callback_t) throw(xHandlerNotSupported){ throw xHandlerNotSupported(false); } @@ -29,7 +29,7 @@ bool cTextField::triggerFocusHandler(cDialog& me, std::string id, bool losingFoc return passed; } -void cTextField::setFormat(eFormat prop, short val) throw(xUnsupportedProp){ +void cTextField::setFormat(eFormat prop, short) throw(xUnsupportedProp){ throw xUnsupportedProp(prop); } @@ -162,7 +162,7 @@ void cTextField::handleInput(cKey key) { bool select = mod_contains(key.mod, mod_shift); bool word = mod_contains(key.mod, mod_alt) || mod_contains(key.mod, mod_ctrl); bool haveSelection = insertionPoint != selectionPoint; - int new_ip; + size_t new_ip; std::string contents = getText(); if(!key.spec) { if(haveSelection) { diff --git a/osx/dialogxml/message.cpp b/osx/dialogxml/message.cpp index e5efada5..4106a59e 100644 --- a/osx/dialogxml/message.cpp +++ b/osx/dialogxml/message.cpp @@ -18,16 +18,16 @@ void cTextMsg::attachClickHandler(click_callback_t f) throw(){ clickable = onClick != NULL; } -void cTextMsg::attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported){ +void cTextMsg::attachFocusHandler(focus_callback_t) throw(xHandlerNotSupported){ throw xHandlerNotSupported(true); } -bool cTextMsg::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where){ +bool cTextMsg::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods){ if(onClick != NULL) return onClick(me,id,mods); return false; } -void cTextMsg::setColour(sf::Color clr) { +void cTextMsg::setColour(sf::Color clr) throw(xUnsupportedProp) { color = clr; } @@ -53,7 +53,7 @@ void cTextMsg::setFormat(eFormat prop, short val) throw(xUnsupportedProp){ } } -sf::Color cTextMsg::getColour() { +sf::Color cTextMsg::getColour() throw(xUnsupportedProp) { return color; } diff --git a/osx/dialogxml/message.h b/osx/dialogxml/message.h index 984b5966..13eaee9d 100644 --- a/osx/dialogxml/message.h +++ b/osx/dialogxml/message.h @@ -19,7 +19,7 @@ class cTextMsg : public cControl { public: void attachClickHandler(click_callback_t f) throw(); void attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported); - bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where); + bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods); void setFormat(eFormat prop, short val) throw(xUnsupportedProp); short getFormat(eFormat prop) throw(xUnsupportedProp); void setColour(sf::Color clr) throw(xUnsupportedProp); diff --git a/osx/dialogxml/pict.cpp b/osx/dialogxml/pict.cpp index b45ad327..5e22e56e 100644 --- a/osx/dialogxml/pict.cpp +++ b/osx/dialogxml/pict.cpp @@ -76,11 +76,11 @@ void cPict::attachClickHandler(click_callback_t f) throw(){ } } -void cPict::attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported){ +void cPict::attachFocusHandler(focus_callback_t) throw(xHandlerNotSupported){ throw xHandlerNotSupported(true); } -bool cPict::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where){ +bool cPict::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods){ if(onClick != NULL) return onClick(me,id,mods); else return false; } @@ -96,7 +96,7 @@ short cPict::getFormat(eFormat prop) throw(xUnsupportedProp){ else throw xUnsupportedProp(prop); } -void cPict::setColour(sf::Color clr) throw(xUnsupportedProp) { +void cPict::setColour(sf::Color) throw(xUnsupportedProp) { // TODO: Colour is not supported } @@ -419,11 +419,17 @@ ePicType& operator-= (ePicType& lhs, ePicTypeMod rhs){ return lhs = lhs - rhs; } +bool operator& (ePicType lhs, ePicTypeMod rhs) { + return lhs == (lhs + PIC_PRESET) + rhs; +} + short cPict::animFrame = 0; std::shared_ptr cPict::getSheet(eSheetType type, size_t n) { std::ostringstream sout; switch(type) { + case NUM_SHEET_TYPES: + break; case SHEET_TER: sout << "ter" << n + 1; break; diff --git a/osx/dialogxml/pict.h b/osx/dialogxml/pict.h index ab09cb8b..19c26578 100644 --- a/osx/dialogxml/pict.h +++ b/osx/dialogxml/pict.h @@ -98,7 +98,7 @@ public: static void init(); void attachClickHandler(click_callback_t f) throw(); void attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported); - bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where); + bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods); void setFormat(eFormat prop, short val) throw(xUnsupportedProp); short getFormat(eFormat prop) throw(xUnsupportedProp); void setColour(sf::Color clr) throw(xUnsupportedProp); @@ -170,5 +170,6 @@ ePicType operator + (ePicTypeMod lhs, ePicType rhs); ePicType operator - (ePicTypeMod lhs, ePicType rhs); ePicType&operator +=(ePicType&lhs, ePicTypeMod rhs); ePicType&operator -=(ePicType&lhs, ePicTypeMod rhs); +bool operator& (ePicType lhs, ePicTypeMod rhs); #endif diff --git a/osx/dialogxml/scrollbar.cpp b/osx/dialogxml/scrollbar.cpp index b5f61c73..13a6afac 100644 --- a/osx/dialogxml/scrollbar.cpp +++ b/osx/dialogxml/scrollbar.cpp @@ -53,11 +53,11 @@ void cScrollbar::attachClickHandler(click_callback_t f) throw(xHandlerNotSupport onClick = f; } -void cScrollbar::attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported) { +void cScrollbar::attachFocusHandler(focus_callback_t) throw(xHandlerNotSupported) { throw xHandlerNotSupported(true); } -bool cScrollbar::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where) { +bool cScrollbar::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods) { // TODO: Implement detection of scrolling stuff, maybe even dragging the thumb if(onClick != NULL) return onClick(me,id,mods); return false; @@ -131,7 +131,7 @@ bool cScrollbar::handleClick(location where) { return clicked; } -void cScrollbar::setFormat(eFormat prop, short val) throw(xUnsupportedProp) { +void cScrollbar::setFormat(eFormat prop, short) throw(xUnsupportedProp) { throw xUnsupportedProp(prop); } @@ -139,7 +139,7 @@ short cScrollbar::getFormat(eFormat prop) throw(xUnsupportedProp) { throw xUnsupportedProp(prop); } -void cScrollbar::setColour(sf::Color clr) throw(xUnsupportedProp) { +void cScrollbar::setColour(sf::Color) throw(xUnsupportedProp) { // TODO: Colour is unsupported } diff --git a/osx/dialogxml/scrollbar.h b/osx/dialogxml/scrollbar.h index 5c4d2e22..ab9c6a21 100644 --- a/osx/dialogxml/scrollbar.h +++ b/osx/dialogxml/scrollbar.h @@ -28,7 +28,7 @@ public: explicit cScrollbar(cDialog& parent); void attachClickHandler(click_callback_t f) throw(xHandlerNotSupported); void attachFocusHandler(focus_callback_t f) throw(xHandlerNotSupported); - bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods, location where); + bool triggerClickHandler(cDialog& me, std::string id, eKeyMod mods); bool handleClick(location where); void setFormat(eFormat prop, short val) throw(xUnsupportedProp); short getFormat(eFormat prop) throw(xUnsupportedProp); diff --git a/osx/oldstructs.cpp b/osx/oldstructs.cpp index c4fb8152..f1185823 100644 --- a/osx/oldstructs.cpp +++ b/osx/oldstructs.cpp @@ -19,6 +19,7 @@ using namespace legacy; << offsetof(what,member) << std::endl // This is just a function to output all known information about each struct and its members. +void debug_oldstructs(); // Suppress "no prototype" warning void debug_oldstructs() { char cwd[256]; getcwd(cwd, 256); diff --git a/osx/pcedit/pc.action.cpp b/osx/pcedit/pc.action.cpp index 5287550d..ff62d9bd 100644 --- a/osx/pcedit/pc.action.cpp +++ b/osx/pcedit/pc.action.cpp @@ -50,17 +50,15 @@ extern RECT pc_race_rect; extern RECT edit_rect[5][2]; -short store_trait_mode; //extern RECT pc_area_buttons[6][6] ; // 0 - whole 1 - pic 2 - name 3 - stat strs 4,5 - later //extern RECT item_string_rects[24][4]; // 0 - name 1 - drop 2 - id 3 - -bool handle_action(sf::Event event,short mode) +bool handle_action(sf::Event event) //short mode; // ignore, { short i; location the_point; - short choice = 4; bool to_return = false; @@ -88,7 +86,7 @@ bool handle_action(sf::Event event,short mode) display_pc(current_active_pc,1,NULL); break; case 2: - pick_race_abil(&univ.party[current_active_pc],0,NULL); + pick_race_abil(&univ.party[current_active_pc],0); break; case 3: spend_xp(current_active_pc,1,NULL); @@ -115,9 +113,8 @@ bool handle_action(sf::Event event,short mode) return to_return; } -void flash_rect(RECT to_flash) +void flash_rect(RECT /*to_flash*/) { - unsigned long dummy; // TODO: Think of a good way to do this //InvertRect (&to_flash); @@ -125,7 +122,7 @@ void flash_rect(RECT to_flash) sf::sleep(time_in_ticks(5)); } -static bool get_num_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) +static bool get_num_event_filter(cDialog& me, std::string, eKeyMod) { me.toast(); me.setResult(me["number"].getTextAsNum()); @@ -136,8 +133,6 @@ void edit_gold_or_food(short which_to_edit) //0 - gold 1 - food { - short item_hit; - char sign_text[256]; location view_loc; store_which_to_edit = which_to_edit; @@ -161,8 +156,6 @@ void edit_gold_or_food(short which_to_edit) void edit_day() { - short item_hit; - char sign_text[256]; location view_loc; @@ -210,7 +203,7 @@ void combine_things(short pc_num) } } -bool give_to_pc(short pc_num,cItemRec item, short print_result) +bool give_to_pc(short pc_num,cItemRec item, short /*print_result*/) { short free_space; @@ -238,12 +231,12 @@ bool give_to_party(cItemRec item,short print_result) return false; } -void give_gold(short amount,bool print_result) +void give_gold(short amount,bool /*print_result*/) { univ.party.gold = univ.party.gold + amount; } -bool take_gold(short amount,bool print_result) +bool take_gold(short amount,bool /*print_result*/) { if (univ.party.gold < amount) return false; diff --git a/osx/pcedit/pc.action.h b/osx/pcedit/pc.action.h index 054161b7..d2c91afd 100644 --- a/osx/pcedit/pc.action.h +++ b/osx/pcedit/pc.action.h @@ -2,7 +2,7 @@ #include #include "dialog.h" -bool handle_action(sf::Event event,short mode); +bool handle_action(sf::Event event); void flash_rect(RECT to_flash); void edit_gold_or_food(short which_to_edit); void display_pc(short pc_num,short mode,cDialog* parent); diff --git a/osx/pcedit/pc.appleevents.mm b/osx/pcedit/pc.appleevents.mm index 15a57ca5..4dfb5079 100644 --- a/osx/pcedit/pc.appleevents.mm +++ b/osx/pcedit/pc.appleevents.mm @@ -18,6 +18,7 @@ typedef NSAppleEventDescriptor AEDescr; -(void)handleQuit:(AEDescr*)theAppleEvent withReply: (AEDescr*)reply; @end +void set_up_apple_events(); // Suppress "no prototype" warning void set_up_apple_events() { AppleEventHandler* aeHandler = [[AppleEventHandler alloc] init]; NSAppleEventManager* AEmgr = [NSAppleEventManager sharedAppleEventManager]; @@ -29,9 +30,13 @@ void set_up_apple_events() { @implementation AppleEventHandler -(void)handleOpenDoc:(AEDescr*)theAppleEvent withReply: (AEDescr*)reply { + (void) theAppleEvent; // Suppress "unused parameter" warning + (void) reply; // TODO: Handle this } -(void)handleQuit:(AEDescr*)theAppleEvent withReply: (AEDescr*)reply { + (void) theAppleEvent; // Suppress "unused parameter" warning + (void) reply; All_Done = verify_restore_quit(0); } @end diff --git a/osx/pcedit/pc.editors.cpp b/osx/pcedit/pc.editors.cpp index 48c8fb33..db90117b 100644 --- a/osx/pcedit/pc.editors.cpp +++ b/osx/pcedit/pc.editors.cpp @@ -10,7 +10,20 @@ #include "dlogutil.h" #include -extern std::string get_str(std::string, short); +/* + * These three are not declared in any included header. + * Instead they are declared in pc.actions.h, which is not + * included here because it contains additional functions that + * should not be available to the game (which also includes + * this file). + * + * For the game's purposes, these are declared in + * boe.infodlg.h and boe.party.h. + */ +void display_pc(short pc_num,short mode,cDialog* parent); +void display_alchemy(bool allowEdit); +bool spend_xp(short pc_num, short mode, cDialog* parent); +// TODO: There's probably a more logical way of arranging this /* Adventure globals */ //extern party_record_type party; @@ -34,7 +47,6 @@ extern short d_rect_index[80]; extern bool diff_depth_ok,current_file_has_maps; bool choice_active[6]; -extern short store_trait_mode; extern short which_pc_displayed; cPlayer *store_pc; sf::Texture button_num_gworld; @@ -68,8 +80,7 @@ short store_skills[20],store_h,store_sp,i,store_skp,which_skill; long store_g; short store_train_mode,store_train_pc; -static bool select_pc_event_filter (cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool select_pc_event_filter (cDialog& me, std::string item_hit, eKeyMod) { me.toast(); if(item_hit != "cancel") { short which_pc = item_hit[item_hit.length() - 1] - '1'; @@ -128,8 +139,7 @@ static short party_total_level() return j; } -static void put_pc_spells(cDialog& me) -{ +static void put_pc_spells(cDialog& me, const short store_trait_mode) { short i; for (i = 0; i < 62; i++) { @@ -144,8 +154,7 @@ static void put_pc_spells(cDialog& me) me["who"].setText(univ.party[which_pc_displayed].name.c_str()); } -static bool display_pc_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool display_pc_event_filter(cDialog& me, std::string item_hit, const short trait_mode) { short pc_num; pc_num = which_pc_displayed; @@ -156,19 +165,19 @@ static bool display_pc_event_filter(cDialog& me, std::string item_hit, eKeyMod m pc_num = (pc_num == 0) ? 5 : pc_num - 1; } while(univ.party[pc_num].main_status == eMainStatus::ABSENT); which_pc_displayed = pc_num; - put_pc_spells(me); + put_pc_spells(me, trait_mode); } else if(item_hit == "right") { do { pc_num = (pc_num == 5) ? 0 : pc_num + 1; } while(univ.party[pc_num].main_status == eMainStatus::ABSENT); which_pc_displayed = pc_num; - put_pc_spells(me); + put_pc_spells(me, trait_mode); } return true; } -void display_pc(short pc_num,short mode,cDialog* parent) -{ +void display_pc(short pc_num,short mode, cDialog* parent) { + using namespace std::placeholders; short i; std::string label_str; @@ -178,19 +187,18 @@ void display_pc(short pc_num,short mode,cDialog* parent) break; } which_pc_displayed = pc_num; - store_trait_mode = mode; make_cursor_sword(); cDialog pcInfo("pc-spell-info.xml", parent); - pcInfo.attachClickHandlers(display_pc_event_filter,{"done","left","right"}); + pcInfo.attachClickHandlers(std::bind(display_pc_event_filter, _1, _2, mode),{"done","left","right"}); for (i = 0; i < 62; i++) { std::string id = "spell" + boost::lexical_cast(i + 1); label_str = get_str((mode == 0) ? "mage-spells" : "priest-spells",i * 2 + 1); pcInfo[id].setText(label_str); } - put_pc_spells(pcInfo); + put_pc_spells(pcInfo, mode); dynamic_cast(pcInfo["pic"]).setPict(14 + mode,PIC_DLOG); @@ -216,13 +224,13 @@ static void display_traits_graphics(cDialog& me) me["xp"].setTextToNum(store); } -static bool pick_race_abil_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) { +static bool pick_race_abil_event_filter(cDialog& me, std::string, eKeyMod) { me.toast(); return true; } -static bool pick_race_select_led(cDialog& me, std::string item_hit, bool losing) -{ +static bool pick_race_select_led(cDialog& me, std::string item_hit, bool losing, const short store_trait_mode) { + if(losing) return true; std::string abil_str; cPlayer *pc; @@ -258,21 +266,22 @@ static bool pick_race_select_led(cDialog& me, std::string item_hit, bool losing) return store_trait_mode == 0; } -void pick_race_abil(cPlayer *pc,short mode,cDialog* parent) +void pick_race_abil(cPlayer *pc,short mode) //mode; // 0 - edit 1 - just display 2 - can't change race { + 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."; - store_trait_mode = mode; store_pc = pc; make_cursor_sword(); cDialog pickAbil("pick-race-abil.xml"); pickAbil["done"].attachClickHandler(pick_race_abil_event_filter); - pickAbil.attachFocusHandlers(pick_race_select_led, {"race", "bad1", "bad2", "bad3", "bad4", "bad5"}); - pickAbil.attachFocusHandlers(pick_race_select_led, {"good1", "good2", "good3", "good4", "good5"}); - pickAbil.attachFocusHandlers(pick_race_select_led, {"good6", "good7", "good8", "good9", "good10"}); + auto led_selector = std::bind(pick_race_select_led, _1, _2, _3, mode); + pickAbil.attachFocusHandlers(led_selector, {"race", "bad1", "bad2", "bad3", "bad4", "bad5"}); + pickAbil.attachFocusHandlers(led_selector, {"good1", "good2", "good3", "good4", "good5"}); + pickAbil.attachFocusHandlers(led_selector, {"good6", "good7", "good8", "good9", "good10"}); display_traits_graphics(pickAbil); if (mode == 1) @@ -399,8 +408,7 @@ static void do_xp_draw(cDialog& me) update_gold_skills(me); } -static bool spend_xp_navigate_filter(cDialog& me, std::string item_hit, eKeyMod mods) -{ +static bool spend_xp_navigate_filter(cDialog& me, std::string item_hit, eKeyMod) { short mode,pc_num; bool talk_done = false; @@ -513,7 +521,7 @@ static bool spend_xp_event_filter(cDialog& me, std::string item_hit, eKeyMod mod draw_xp_skills(me); } else { for(int i = 0; i < 19; i++) { - int n = strlen(skill_ids[i]); + size_t n = strlen(skill_ids[i]); if(item_hit.length() < n + 2) continue; if(item_hit.substr(0, item_hit.length() - 2) == skill_ids[i]) { which_skill = i; diff --git a/osx/pcedit/pc.editors.h b/osx/pcedit/pc.editors.h index 9e3cb5b5..eedd1129 100644 --- a/osx/pcedit/pc.editors.h +++ b/osx/pcedit/pc.editors.h @@ -6,9 +6,9 @@ void give_gold(short amount,bool print_result); bool take_gold(short amount,bool print_result); short pc_has_space(short pc_num); void take_item(short pc_num,short which_item); -short char_select_pc(short active_only,short free_inv_only,char *title); +short char_select_pc(short active_only,short free_inv_only,const char *title); short select_pc(short active_only,short free_inv_only); void give_spec_items(); -void pick_race_abil(cPlayer *pc,short mode,class cDialog* parent_num); +void pick_race_abil(cPlayer *pc,short mode); void reset_boats(); void combine_things(short pc_num); diff --git a/osx/pcedit/pc.graphics.cpp b/osx/pcedit/pc.graphics.cpp index 555d0d7e..3fccadea 100644 --- a/osx/pcedit/pc.graphics.cpp +++ b/osx/pcedit/pc.graphics.cpp @@ -13,8 +13,6 @@ #include "message.h" #include "mathutil.h" -extern std::string get_str(std::string, short); - extern cUniverse univ; extern sf::RenderWindow mainPtr; @@ -229,7 +227,6 @@ void init_main_buttons() void Set_up_win () { - short i; title_gworld.loadFromImage(*ResMgr::get("pcedtitle")); invenbtn_gworld.loadFromImage(*ResMgr::get("invenbtns")); status_gworld.loadFromImage(*ResMgr::get("staticons")); @@ -326,9 +323,9 @@ void draw_main_screen() } -void do_button_action(short which_pc,short which_button) +// TODO: Not quite sure what the first parameter is for +void do_button_action(short /*which_pc*/,short which_button) { - unsigned long dummy; current_pressed_button = which_button; redraw_screen(); diff --git a/osx/pcedit/pc.main.cpp b/osx/pcedit/pc.main.cpp index 88828556..073934c5 100644 --- a/osx/pcedit/pc.main.cpp +++ b/osx/pcedit/pc.main.cpp @@ -17,8 +17,6 @@ #include "winutil.h" #include "cursors.h" -extern std::string get_str(std::string, short); - cUniverse univ; RECT pc_area_buttons[6][4] ; // 0 - whole 1 - pic 2 - name 3 - stat strs 4,5 - later @@ -102,7 +100,7 @@ cScenario scenario; // //MW specified return type was 'void', changed to ISO C style for Carbonisation -jmr -int main(int argc, char* argv[]) { +int main(int /*argc*/, char* argv[]) { init_menubar(); init_directories(argv[0]); Initialize(); @@ -175,6 +173,9 @@ void Handle_One_Event() case sf::Event::Closed: All_Done = verify_restore_quit(false); break; + + default: + break; } } @@ -182,7 +183,7 @@ void Mouse_Pressed() { bool try_to_end; - try_to_end = handle_action(event,0); + try_to_end = handle_action(event); if (try_to_end == true) All_Done = verify_restore_quit(false); } @@ -334,7 +335,7 @@ void handle_extra_menu(int item_hit) void handle_edit_menu(int item_hit) { - short choice,i,j,k; + short i,j,k; if(file_in_mem.empty()) { display_strings(5,7); @@ -383,7 +384,7 @@ void handle_edit_menu(int item_hit) display_pc(current_active_pc,1,0); break; case 11: - pick_race_abil(&univ.party[current_active_pc],0,0); + pick_race_abil(&univ.party[current_active_pc],0); break; case 12: spend_xp(current_active_pc,1,0); @@ -449,7 +450,6 @@ void handle_edit_menu(int item_hit) // TODO: Let this take the item directly instead of the index void handle_item_menu(int item_hit) { - short choice; cItemRec store_i; if(file_in_mem.empty()) { diff --git a/osx/pcedit/pc.menus.mac.mm b/osx/pcedit/pc.menus.mac.mm index 66a7a15a..4d0d52a5 100644 --- a/osx/pcedit/pc.menus.mac.mm +++ b/osx/pcedit/pc.menus.mac.mm @@ -123,6 +123,7 @@ void update_item_menu() { -(void) itemMenu:(id) sender { ItemWrapper* item = [sender representedObject]; cItemRec& theItem = [item item]; + (void) theItem; // Suppress "unused parameter" warning for(int i = 0; i < 4; i++) { int whichItem = [items_menu[i] indexOfItem: sender]; if(whichItem >= 0) diff --git a/osx/scenedit/scen.actions.cpp b/osx/scenedit/scen.actions.cpp index 9bb520b4..ea942f9f 100644 --- a/osx/scenedit/scen.actions.cpp +++ b/osx/scenedit/scen.actions.cpp @@ -11,6 +11,7 @@ #include "scen.fileio.h" #include "scen.keydlgs.h" #include "scen.townout.h" +#include "scen.menus.h" #include "mathutil.h" #include "fileio.h" //#include "scen.locutils.h" @@ -115,7 +116,6 @@ ter_num_t current_ground = 0; short special_to_paste = -1; -extern std::string get_str(std::string list, short j); bool monst_on_space(location loc,short m_num); void init_current_terrain() { @@ -144,7 +144,7 @@ void init_screen_locs() { } } -bool handle_action(location the_point,sf::Event event) { +bool handle_action(location the_point,sf::Event /*event*/) { using kb = sf::Keyboard; short i,j, x; bool are_done = false; @@ -156,7 +156,6 @@ bool handle_action(location the_point,sf::Event event) { short right_top,right_hit; eScenMode old_mode; RECT temp_rect; - unsigned long dummy; //printf("Handling click at {v = %i,h = %i}\n",the_point.v,the_point.h); //GlobalToLocal(&the_point); if(kb::isKeyPressed(kb::LAlt) || kb::isKeyPressed(kb::RAlt)) @@ -326,7 +325,7 @@ bool handle_action(location the_point,sf::Event event) { if (option_hit == true) { scenario.scen_specials[j] = null_spec_node; } - else edit_spec_enc(j,0,0); + else edit_spec_enc(j,0); //get_str(s2,22,scenario.scen_specials[j].type + 1); //sprintf((char *) str,"%d - %-30.30s",j,(char *) s2); //set_rb(j,4000 + j,(char *) str,0); @@ -336,7 +335,7 @@ bool handle_action(location the_point,sf::Event event) { if (option_hit == true) { current_terrain.specials[j] = null_spec_node; } - else edit_spec_enc(j,1,0); + else edit_spec_enc(j,1); //get_str(s2,22,current_terrain.specials[j].type + 1); //sprintf((char *) str,"%d - %-30.30s",j,(char *) s2); //set_rb(j,5000 + j,(char *) str,0); @@ -346,7 +345,7 @@ bool handle_action(location the_point,sf::Event event) { if (option_hit == true) { town->specials[j] = null_spec_node; } - else edit_spec_enc(j,2,0); + else edit_spec_enc(j,2); //get_str(s2,22,town.specials[j].type + 1); //sprintf((char *) str,"%d - %-30.30s",j,(char *) s2); //set_rb(j,6000 + j,(char *) str,0); @@ -890,6 +889,14 @@ bool handle_action(location the_point,sf::Event event) { set_cursor(wand_curs); overall_mode = MODE_DRAWING; break; + case MODE_SET_TOWN_START: // TODO: Implement this + break; + case MODE_PLACE_STONE_BLOCK: // TODO: Implement this + break; + case MODE_INTRO_SCREEN: + case MODE_EDIT_TYPES: + case MODE_MAIN_SCREEN: + break; // Nothing to do here, of course. } if ((overall_mode == MODE_DRAWING) && (old_mode != MODE_DRAWING)) set_string("Drawing mode",(char*)scenario.ter_types[current_terrain_type].name.c_str()); @@ -1244,8 +1251,7 @@ bool handle_action(location the_point,sf::Event event) { } -void flash_rect(RECT to_flash) { - unsigned long dummy; +void flash_rect(RECT /*to_flash*/) { // TODO: Determine a good way to do this // InvertRect (&to_flash); play_sound(37); @@ -1771,7 +1777,7 @@ void unfrill_terrain() { draw_terrain(); } -ter_num_t find_object_part(unsigned char num, unsigned char x, unsigned char y, ter_num_t fallback){ +static ter_num_t find_object_part(unsigned char num, unsigned char x, unsigned char y, ter_num_t fallback){ for(int i = 0; i < 256; i++){ if(scenario.ter_types[i].obj_num == num && scenario.ter_types[i].obj_pos.x == x && @@ -2910,7 +2916,7 @@ void place_edit_special(location loc) { if (editing_town == true) { for (i = 0; i < 50; i++) if ((town->special_locs[i].x == loc.x) && (town->special_locs[i].y == loc.y)) { - edit_spec_enc(town->spec_id[i],2,0); + edit_spec_enc(town->spec_id[i],2); i = 500; } if (i < 500) { // new special @@ -2923,7 +2929,7 @@ void place_edit_special(location loc) { if (town->special_locs[i].x == 100) { town->special_locs[i] = loc; town->spec_id[i] = spec; - edit_spec_enc(spec,2,0); + edit_spec_enc(spec,2); if (town->specials[spec].pic < 0) town->special_locs[i].x = 100; @@ -2943,7 +2949,7 @@ void place_edit_special(location loc) { } for (i = 0; i < 18; i++) if ((current_terrain.special_locs[i].x == loc.x) && (current_terrain.special_locs[i].y == loc.y)) { - edit_spec_enc(current_terrain.special_id[i],1,0); + edit_spec_enc(current_terrain.special_id[i],1); i = 500; } if (i < 500) { // new special @@ -2956,7 +2962,7 @@ void place_edit_special(location loc) { if (current_terrain.special_locs[i].x == 100) { current_terrain.special_locs[i] = loc; current_terrain.special_id[i] = spec; - edit_spec_enc(spec,1,0); + edit_spec_enc(spec,1); if (current_terrain.specials[spec].pic < 0) current_terrain.special_locs[i].x = 100; diff --git a/osx/scenedit/scen.actions.h b/osx/scenedit/scen.actions.h index 66d0caf6..bec7f02f 100644 --- a/osx/scenedit/scen.actions.h +++ b/osx/scenedit/scen.actions.h @@ -47,7 +47,6 @@ void set_up_start_screen(); void set_up_main_screen(); void start_town_edit(); void start_out_edit(); -void shut_down_menus(short mode); void start_terrain_editing(); void start_monster_editing(short just_redo_text); void start_item_editing(short just_redo_text); @@ -62,7 +61,6 @@ bool monst_on_space(location loc,short m_num); void place_edit_special(location loc); void set_special(location spot_hit); bool save_check(std::string which_dlog); -void update_item_menu(); ter_num_t get_ground_from_ter(ter_num_t ter); bool terrain_matches(unsigned char x, unsigned char y, ter_num_t ter); diff --git a/osx/scenedit/scen.core.cpp b/osx/scenedit/scen.core.cpp index 1fe638bc..b63f6360 100644 --- a/osx/scenedit/scen.core.cpp +++ b/osx/scenedit/scen.core.cpp @@ -18,7 +18,6 @@ #include "field.h" #include "restypes.hpp" -extern std::string get_str(std::string list, short j); extern short cen_x, cen_y,/* overall_mode,*/cur_town; extern bool mouse_button_held; extern short cur_viewing_mode; @@ -41,7 +40,6 @@ void init_scenario() { cVehicle null_boat;// = {{0,0},{0,0},{0,0},-1,false,false}; cVehicle null_horse;// = {{0,0},{0,0},{0,0},-1,false,false}; cScenario::cItemStorage null_item_s;// ={-1,{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},{0,0,0,0,0,0,0,0,0,0},0}; - short j; scenario.format.ver[0] = 1; scenario.format.ver[1] = 0; @@ -123,9 +121,7 @@ void init_scenario() { } } -bool save_ter_info(cDialog& me, cTerrain& store_ter) { - char str[256]; - short i; +static bool save_ter_info(cDialog& me, cTerrain& store_ter) { store_ter.picture = me["pict"].getTextAsNum(); // TODO: Should somehow verify the pict number is valid @@ -205,7 +201,7 @@ bool save_ter_info(cDialog& me, cTerrain& store_ter) { } // TODO: It would probably be good to use these for other dialogs, instead of the monolithic event filters -bool check_range_msg(cDialog& me,std::string id,bool losing,long min_val,long max_val,std::string fld_name,std::string xtra){ +static bool check_range_msg(cDialog& me,std::string id,bool losing,long min_val,long max_val,std::string fld_name,std::string xtra){ if(!losing) return true; cTextField& fld_ctrl = dynamic_cast(me[id]); long n = fld_ctrl.getTextAsNum(); @@ -219,11 +215,11 @@ bool check_range_msg(cDialog& me,std::string id,bool losing,long min_val,long ma return true; } -bool check_range(cDialog& me,std::string id,bool losing,long min_val,long max_val,std::string fld_name) { +static bool check_range(cDialog& me,std::string id,bool losing,long min_val,long max_val,std::string fld_name) { return check_range_msg(me, id, losing, min_val, max_val, fld_name, ""); } -bool pick_picture(ePicType type, cDialog& parent, std::string result_fld, std::string pic_fld, pic_num_t modifier){ +static bool pick_picture(ePicType type, cDialog& parent, std::string result_fld, std::string pic_fld, pic_num_t modifier){ pic_num_t cur_sel = 0; if(result_fld != ""){ cControl& fld_ctrl = parent[result_fld]; @@ -248,7 +244,7 @@ bool pick_picture(ePicType type, cDialog& parent, std::string result_fld, std::s return true; } -bool pick_string(std::string from_file, cDialog& parent, std::string result_fld, std::string str_fld){ +static bool pick_string(std::string from_file, cDialog& parent, std::string result_fld, std::string str_fld){ size_t cur_sel = 0; if(result_fld != ""){ cTextField& fld_ctrl = dynamic_cast(parent[result_fld]); @@ -270,14 +266,14 @@ bool pick_string(std::string from_file, cDialog& parent, std::string result_fld, return true; } -bool show_help(std::string from_file, cDialog& parent, pic_num_t pic){ +static bool show_help(std::string from_file, cDialog& parent, pic_num_t pic){ StringRsrc strings = *ResMgr::get(from_file); cThreeChoice help(strings,basic_buttons[63],pic,PIC_DLOG,&parent); help.show(); return true; } -bool fill_ter_flag_info(cDialog& me, std::string id, bool dummy){ +static bool fill_ter_flag_info(cDialog& me, std::string id, bool){ eTerSpec prop; cLedGroup& led_ctrl = dynamic_cast(me[id]); std::istringstream sel(led_ctrl.getSelected().substr(4)); @@ -297,7 +293,7 @@ bool fill_ter_flag_info(cDialog& me, std::string id, bool dummy){ return true; } -void fill_ter_info(cDialog& me, short ter){ +static void fill_ter_info(cDialog& me, short ter){ cTerrain& ter_type = scenario.ter_types[ter]; { cPict& pic_ctrl = dynamic_cast(me["graphic"]); @@ -397,7 +393,7 @@ void fill_ter_info(cDialog& me, short ter){ me["arena"].setTextToNum(ter_type.combat_arena); } -bool finish_editing_ter(cDialog& me, std::string id, ter_num_t& which_ter) { +static bool finish_editing_ter(cDialog& me, std::string id, ter_num_t& which_ter) { if(!save_ter_info(me, scenario.ter_types[which_ter])) return true; if(id == "done") me.toast(); @@ -441,7 +437,7 @@ short edit_ter_type(ter_num_t which_ter) { return 0; } -void put_monst_info_in_dlog(cDialog& me, m_num_t which_monst) { +static void put_monst_info_in_dlog(cDialog& me, m_num_t which_monst) { char str[256]; cMonster& store_monst = scenario.scen_monsters[which_monst]; @@ -509,7 +505,7 @@ void put_monst_info_in_dlog(cDialog& me, m_num_t which_monst) { // me["type3"].setText(get_str("monster-abilities",130 + store_monst.a[2].type)); } -bool check_monst_pic(cDialog& me, std::string id, bool losing, cMonster& store_monst) { +static bool check_monst_pic(cDialog& me, std::string id, bool losing, cMonster& store_monst) { if(!losing) return true; if(check_range(me, id, losing, 0, 4999, "Monster pic")) { // later check pic num for error, and assign widths if custom @@ -542,9 +538,7 @@ bool check_monst_pic(cDialog& me, std::string id, bool losing, cMonster& store_m return true; } -bool save_monst_info(cDialog& me, cMonster& store_monst) { - char str[256]; - short i; +static bool save_monst_info(cDialog& me, cMonster& store_monst) { store_monst.m_name = me["name"].getText(); store_monst.picture_num = me["pic"].getTextAsNum(); @@ -668,7 +662,7 @@ static const std::string resist_field_names[8] = { "magic-imm", "fire-imm", "cold-imm", "poison-imm", }; -void put_monst_abils_in_dlog(cDialog& me, cMonster& store_monst, short which_monst) { +static void put_monst_abils_in_dlog(cDialog& me, cMonster& store_monst, short which_monst) { me["num"].setTextToNum(which_monst); me["poison"].setTextToNum(store_monst.poison); @@ -707,7 +701,7 @@ void put_monst_abils_in_dlog(cDialog& me, cMonster& store_monst, short which_mon } } -bool save_monst_abils(cDialog& me, cMonster& store_monst) { +static bool save_monst_abils(cDialog& me, cMonster& store_monst) { store_monst.poison = me["poison"].getTextAsNum(); store_monst.breath = me["breath-str"].getTextAsNum(); std::string breathType = dynamic_cast(me["breath-type"]).getSelected(); @@ -782,7 +776,7 @@ cMonster edit_monst_abil(cMonster starting_record,short which_monst) { return store_monst; } -void put_item_info_in_dlog(cDialog& me, cItemRec& store_item, short which_item) { +static void put_item_info_in_dlog(cDialog& me, cItemRec& store_item, short which_item) { me["num"].setTextToNum(which_item); me["full"].setText(store_item.full_name); me["short"].setText(store_item.name); @@ -904,7 +898,7 @@ void put_item_info_in_dlog(cDialog& me, cItemRec& store_item, short which_item) me["class"].setTextToNum(store_item.special_class); } -bool save_item_info(cDialog& me, cItemRec& store_item, short which_item) { +static bool save_item_info(cDialog& me, cItemRec& store_item, short which_item) { store_item.full_name = me["full"].getText(); store_item.name = me["short"].getText(); store_item.graphic_num = me["picnum"].getTextAsNum(); @@ -975,7 +969,7 @@ bool save_item_info(cDialog& me, cItemRec& store_item, short which_item) { return true; } -bool edit_item_type_event_filter(cDialog& me, std::string item_hit, cItemRec& store_item, short store_which_item) { +static bool edit_item_type_event_filter(cDialog& me, std::string item_hit, cItemRec& store_item, short store_which_item) { short i; cItemRec temp_item; @@ -1038,8 +1032,7 @@ short edit_item_type(short which_item) { return 0; } -void put_item_abils_in_dlog(cDialog& me, cItemRec& store_item, short which_item) { - char str[256]; +static void put_item_abils_in_dlog(cDialog& me, cItemRec& store_item, short which_item) { me["num"].setTextToNum(which_item); me["name"].setText(store_item.full_name.c_str()); @@ -1056,7 +1049,7 @@ void put_item_abils_in_dlog(cDialog& me, cItemRec& store_item, short which_item) dynamic_cast(me["conceal"]).setState(store_item.concealed ? led_red : led_off); } -bool save_item_abils(cDialog& me, cItemRec& store_item) { +static bool save_item_abils(cDialog& me, cItemRec& store_item) { store_item.magic_use_type = boost::lexical_cast(dynamic_cast(me["use-type"]).getSelected().substr(3)); store_item.treas_class = boost::lexical_cast(dynamic_cast(me["treasure"]).getSelected().substr(4)); store_item.ability_strength = me["str"].getTextAsNum(); @@ -1069,7 +1062,7 @@ bool save_item_abils(cDialog& me, cItemRec& store_item) { return true; } -bool edit_item_abil_event_filter(cDialog& me, std::string item_hit, cItemRec& store_item, short which_item) { +static bool edit_item_abil_event_filter(cDialog& me, std::string item_hit, cItemRec& store_item, short which_item) { short i; if(item_hit == "cancel") { @@ -1174,7 +1167,7 @@ cItemRec edit_item_abil(cItemRec starting_record,short which_item) { return store_item; } -void put_spec_item_in_dlog(cDialog& me, cSpecItem& store_item, short which_item) { +static void put_spec_item_in_dlog(cDialog& me, cSpecItem& store_item, short which_item) { me["num"].setTextToNum(which_item); me["name"].setText(store_item.name); me["descr"].setText(store_item.descr); @@ -1183,7 +1176,7 @@ void put_spec_item_in_dlog(cDialog& me, cSpecItem& store_item, short which_item) dynamic_cast(me["usable"]).setState(store_item.flags % 10 > 0 ? led_red : led_off); } -bool save_spec_item(cDialog& me, cSpecItem& store_item, short which_item) { +static bool save_spec_item(cDialog& me, cSpecItem& store_item, short which_item) { strncpy(store_item.name, me["name"].getText().c_str(),25); store_item.name[25] = 0; strncpy(store_item.descr, me["descr"].getText().c_str(),255); @@ -1198,7 +1191,7 @@ bool save_spec_item(cDialog& me, cSpecItem& store_item, short which_item) { return true; } -bool edit_spec_item_event_filter(cDialog& me, std::string item_hit, cSpecItem& store_item, short which_item) { +static bool edit_spec_item_event_filter(cDialog& me, std::string item_hit, cSpecItem& store_item, short which_item) { if(item_hit == "cancel") { me.toast(); } else if(item_hit == "okay") { @@ -1227,7 +1220,7 @@ bool edit_spec_item_event_filter(cDialog& me, std::string item_hit, cSpecItem& s } me["spec"].setTextToNum(spec); } - edit_spec_enc(spec,0,&me); + edit_spec_enc(spec,0); if(spec >= 0 && spec < 256 && scenario.scen_specials[spec].pic < 0) me["spec"].setTextToNum(-1); save_spec_item(me, store_item, which_item); @@ -1250,7 +1243,7 @@ void edit_spec_item(short which_item) { item_dlg.run(); } -void put_save_rects_in_dlog(cDialog& me) { +static void put_save_rects_in_dlog(cDialog& me) { short i; for (i = 0; i < 3; i++) { @@ -1264,7 +1257,7 @@ void put_save_rects_in_dlog(cDialog& me) { } } -bool save_save_rects(cDialog& me) { +static bool save_save_rects(cDialog& me) { short i; for (i = 0; i < 3; i++) { @@ -1294,7 +1287,7 @@ bool save_save_rects(cDialog& me) { return true; } -bool edit_save_rects_event_filter(cDialog& me, std::string item_hit) { +static bool edit_save_rects_event_filter(cDialog& me, std::string item_hit) { if(item_hit == "cancel") { me.toast(); } else if(item_hit == "okay") { @@ -1315,7 +1308,7 @@ void edit_save_rects() { save_dlg.run(); } -bool save_vehicles(cDialog& me, cVehicle* vehicles, const short page) { +static bool save_vehicles(cDialog& me, cVehicle* vehicles, const short page) { short i; for (i = 0; i < 6; i++) { @@ -1334,7 +1327,7 @@ bool save_vehicles(cDialog& me, cVehicle* vehicles, const short page) { return true; } -void put_vehicles_in_dlog(cDialog& me, cVehicle* vehicles, const short page) { +static void put_vehicles_in_dlog(cDialog& me, cVehicle* vehicles, const short page) { short i; for (i = 0; i < 6; i++) { @@ -1347,8 +1340,7 @@ void put_vehicles_in_dlog(cDialog& me, cVehicle* vehicles, const short page) { } } -bool edit_vehicles_event_filter(cDialog& me, std::string item_hit, cVehicle* vehicles, size_t nVehicles, short& page) { - short i; +static bool edit_vehicles_event_filter(cDialog& me, std::string item_hit, cVehicle* vehicles, size_t nVehicles, size_t& page) { if(item_hit == "okay") { if(save_vehicles(me, vehicles, page)) @@ -1369,7 +1361,7 @@ bool edit_vehicles_event_filter(cDialog& me, std::string item_hit, cVehicle* veh void edit_horses() { using namespace std::placeholders; - short page = 0; + size_t page = 0; cDialog horse_dlg("edit-horses.xml"); horse_dlg.attachClickHandlers(std::bind(edit_vehicles_event_filter, _1, _2, scenario.horses, 30, std::ref(page)), {"okay", "left", "right"}); @@ -1381,7 +1373,7 @@ void edit_horses() { void edit_boats() { using namespace std::placeholders; - short page = 0; + size_t page = 0; cDialog boat_dlg("edit-boats.xml"); boat_dlg.attachClickHandlers(std::bind(edit_vehicles_event_filter, _1, _2, scenario.boats, 30, std::ref(page)), {"okay", "left", "right"}); @@ -1391,7 +1383,7 @@ void edit_boats() { boat_dlg.run(); } -bool save_add_town(cDialog& me) { +static bool save_add_town(cDialog& me) { short i; for (i = 0; i < 10; i++) { @@ -1409,7 +1401,7 @@ bool save_add_town(cDialog& me) { return true; } -void put_add_town_in_dlog(cDialog& me) { +static void put_add_town_in_dlog(cDialog& me) { short i; for (i = 0; i < 10; i++) { @@ -1420,7 +1412,7 @@ void put_add_town_in_dlog(cDialog& me) { } } -bool edit_add_town_event_filter(cDialog& me, std::string item_hit) { +static bool edit_add_town_event_filter(cDialog& me, std::string item_hit) { if(item_hit == "okay") { if(save_add_town(me)) me.toast(); @@ -1439,7 +1431,7 @@ void edit_add_town() { vary_dlg.run(); } -bool save_item_placement(cDialog& me, cScenario::cItemStorage& store_storage, short cur_shortcut) { +static bool save_item_placement(cDialog& me, cScenario::cItemStorage& store_storage, short cur_shortcut) { short i; store_storage.property = dynamic_cast(me["owned"]).getState() != led_off; @@ -1459,7 +1451,7 @@ bool save_item_placement(cDialog& me, cScenario::cItemStorage& store_storage, sh return true; } -void put_item_placement_in_dlog(cDialog& me, const cScenario::cItemStorage& store_storage, short cur_shortcut) { +static void put_item_placement_in_dlog(cDialog& me, const cScenario::cItemStorage& store_storage, short cur_shortcut) { short i; me["num"].setTextToNum(cur_shortcut); @@ -1472,7 +1464,7 @@ void put_item_placement_in_dlog(cDialog& me, const cScenario::cItemStorage& stor } } -bool edit_item_placement_event_filter(cDialog& me, std::string item_hit, cScenario::cItemStorage& store_storage, short& cur_shortcut) { +static bool edit_item_placement_event_filter(cDialog& me, std::string item_hit, cScenario::cItemStorage& store_storage, short& cur_shortcut) { short i; if(item_hit == "okay") { @@ -1504,7 +1496,7 @@ bool edit_item_placement_event_filter(cDialog& me, std::string item_hit, cScenar return true; } -bool edit_item_placement_select_item(cDialog& me, cScenario::cItemStorage& store_storage, short item_hit) { +static bool edit_item_placement_select_item(cDialog& me, cScenario::cItemStorage& store_storage, short item_hit) { std::string id = "item" + std::to_string(item_hit); short i = me[id].getTextAsNum(); store_storage.item_num[item_hit - 1] = i; diff --git a/osx/scenedit/scen.fileio.cpp b/osx/scenedit/scen.fileio.cpp index 312ba84f..7fd8b84c 100644 --- a/osx/scenedit/scen.fileio.cpp +++ b/osx/scenedit/scen.fileio.cpp @@ -585,7 +585,7 @@ void create_basic_scenario() { } // if which_town is -1, load town from base -void import_town(short which_town,fs::path temp_file_to_load) { +void import_town(short /*which_town*/,fs::path /*temp_file_to_load*/) { giveError("Town import currently disabled."); // short i,j,k,l,file_id; // bool file_ok = false; @@ -743,8 +743,8 @@ void import_town(short which_town,fs::path temp_file_to_load) { } // When this is called, the current town is the town to make town 0. -void make_new_scenario(const char* file_name,short out_width,short out_height,short making_warriors_grove, - short use_grass) { +void make_new_scenario(const char* /*file_name*/,short /*out_width*/,short /*out_height*/,short /*making_warriors_grove*/, + short /*use_grass*/) { // short i,j,k,num_outdoors; // FSSpec dummy_file; // NavReplyRecord reply; diff --git a/osx/scenedit/scen.graphics.cpp b/osx/scenedit/scen.graphics.cpp index 4bfeadeb..e3d87a3b 100644 --- a/osx/scenedit/scen.graphics.cpp +++ b/osx/scenedit/scen.graphics.cpp @@ -137,7 +137,7 @@ short map_pats[220] = {50,50,1,1,1,6,6,6,6,6, unsigned char small_what_drawn[64][64]; extern bool small_any_drawn; -short get_small_icon(ter_num_t ter){ +static short get_small_icon(ter_num_t ter){ short icon = -1; switch(scenario.ter_types[ter].special){ case TER_SPEC_NONE: @@ -214,6 +214,8 @@ short get_small_icon(ter_num_t ter){ case eStatus::ACID: icon = 41; break; + case eStatus::MAIN: case eStatus::CHARM: + break; // Nothing to do here; these values are "magic" and should not be used } break; case TER_SPEC_CRUMBLING: @@ -1040,7 +1042,8 @@ void draw_one_tiny_terrain_spot (short i,short j,ter_num_t terrain_to_draw) { /* Draw a bitmap in the world window. hor in 0 .. 8, vert in 0 .. 8, object is ptr. to bitmap to be drawn, and masking is for Copybits. */ -void Draw_Some_Item(sf::Texture& src_gworld,RECT src_rect,sf::RenderTarget& targ_gworld,location target,sf::BlendMode mode) { +// TODO: Wait, why is targ_gworld unused? +void Draw_Some_Item(sf::Texture& src_gworld,RECT src_rect,sf::RenderTarget& /*targ_gworld*/,location target,sf::BlendMode mode) { RECT destrec; if ((target.x < 0) || (target.x > 8) || (target.y < 0) || (target.y > 8)) @@ -1282,10 +1285,10 @@ bool is_special(short i,short j) { return false; } -void take_special(short i,short j) { +void take_special(short /*i*/,short /*j*/) { } -void make_special(short i,short j) { +void make_special(short /*i*/,short /*j*/) { } void sort_specials() { diff --git a/osx/scenedit/scen.keydlgs.cpp b/osx/scenedit/scen.keydlgs.cpp index 0ca22fe3..7e27059c 100644 --- a/osx/scenedit/scen.keydlgs.cpp +++ b/osx/scenedit/scen.keydlgs.cpp @@ -11,7 +11,6 @@ #include "dlogutil.h" #include "restypes.hpp" -extern std::string get_str(std::string list, short j); extern short cen_x, cen_y/*, overall_mode*/; extern bool mouse_button_held; extern short cur_viewing_mode; @@ -170,7 +169,7 @@ pic_num_t choose_graphic(short cur_choice,ePicType g_type,cDialog* parent) { item_hit = cPictChoice(0, 418, PIC_TER_MAP, parent).show(NO_PIC, cur_choice); break; default: // Custom or party; assume custom, since this is the scenario editor and the party sheet isn't available - if(g_type > PIC_PARTY) return NO_PIC; + if(g_type & PIC_PARTY) return NO_PIC; ePicType g_base_type = g_type - PIC_CUSTOM; pic_num_t totalPics = spec_scen_g.count(); pic_num_t last; @@ -188,8 +187,7 @@ pic_num_t choose_graphic(short cur_choice,ePicType g_type,cDialog* parent) { return item_hit; } -short choose_text_res(std::string res_list,short first_t,short last_t,short cur_choice,cDialog* parent,const char *title) { - short item_hit; +short choose_text_res(std::string res_list,short first_t,short last_t,unsigned short cur_choice,cDialog* parent,const char *title) { location view_loc; if((cur_choice < first_t) || (cur_choice > last_t)) cur_choice = first_t; @@ -200,8 +198,7 @@ short choose_text_res(std::string res_list,short first_t,short last_t,short cur_ return dlog.show(cur_choice); } -short choose_text(eStrType list, short cur_choice, cDialog* parent, const char* title) { - short item_hit; +short choose_text(eStrType list, unsigned short cur_choice, cDialog* parent, const char* title) { location view_loc; std::vector strings; @@ -233,7 +230,7 @@ short choose_text(eStrType list, short cur_choice, cDialog* parent, const char* return dlog.show(cur_choice); } -bool edit_text_event_filter(cDialog& me, std::string item_hit, eKeyMod mods, short& which_str, short str_mode) { +static bool edit_text_event_filter(cDialog& me, std::string item_hit, short& which_str, short str_mode) { short num_strs[3] = {260,108,140}; std::string newVal = me["text"].getText(); @@ -264,11 +261,9 @@ bool edit_text_event_filter(cDialog& me, std::string item_hit, eKeyMod mods, sho // mode 0 - scen 1 - out 2 - town void edit_text_str(short which_str,short mode) { using namespace std::placeholders; -// ignore parent in Mac version - short item_hit; cDialog dlog("edit-text.xml"); - dlog.attachClickHandlers(std::bind(edit_text_event_filter, _1, _2, _3, std::ref(which_str), mode), {"okay", "left", "right"}); + dlog.attachClickHandlers(std::bind(edit_text_event_filter, _1, _2, std::ref(which_str), mode), {"okay", "left", "right"}); dlog["num"].setTextToNum(which_str); if(mode == 0) @@ -281,7 +276,7 @@ void edit_text_str(short which_str,short mode) { dlog.run(); } -bool edit_area_rect_event_filter(cDialog& me, std::string item_hit, eKeyMod mods, short which_str, short str_mode) { +static bool edit_area_rect_event_filter(cDialog& me, std::string item_hit, short which_str, short str_mode) { if(item_hit == "okay") { me.setResult(true); me.toast(); @@ -298,10 +293,10 @@ bool edit_area_rect_event_filter(cDialog& me, std::string item_hit, eKeyMod mods // mode 0 - out 1 - town bool edit_area_rect_str(short which_str,short mode) { -// ignore parent in Mac version - short item_hit; + using namespace std::placeholders; cDialog dlog("set-area-desc.xml"); + dlog.attachClickHandlers(std::bind(edit_area_rect_event_filter, _1, _2, which_str, mode), {"okay", "cancel"}); if(mode == 0) dlog["area"].setText(current_terrain.out_strs(which_str + 1)); @@ -314,7 +309,7 @@ bool edit_area_rect_str(short which_str,short mode) { // MARK: Special node dialog -bool save_spec_enc(cDialog& me, short which_mode, short which_node) { +static bool save_spec_enc(cDialog& me, short which_mode, short which_node) { store_spec_node.sd1 = me["sdf1"].getTextAsNum(); store_spec_node.sd2 = me["sdf2"].getTextAsNum(); store_spec_node.m1 = me["msg1"].getTextAsNum(); @@ -346,7 +341,6 @@ bool save_spec_enc(cDialog& me, short which_mode, short which_node) { static void put_spec_enc_in_dlog(cDialog& me, short which_node) { std::string str; - short i; me["num"].setTextToNum(which_node); str = get_str("special-node-names",store_spec_node.type + 1); @@ -518,7 +512,7 @@ static void put_spec_enc_in_dlog(cDialog& me, short which_node) { } } -static bool edit_spec_enc_event_filter(cDialog& me, std::string item_hit, eKeyMod mods, short& which_mode, short& which_node) { +static bool edit_spec_enc_event_filter(cDialog& me, std::string item_hit, short& which_mode, short& which_node) { short i,node_to_change_to = -1,spec; if(item_hit == "okay") { @@ -722,10 +716,9 @@ static bool edit_spec_enc_event_filter(cDialog& me, std::string item_hit, eKeyMo } // mode - 0 scen 1 - out 2 - town -void edit_spec_enc(short which_node,short mode,cDialog* parent) { +void edit_spec_enc(short which_node,short mode) { // ignore parent in Mac version using namespace std::placeholders; - short spec_enc_hit,i; // Clear the "nodes edited" stack; should already be clear, but just make sure while(!last_node.empty()) last_node.pop(); @@ -740,7 +733,7 @@ void edit_spec_enc(short which_node,short mode,cDialog* parent) { store_spec_node.pic = 0; cDialog special("edit-special-node.xml"); - auto callback = std::bind(edit_spec_enc_event_filter, _1, _2, _3, std::ref(mode), std::ref(which_node)); + auto callback = std::bind(edit_spec_enc_event_filter, _1, _2, std::ref(mode), std::ref(which_node)); special.attachClickHandlers(callback, {"okay", "cancel", "back"}); special.attachClickHandlers(callback, {"general", "oneshot", "affectpc", "ifthen", "town", "out"}); special.attachClickHandlers(callback, {"x1a-edit", "x1b-edit", "x2a-edit", "x2b-edit"}); @@ -770,7 +763,7 @@ short get_fresh_spec(short which_mode) { return -1; } -static bool edit_spec_text_event_filter(cDialog& me, std::string item_hit, eKeyMod mods, short spec_str_mode, short* str1, short* str2) { +static bool edit_spec_text_event_filter(cDialog& me, std::string item_hit, short spec_str_mode, short* str1, short* str2) { std::string str; short i; @@ -879,11 +872,10 @@ static bool edit_spec_text_event_filter(cDialog& me, std::string item_hit, eKeyM // mode 0 - scen 1 - out 2 - town void edit_spec_text(short mode,short *str1,short *str2,cDialog* parent) { using namespace std::placeholders; - short item_hit; short num_s_strs[3] = {100,90,100}; cDialog edit("edit-special-text.xml", parent); - edit.attachClickHandlers(std::bind(edit_spec_text_event_filter, _1, _2, _3, mode, str1, str1), {"okay", "cancel"}); + edit.attachClickHandlers(std::bind(edit_spec_text_event_filter, _1, _2, mode, str1, str1), {"okay", "cancel"}); if (*str1 >= num_s_strs[mode]) *str1 = -1; @@ -908,7 +900,7 @@ void edit_spec_text(short mode,short *str1,short *str2,cDialog* parent) { edit.run(); } -static bool edit_dialog_text_event_filter(cDialog& me, std::string item_hit, eKeyMod mods, short spec_str_mode, short* str1){ +static bool edit_dialog_text_event_filter(cDialog& me, std::string item_hit, short spec_str_mode, short* str1){ std::string str; short i; @@ -937,7 +929,7 @@ static bool edit_dialog_text_event_filter(cDialog& me, std::string item_hit, eKe // mode 0 - scen 1 - out 2 - town void edit_dialog_text(short mode,short *str1,cDialog* parent) { - short i,j,item_hit; + short i,j; short num_s_strs[3] = {100,90,100}; if (*str1 >= num_s_strs[mode] - 6) @@ -1005,7 +997,7 @@ void edit_dialog_text(short mode,short *str1,cDialog* parent) { using namespace std::placeholders; cDialog edit("edit-dialog-text.xml",parent); - edit.attachClickHandlers(std::bind(edit_dialog_text_event_filter, _1, _2, _3, mode, str1), {"okay", "cancel"}); + edit.attachClickHandlers(std::bind(edit_dialog_text_event_filter, _1, _2, mode, str1), {"okay", "cancel"}); if (*str1 >= 0){ for (i = 0; i < 6; i++) { @@ -1022,7 +1014,7 @@ void edit_dialog_text(short mode,short *str1,cDialog* parent) { edit.run(); } -static bool edit_special_num_event_filter(cDialog& me, std::string item_hit, eKeyMod mods, short spec_mode) { +static bool edit_special_num_event_filter(cDialog& me, std::string item_hit, short spec_mode) { short i; me.toast(); @@ -1040,10 +1032,9 @@ static bool edit_special_num_event_filter(cDialog& me, std::string item_hit, eKe short edit_special_num(short mode,short what_start) { using namespace std::placeholders; - short item_hit; cDialog edit("edit-special-assign.xml"); - edit.attachClickHandlers(std::bind(edit_special_num_event_filter, _1, _2, _3, mode), {"okay", "cancel"}); + edit.attachClickHandlers(std::bind(edit_special_num_event_filter, _1, _2, mode), {"okay", "cancel"}); edit["num"].setTextToNum(what_start); @@ -1052,7 +1043,7 @@ short edit_special_num(short mode,short what_start) { return edit.getResult(); } -static bool edit_scen_intro_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) { +static bool edit_scen_intro_event_filter(cDialog& me, std::string item_hit, eKeyMod) { short i; if(item_hit == "okay") { @@ -1080,7 +1071,7 @@ static bool edit_scen_intro_event_filter(cDialog& me, std::string item_hit, eKey } void edit_scen_intro() { - short i,item_hit; + short i; cDialog edit("edit-intro.xml"); edit.attachClickHandlers(edit_scen_intro_event_filter, {"okay", "cancel", "choose"}); diff --git a/osx/scenedit/scen.keydlgs.h b/osx/scenedit/scen.keydlgs.h index 3a80517d..fc87817c 100644 --- a/osx/scenedit/scen.keydlgs.h +++ b/osx/scenedit/scen.keydlgs.h @@ -10,10 +10,10 @@ void display_strings(char *text1, char *text2, char *title,short sound_num,short graphic_num,short graphic_type,cDialog* parent); void put_choice_pics(short g_type); pic_num_t choose_graphic(short cur_choice,ePicType g_type,cDialog* parent); -short choose_text_res(std::string res_list,short first_t,short last_t,short cur_choice,cDialog* parent,const char *title); -short choose_text(eStrType list, short cur_choice, cDialog* parent,const char* title); +short choose_text_res(std::string res_list,short first_t,short last_t,unsigned short cur_choice,cDialog* parent,const char *title); +short choose_text(eStrType list, unsigned short cur_choice, cDialog* parent,const char* title); void edit_text_str(short which_str,short mode); -void edit_spec_enc(short which_node,short mode,cDialog* parent); +void edit_spec_enc(short which_node,short mode); short get_fresh_spec(short which_mode); void edit_spec_text(short mode,short *str1,short *str2,cDialog* parent); void edit_dialog_text(short mode,short *str1,cDialog* parent); diff --git a/osx/scenedit/scen.main.cpp b/osx/scenedit/scen.main.cpp index 48141a04..9deb9103 100644 --- a/osx/scenedit/scen.main.cpp +++ b/osx/scenedit/scen.main.cpp @@ -79,7 +79,7 @@ RECT right_sbar_rect; // //Changed to ISO C specified argument and return type. -int main(int argc, char* argv[]) { +int main(int, char* argv[]) { init_menubar(); //outdoor_record_type dummy_outdoor, *store2; @@ -143,7 +143,6 @@ int main(int argc, char* argv[]) { //MW specified argument and return type. void Initialize(void) { - char tit[256] = " "; // // To make the Random sequences truly random, we need to make the seed start @@ -183,7 +182,6 @@ void Initialize(void) { void Handle_One_Event() { short chr,chr2; - long menu_choice; Handle_Update(); @@ -208,7 +206,10 @@ void Handle_One_Event() { case sf::Event::MouseButtonReleased: mouse_button_held = false; break; - } + + default: + break; + } } void Handle_Update() { @@ -494,7 +495,7 @@ void handle_monst_menu(int item_hit) { mode_count = item_hit; } -void handleUpdateWhileScrolling(volatile bool& doneScrolling) { +static void handleUpdateWhileScrolling(volatile bool& doneScrolling) { while(!doneScrolling) { sf::sleep(sf::milliseconds(10)); // TODO: redraw_screen should probably take the argument specifying what to update @@ -504,8 +505,6 @@ void handleUpdateWhileScrolling(volatile bool& doneScrolling) { } void Mouse_Pressed() { - short the_part,content_part; - long menu_choice; location mousePos(event.mouseButton.x, event.mouseButton.y); volatile bool doneScrolling = false; diff --git a/osx/scenedit/scen.menus.h b/osx/scenedit/scen.menus.h index bd869991..d14c2d10 100644 --- a/osx/scenedit/scen.menus.h +++ b/osx/scenedit/scen.menus.h @@ -10,5 +10,7 @@ #define BoE_scen_menus_h void init_menubar(); +void update_item_menu(); +void shut_down_menus(short mode); #endif diff --git a/osx/scenedit/scen.menus.mac.mm b/osx/scenedit/scen.menus.mac.mm index 62772d94..3716285c 100644 --- a/osx/scenedit/scen.menus.mac.mm +++ b/osx/scenedit/scen.menus.mac.mm @@ -147,7 +147,6 @@ void shut_down_menus(short mode) { void update_item_menu() { MenuHandler* targ = [[file_menu itemAtIndex: 0] target]; short i,j; - char item_name[256]; for(j = 0; j < 5; j++) { [item_menu[j] removeAllItems]; @@ -188,6 +187,7 @@ void handle_monst_menu(int item_hit); // TODO: Implement edit menu (much work to be done here!) -(void) editMenu:(id) sender { + (void) sender; // Suppress "unused parameter" warning } -(void) scenMenu:(id) sender { @@ -204,9 +204,11 @@ void handle_monst_menu(int item_hit); // TODO: Monster and item menus -(void) itemMenu:(id) sender { + (void) sender; // Suppress "unused parameter" warning } -(void) monstMenu:(id) sender { + (void) sender; // Suppress "unused parameter" warning } -(void) helpMenu:(id) sender { @@ -214,6 +216,7 @@ void handle_monst_menu(int item_hit); } -(void) onlineHelp:(id) sender { + (void) sender; [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: @"https://calref.net/~sylae/boe-doc/editor/About.html"]]; } @end diff --git a/osx/scenedit/scen.townout.cpp b/osx/scenedit/scen.townout.cpp index 284ab5f0..2f9d6a59 100644 --- a/osx/scenedit/scen.townout.cpp +++ b/osx/scenedit/scen.townout.cpp @@ -10,7 +10,6 @@ #include "mathutil.h" #include "button.h" -extern std::string get_str(std::string list, short j); extern short cen_x, cen_y, overall_mode;//,user_given_password; extern bool mouse_button_held,editing_town; extern short cur_viewing_mode; @@ -128,7 +127,7 @@ static bool get_placed_monst_in_dlog(cDialog& me) { return true; } -bool edit_placed_monst_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) { +static bool edit_placed_monst_event_filter(cDialog& me, std::string item_hit, eKeyMod) { short i; cCreature store_m; @@ -174,7 +173,6 @@ void edit_placed_monst(short which_m) { } static void put_placed_monst_adv_in_dlog(cDialog& me) { - short i; me["num"].setTextToNum(store_which_placed_monst); me["type"].setText(scenario.scen_monsters[store_placed_monst2.number].m_name); @@ -209,7 +207,7 @@ static bool get_placed_monst_adv_in_dlog(cDialog& me) { return true; } -static bool edit_placed_monst_adv_event_filter(cDialog& me, std::string item_hit, eKeyMod mods) { +static bool edit_placed_monst_adv_event_filter(cDialog& me, std::string item_hit, eKeyMod) { if(item_hit == "okay") { if(!get_placed_monst_adv_in_dlog(me)) return true; me.toast(); diff --git a/osx/tools/graphtool.cpp b/osx/tools/graphtool.cpp index 3410a89b..125b9ea2 100644 --- a/osx/tools/graphtool.cpp +++ b/osx/tools/graphtool.cpp @@ -62,7 +62,7 @@ void init_graph_tool(){ } delete[] fbuf; delete[] vbuf; - int i,j; + int i; // TODO: The duplication of location here shouldn't be necessary static const location pat_offs[17] = { location{0,3}, location{1,1}, location{2,1}, location{2,0}, @@ -240,7 +240,7 @@ std::vector draw_string_sel(sf::RenderTarget& dest_window,RECT dest_r return params.snippets; } -void push_snippets(size_t start, size_t end, text_params_t& options, size_t& iHilite, const std::string& str, location loc) { +static void push_snippets(size_t start, size_t end, text_params_t& options, size_t& iHilite, const std::string& str, location loc) { std::vector& hilites = options.hilite_ranges; std::vector& snippets = options.snippets; // Check if we have any hilites on this line. diff --git a/osx/tools/graphtool.h b/osx/tools/graphtool.h index bfda2c74..c572bbf8 100644 --- a/osx/tools/graphtool.h +++ b/osx/tools/graphtool.h @@ -124,6 +124,7 @@ void undo_clip(sf::RenderTarget& where); // This probably doesn't quite fit here, but it fits worse pretty much everywhere else in the common sources short can_see(location p1,location p2,std::function get_obscurity); +std::string get_str(std::string list, short j); #ifndef GRAPHTOOL_CPP extern m_pic_index_t m_pic_index[200]; diff --git a/osx/tools/qdpict.cpp b/osx/tools/qdpict.cpp index 0c7dd388..d3f6ef25 100644 --- a/osx/tools/qdpict.cpp +++ b/osx/tools/qdpict.cpp @@ -375,6 +375,7 @@ static rectangle loadFromPictResource(Handle resHandle, unsigned char*& pixelSto return rectangle(bounds.top, bounds.left, bounds.bottom, bounds.right); } +bool tryLoadPictFromResourceFile(fs::path& gpath, sf::Image& graphics_store); // Suppress "no prototype" warning bool tryLoadPictFromResourceFile(fs::path& gpath, sf::Image& graphics_store) { static const char*const noGraphics = "The game will still work without the custom graphics, but some things will not look right."; // TODO: There's no way around it; I'll have to read resource files for this section. @@ -387,7 +388,7 @@ bool tryLoadPictFromResourceFile(fs::path& gpath, sf::Image& graphics_store) { err = FSGetResourceForkName(&rsrc); err = FSOpenResourceFile(&file, rsrc.length, rsrc.unicode, fsRdPerm, &custRef); if(err != noErr) { - giveError("An old-style .meg graphics file was found, but neither data nor resource fork could not be read.",noGraphics); + giveError("An old-style .meg graphics file was found, but neither data nor resource fork could be read.",noGraphics); return false; } } diff --git a/osx/tools/specials_parse.cpp b/osx/tools/specials_parse.cpp index 57832716..46ff69f8 100644 --- a/osx/tools/specials_parse.cpp +++ b/osx/tools/specials_parse.cpp @@ -283,6 +283,7 @@ void SpecialParser::set_third(int i, ph_t, bool& pass) { std::map SpecialParser::parse(std::string code) { bool success = qi::parse(code.begin(), code.end(), nodes_file); + (void) success; // Suppress "unused parameter" warning return specials; } @@ -297,6 +298,7 @@ void SpecialParser::init_debug() { // BOOST_SPIRIT_DEBUG_NODE(nodes_file); } +void test_special_parse(std::string file); // Suppress "no prototype" warning void test_special_parse(std::string file) { std::ostringstream code; std::ifstream fin(file); diff --git a/osx/tools/winutil.mac.mm b/osx/tools/winutil.mac.mm index 498dfc10..afef549b 100644 --- a/osx/tools/winutil.mac.mm +++ b/osx/tools/winutil.mac.mm @@ -11,6 +11,7 @@ #include // TODO: I'm sure there's a better way to do this (maybe one that's keyboard layout agnostic) +// The proper way would involve use of the TextEntered event char keyToChar(sf::Keyboard::Key key, bool isShift) { using kb = sf::Keyboard; switch(key) { @@ -66,6 +67,7 @@ char keyToChar(sf::Keyboard::Key key, bool isShift) { case kb::Return: return '\n'; case kb::BackSpace: return '\b'; case kb::Delete: return '\x7f'; + default: break; } return 0; }