Address some compiler warnings (Xcode 12)

* Missing prototypes
* Unused function parameters
* Float comparison in preferences
This commit is contained in:
2024-08-10 12:06:11 -04:00
parent a202918d57
commit 104f6d6b0b
5 changed files with 16 additions and 7 deletions

View File

@@ -393,9 +393,9 @@ void cDialog::loadFromFile(const DialogDefn& file){
}
if(iter->second->isContainer()){
cContainer* tmp = dynamic_cast<cContainer*>(iter->second);
tmp->forEach([this, iter](std::string key, cControl& child) {
if (typeid(&child) == typeid(cTextField*)) {
if (currentFocus.empty()) currentFocus = iter->first;
tmp->forEach([this, iter](std::string, cControl& child) {
if(typeid(&child) == typeid(cTextField*)) {
if(currentFocus.empty()) currentFocus = iter->first;
}
});
}

View File

@@ -1317,8 +1317,17 @@ void pick_preferences() {
int store_display_mode = get_int_pref("DisplayMode");
prefsDlog.run(std::bind(give_help, 55, 0, std::ref(prefsDlog)));
// 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(get_int_pref("DisplayMode") != store_display_mode || get_float_pref("UIScale") != ui_scale || get_float_pref("UIScaleMap") != ui_map_scale)
changed_display_mode = true;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
static void put_party_stats(cDialog& me) {

View File

@@ -227,7 +227,7 @@ static void init_ui() {
init_buttons();
}
void process_args(int argc, char* argv[]) {
static void process_args(int argc, char* argv[]) {
// Command line usage:
// "Blades of Exile" # basic launch
// "Blades of Exile" <save file> # launch and load save file
@@ -257,7 +257,7 @@ void process_args(int argc, char* argv[]) {
}
}
void replay_next_action() {
static void replay_next_action() {
bool did_something = false, need_redraw = false, need_reprint = false;
Element& next_action = pop_next_action();

View File

@@ -136,7 +136,7 @@ void handle_splash_events() {
}
}
rectangle view_rect() {
static rectangle view_rect() {
sf::Vector2f size = mainPtr.getView().getSize();
return rectangle(0, 0, size.y, size.x);
}

View File

@@ -182,7 +182,7 @@ int getMenubarHeight() {
return 0;
}
void adjust_window_for_menubar(int mode, unsigned int width, unsigned int height) {
void adjust_window_for_menubar(int, unsigned int, unsigned int) {
}
NSOpenPanel* dlg_get_scen;