Fix various compiler warnings

This commit is contained in:
2022-07-05 09:29:15 -04:00
parent f5be1d9706
commit 864aa95fea
7 changed files with 17 additions and 14 deletions

View File

@@ -2257,6 +2257,8 @@
WARNING_CFLAGS = (
"-Wfloat-equal",
"-Wno-long-long",
"-Wno-quoted-include-in-framework-header",
"-Wno-shorten-64-to-32",
);
};
name = Debug;
@@ -2348,6 +2350,8 @@
WARNING_CFLAGS = (
"-Wfloat-equal",
"-Wno-long-long",
"-Wno-quoted-include-in-framework-header",
"-Wno-shorten-64-to-32",
);
};
name = Release;

View File

@@ -666,7 +666,7 @@ static void readTimerFromXml(ticpp::Element& data, cTimer& timer) {
static void initialXmlRead(ticpp::Document& data, std::string root_tag, int& maj, int& min, int& rev, std::string& fname) {
// This checks that the root tag is correct and reads the format version from the boes attribute.
using namespace ticpp;
maj = -1, min = -1, rev = -1; // These are currently unused, but eventually might be used if the format changes
maj = -1; min = -1; rev = -1; // These are currently unused, but eventually might be used if the format changes
std::string type, name, val;
data.GetValue(&fname);
data.FirstChildElement()->GetValue(&type);

View File

@@ -88,7 +88,7 @@ namespace ResMgr {
cLoader<T>& load;
/// Converts a resource name to an absolute file path referencing the resource
fs::path find(const std::string& resourceName) {
for(const std::string name : load.expand(resourceName)) {
for(const std::string& name : load.expand(resourceName)) {
fs::path path = name;
if(!directory.empty()) path = directory/path;
std::stack<fs::path> tmpPaths = paths;

View File

@@ -375,7 +375,7 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short nu
bool pc_combat_move(location destination) {
std::string create_line;
short s1,s2,monst_exist;
short s1,monst_exist;
bool keep_going = true,forced = false,check_f = false;
location monst_loc,store_loc;
eDirection dir;
@@ -420,16 +420,16 @@ bool pc_combat_move(location destination) {
return true;
}
else if(monst_hit != nullptr) {
// s2 = 2 here appears to mean "go ahead and attack", while s2 = 1 means "cancel attack".
if(!monst_hit->is_friendly()) s2 = 2;
bool do_attack = false;
if(!monst_hit->is_friendly()) do_attack = true;
else {
std::string result = cChoiceDlog("attack-friendly",{"cancel","attack"}).show();
if(result == "cancel") s2 = 1;
else if(result == "attack") s2 = 2;
if(result == "cancel") do_attack = false;
else if(result == "attack") do_attack = true;
}
if(s2 == 2 && monst_hit->is_friendly())
make_town_hostile();
if(s2 == 2) {
if(do_attack) {
if(monst_hit->is_friendly())
make_town_hostile();
univ.current_pc().last_attacked = monst_hit;
pc_attack(univ.cur_pc,monst_hit);
return true;

View File

@@ -400,7 +400,6 @@ short monst_pick_target(short which_m) {
if((dist(cur_monst->cur_loc,univ.town.monst[targ_m - 100].cur_loc) ==
dist(cur_monst->cur_loc,univ.party[targ_pc].combat_pos)) && (get_ran(1,0,6) < 3))
return targ_m;
else return targ_pc;
if(dist(cur_monst->cur_loc,univ.town.monst[targ_m - 100].cur_loc) <
dist(cur_monst->cur_loc,univ.party[targ_pc].combat_pos))
return targ_m;

View File

@@ -2634,7 +2634,7 @@ void affect_spec(const runtime_state& ctx) {
// TODO: I think this is for compatibility with old scenarios? If so, remove it and just convert data on load.
// (Actually, I think the only compatibility thing is that it's <= instead of ==)
if(spec.ex2a <= 0) {
int i;
int i = 0;
if(spec.ex1a == 2)
ctx.cur_target = &univ.party;
else if(spec.ex1a == 1) {

View File

@@ -242,8 +242,8 @@ void put_item_screen(eItemWinMode screen_num) {
default: // on an items page
pc = screen_num;
sout.str("");;
sout << univ.party[pc].name << " inventory:",
sout.str("");
sout << univ.party[pc].name << " inventory:";
win_draw_string(item_stats_gworld,upper_frame_rect,sout.str(),eTextMode::WRAP,style);
break;
}