Fix all the compile warnings that occur on Mac.

(Except the OpenGL deprecation warning and some warnings coming from Boost.Process.)
This commit is contained in:
2025-03-08 20:43:04 -05:00
parent 67fbb4fae5
commit 5cfc6ba328
17 changed files with 41 additions and 27 deletions

View File

@@ -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;
});

View File

@@ -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;
}
}

View File

@@ -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<fs::path, std::time_t> a, std::pair<fs::path, std::time_t> b) {
@@ -591,4 +591,4 @@ std::vector<std::pair<fs::path, std::time_t>> sorted_file_mtimes(fs::path dir, s
std::sort(files.begin(), files.end(), compare_mtime);
return files;
}
}

View File

@@ -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<char,key_action_t> debug_actions;
std::map<char,key_action_t> startup_debug_actions;
std::vector<std::vector<char>> debug_actions_help_order;
void add_debug_action(std::vector<char> keys, std::string name, void (*action)(), bool startup_safe = false) {
static void add_debug_action(std::vector<char> 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();
}
}

View File

@@ -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();

View File

@@ -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;

View File

@@ -126,6 +126,8 @@ void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,const
std::map<sf::RenderTexture*,std::vector<ScaleAwareText>> store_scale_aware_text;
std::map<sf::RenderTexture*,rectangle> 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);
}

View File

@@ -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<eSkill,short> skill_cost;
extern std::map<eSkill,short> skill_max;
extern std::map<eSkill,short> skill_g_cost;
@@ -569,4 +570,4 @@ void pick_preferences() {
fs::path run_file_picker(bool saving){
return os_file_picker(saving);
}
}

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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();

View File

@@ -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!

View File

@@ -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";

View File

@@ -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();
}

View File

@@ -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)];
}

View File

@@ -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);
}
}
}

View File

@@ -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;
}