diff --git a/src/dialogxml/dialogs/dialog.cpp b/src/dialogxml/dialogs/dialog.cpp index 0984efc9..a43e6fb7 100644 --- a/src/dialogxml/dialogs/dialog.cpp +++ b/src/dialogxml/dialogs/dialog.cpp @@ -1185,7 +1185,7 @@ void preview_dialog_xml(fs::path dialog_xml) { // Make every clickable control's click event close the dialog for (auto control : dialog){ try{ - control.second->attachClickHandler([](cDialog& me, std::string item_hit, eKeyMod mod) -> bool { + control.second->attachClickHandler([](cDialog& me, std::string, eKeyMod) -> bool { me.toast(false); return true; }); diff --git a/src/dialogxml/widgets/button.cpp b/src/dialogxml/widgets/button.cpp index 4d242096..716ff335 100644 --- a/src/dialogxml/widgets/button.cpp +++ b/src/dialogxml/widgets/button.cpp @@ -324,5 +324,8 @@ void cButton::initPreset() { case BTN_TRAIT: setText("Race|& Traits"); break; + default: + // Other button types don't have prebaked text, so do nothing + break; } } diff --git a/src/fileio/fileio_party.cpp b/src/fileio/fileio_party.cpp index 25cd9bf9..891af3db 100644 --- a/src/fileio/fileio_party.cpp +++ b/src/fileio/fileio_party.cpp @@ -458,7 +458,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& real_univ, bool manual){ return true; } -static bool save_party_const(const cUniverse& univ, bool save_as, fs::path dest_file = "") { +static bool save_party_const(const cUniverse& univ, fs::path dest_file = "") { // Make sure it has the proper file extension if(dest_file.empty()){ dest_file = univ.file; @@ -569,11 +569,11 @@ bool save_party(cUniverse& univ, bool save_as) { } // A file wasn't chosen if(univ.file.empty()) return false; - return save_party_const(univ, save_as); + return save_party_const(univ); } bool save_party_force(cUniverse& univ, fs::path file) { - return save_party_const(univ, false, file); + return save_party_const(univ, file); } static bool compare_mtime(std::pair a, std::pair b) { @@ -591,4 +591,4 @@ std::vector> sorted_file_mtimes(fs::path dir, s std::sort(files.begin(), files.end(), compare_mtime); return files; -} \ No newline at end of file +} diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index 7400388c..c412cf00 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -1311,6 +1311,7 @@ static void handle_party_death() { } void screen_shift(int dx, int dy, bool& need_redraw) { + (void) need_redraw; // Mark the variable unused if(abs(dx) + abs(dy) == 0) return; @@ -2162,8 +2163,6 @@ void debug_magic_map() { print_buf(); } -extern void outd_move_to_first_town_entrance(int town); - void debug_enter_town() { if(recording){ record_action("debug_enter_town", ""); @@ -2384,7 +2383,7 @@ std::map debug_actions; std::map startup_debug_actions; std::vector> debug_actions_help_order; -void add_debug_action(std::vector keys, std::string name, void (*action)(), bool startup_safe = false) { +static void add_debug_action(std::vector keys, std::string name, void (*action)(), bool startup_safe = false) { key_action_t shortcut = {keys, name, action}; for(char ch: keys){ debug_actions[ch] = shortcut; @@ -2523,7 +2522,7 @@ void init_debug_actions() { } // Later we might want to know whether the key is used or not -bool handle_debug_key(char key) { +static bool handle_debug_key(char key) { if(!univ.debug_mode && key != 'D') return false; if(overall_mode == MODE_STARTUP){ @@ -4100,4 +4099,4 @@ void clear_trapped_monst() { univ.party.imprisoned_monst.fill(0); ASB("Debug: Captures souls cleared."); print_buf(); -} \ No newline at end of file +} diff --git a/src/game/boe.actions.hpp b/src/game/boe.actions.hpp index a994ecf9..43b9f84b 100644 --- a/src/game/boe.actions.hpp +++ b/src/game/boe.actions.hpp @@ -39,6 +39,7 @@ void handle_death(); void start_new_game(bool force = false); void start_tutorial(); location get_cur_direction(location the_point); +void outd_move_to_first_town_entrance(int town); bool outd_move_party(location destination,bool forced); bool town_move_party(location destination,short forced); bool someone_poisoned(); diff --git a/src/game/boe.dlgutil.cpp b/src/game/boe.dlgutil.cpp index c078a259..3d85b4e4 100644 --- a/src/game/boe.dlgutil.cpp +++ b/src/game/boe.dlgutil.cpp @@ -107,7 +107,7 @@ short store_cur_pc = -1; // For healing shops, other PCs might be able to buy something if // the active PC can't -bool start_shop_mode_other_pc(bool allow_empty = false) { +static bool start_shop_mode_other_pc(bool allow_empty = false) { // The shop might change the current PC multiple times, but we want to restore // it to the original active PC when shopping ends, so only store if we're // not yet storing @@ -129,6 +129,7 @@ bool start_shop_mode_other_pc(bool allow_empty = false) { } } if(!other_pc_can_buy && allow_empty){ + univ.cur_pc = pc_buying; start_shop_mode(active_shop_num,active_shop.getCostAdjust(),save_talk_str1,false,true); } return other_pc_can_buy; diff --git a/src/gfx/render_image.cpp b/src/gfx/render_image.cpp index 1fbfa476..71cad846 100644 --- a/src/gfx/render_image.cpp +++ b/src/gfx/render_image.cpp @@ -126,6 +126,8 @@ void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,const std::map> store_scale_aware_text; std::map store_clip_rects; +static const bool DEBUG_SCALE_AWARE_TEXT = false; + static void draw_stored_scale_aware_text(sf::RenderTexture& texture, sf::RenderTarget& dest_window, rectangle targ_rect) { // Temporarily switch target window to its unscaled view to draw scale-aware text sf::View scaled_view = dest_window.getView(); @@ -143,7 +145,7 @@ static void draw_stored_scale_aware_text(sf::RenderTexture& texture, sf::RenderT rect.right *= get_ui_scale(); rect.offset(scaled_top_left.x, scaled_top_left.y); // For debugging: - if(false) + if(DEBUG_SCALE_AWARE_TEXT) frame_rect(dest_window, rect, Colours::RED); clip_rect(dest_window, rect); } diff --git a/src/pcedit/pc.main.cpp b/src/pcedit/pc.main.cpp index 7011b151..3ab42a96 100644 --- a/src/pcedit/pc.main.cpp +++ b/src/pcedit/pc.main.cpp @@ -458,7 +458,8 @@ bool verify_restore_quit(std::string dlog) { return true; } -void display_skills(eSkill skill,cDialog* parent, bool record) { +void display_skills(eSkill skill,cDialog* parent, bool); +void display_skills(eSkill skill,cDialog* parent, bool) { extern std::map skill_cost; extern std::map skill_max; extern std::map skill_g_cost; @@ -569,4 +570,4 @@ void pick_preferences() { fs::path run_file_picker(bool saving){ return os_file_picker(saving); -} \ No newline at end of file +} diff --git a/src/scenario/monster.cpp b/src/scenario/monster.cpp index efe03de8..bc10862e 100644 --- a/src/scenario/monster.cpp +++ b/src/scenario/monster.cpp @@ -622,6 +622,7 @@ std::string uAbility::to_string(eMonstAbil key) const { case PAT_RAD3: sout << "big circle"; break; case PAT_WALL: sout << "line"; break; case PAT_PROT: sout << "protective circle"; break; + case PAT_CUSTOM: sout << "unusual shap"; break; } sout << ")"; } else if(key == eMonstAbil::KILL) { diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index fdf59e64..07d56906 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -1793,7 +1793,7 @@ void handle_keystroke(sf::Event event) { mouse_button_held = false; } -bool handle_outdoor_sec_shift(int dx, int dy){ +static bool handle_outdoor_sec_shift(int dx, int dy){ if(editing_town) return false; int new_x = cur_out.x + dx; int new_y = cur_out.y + dy; diff --git a/src/scenedit/scen.core.cpp b/src/scenedit/scen.core.cpp index 11927ed3..37151985 100644 --- a/src/scenedit/scen.core.cpp +++ b/src/scenedit/scen.core.cpp @@ -257,13 +257,6 @@ bool pick_string(std::string from_file, cDialog& parent, std::string result_fld, return true; } -static bool show_help(std::string from_file, cDialog& parent, pic_num_t pic){ - StringList strings = *ResMgr::strings.get(from_file); - cThreeChoice help(strings,basic_buttons[1],pic,PIC_DLOG,&parent); - help.show(); - return true; -} - static bool pick_ter_flag(cDialog& me, std::string id, eKeyMod) { if(id == "editspec") { int which_type = me["flag2"].getTextAsNum(); diff --git a/src/scenedit/scen.keydlgs.cpp b/src/scenedit/scen.keydlgs.cpp index f1213619..8df91a2a 100644 --- a/src/scenedit/scen.keydlgs.cpp +++ b/src/scenedit/scen.keydlgs.cpp @@ -1310,6 +1310,7 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t& case eSpecPicker::EVENT: store = choose_text_editable(scenario.evt_names, val, &me, "Select an event:"); break; case eSpecPicker::ITEM_CLASS: store = choose_text_editable(scenario.ic_names, val, &me, "Select item class:"); break; case eSpecPicker::JOB_BOARD: store = choose_text_editable(scenario.qb_names, val, &me, "Select a job board:"); break; + case eSpecPicker::POINTER: store = val; break; // TODO: Not implemented... case eSpecPicker::NONE: return false; } me[field].setTextToNum(store); @@ -1376,7 +1377,7 @@ bool edit_spec_enc(short which_node,short mode,cDialog* parent) { "sdf1", "sdf2", }); special["cancel"].attachClickHandler(std::bind(discard_spec_enc, _1, std::ref(edit_stack))); - special["node-help"].attachClickHandler([&edit_stack](cDialog& me, std::string item_hit, eKeyMod mods) { + special["node-help"].attachClickHandler([&edit_stack](cDialog& me, std::string, eKeyMod) { eSpecType type = edit_stack.top().node.type; const std::string& str = (*type).descr(); // TODO: This is the same dialog as give_help(), the only difference being that we don't have a string number! diff --git a/src/scenedit/scen.main.cpp b/src/scenedit/scen.main.cpp index af14a21f..4d2040d2 100644 --- a/src/scenedit/scen.main.cpp +++ b/src/scenedit/scen.main.cpp @@ -430,7 +430,7 @@ void redraw_everything() { restore_cursor(); } -void show_outdated_warning() { +static void show_outdated_warning() { std::string outdated_help1 = "The information in the following help window is extremely outdated! The most up-to-date documentation for OpenBoE is here:"; std::string outdated_help2 = "https://openboe.com/docs"; diff --git a/src/tools/prefs.cpp b/src/tools/prefs.cpp index c4a97d0d..2d7709e1 100644 --- a/src/tools/prefs.cpp +++ b/src/tools/prefs.cpp @@ -228,7 +228,7 @@ static bool load_prefs(fs::path fpath) { extern fs::path tempDir; bool sync_prefs() { #ifdef SFML_SYSTEM_MACOS - bool sync_prefs_mac(); + extern bool sync_prefs_mac(); if(!was_replaying){ return sync_prefs_mac(); } diff --git a/src/tools/prefs.mac.mm b/src/tools/prefs.mac.mm index 35b615df..372579ec 100644 --- a/src/tools/prefs.mac.mm +++ b/src/tools/prefs.mac.mm @@ -60,6 +60,9 @@ static NSUserDefaults* getCurrentDefaults() { return [NSUserDefaults standardUserDefaults]; } +// No push - ignore until end of file +#pragma clang diagnostic ignored "-Wmissing-prototypes" + void set_pref_mac(std::string keypath, bool value) { [getCurrentDefaults() setBool: value forKey: convertKey(keypath)]; } diff --git a/src/tools/winutil.cpp b/src/tools/winutil.cpp index 98bd9c4b..e3eafae2 100644 --- a/src/tools/winutil.cpp +++ b/src/tools/winutil.cpp @@ -7,6 +7,12 @@ // BoE application windows (because they should probably default to match each other). double fallback_scale() { static double scale = 0; + // Suppress the float comparison warning. + // We know it's safe here - we're just comparing static values. + #ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wfloat-equal" + #endif if(scale == 0){ sf::VideoMode desktop = sf::VideoMode::getDesktopMode(); @@ -29,6 +35,9 @@ double fallback_scale() { if(scale == 0){ scale = 1.0; } + #ifdef __GNUC__ + #pragma GCC diagnostic pop + #endif return scale; } @@ -59,4 +68,4 @@ void launchDocs(std::string relative_url) { }else{ launchURL("http://openboe.com/docs/" + relative_url); } -} \ No newline at end of file +} diff --git a/src/universe/party.cpp b/src/universe/party.cpp index 41dbc425..b68ffb96 100644 --- a/src/universe/party.cpp +++ b/src/universe/party.cpp @@ -946,7 +946,7 @@ void cParty::readFrom(const cTagFile& file) { for(size_t n = 0; n < page["SOULCRYSTAL"].size(); n++){ size_t slot; mon_num_t monster; - auto tmp = page["SOULCRYSTAL"] >> slot >> monster; + page["SOULCRYSTAL"] >> slot >> monster; imprisoned_monst[n] = monster; }