Fix -Wdangling-else

This commit is contained in:
Louis Gombert 2024-04-20 15:37:22 +02:00
parent 43af644827
commit 491db4254a
4 changed files with 27 additions and 16 deletions

View File

@ -820,13 +820,15 @@ int CBriefParse::ParseBriefing(char *filename) {
done_parsing:;
if (abort)
if (abort) {
mprintf((0, "Parse aborted\n"));
else if (!parse_error)
if (reading_text)
} else if (!parse_error) {
if (reading_text) {
ParseError("Missing '$endtext'");
else
} else {
mprintf((0, "Parse sucessful\n"));
}
}
// Close the file
cfclose(ifile);

View File

@ -1051,11 +1051,14 @@ bool ObjectsAreRelated(int o1, int o2) {
// Here is the 09/07/94 change -- Siblings must be identical, others can hurt each other
// See if they're siblings...
if (obj1->parent_handle == obj2->parent_handle)
if ((obj1->mtype.phys_info.flags & PF_HITS_SIBLINGS) || (obj2->mtype.phys_info.flags & PF_HITS_SIBLINGS))
if (obj1->parent_handle == obj2->parent_handle) {
if ((obj1->mtype.phys_info.flags & PF_HITS_SIBLINGS) || (obj2->mtype.phys_info.flags & PF_HITS_SIBLINGS)) {
return false; // if either is proximity, then can blow up, so say not related
else
}
else {
return true;
}
}
// Otherwise, it is two weapons and by default, they should not collide
return true;

View File

@ -1133,11 +1133,13 @@ bool collide_weapon_and_wall(object *weapon, fix hitspeed, int hitseg, int hitwa
// #ifndef RELEASE
if ((stricmp(Weapons[weapon->id].name, "Yellow flare") == 0) && (weapon->parent_handle == Player_object->handle) &&
(KEY_STATE(KEY_LAPOSTRO)))
if (ROOMNUM_OUTSIDE(hitseg))
(KEY_STATE(KEY_LAPOSTRO))) {
if (ROOMNUM_OUTSIDE(hitseg)) {
AddHUDMessage("Terrain cell %d", CELLNUM(hitseg));
else
} else {
AddHUDMessage("Room %d face %d", hitseg, hitwall);
}
}
// #endif
// Check if forcefield

View File

@ -4280,11 +4280,13 @@ int do_fvi_terrain() {
// Check the current node for collisions -- chrishack -- This can be made iterative
cur_node = y * TERRAIN_DEPTH + new_x;
if ((fvi_terrain_visit_list[cur_node >> 3] & (0x01 << (cur_node % 8))) == 0)
if (counter < -delta_ter_check || counter > delta_ter_check)
if ((fvi_terrain_visit_list[cur_node >> 3] & (0x01 << (cur_node % 8))) == 0) {
if (counter < -delta_ter_check || counter > delta_ter_check) {
check_terrain_node(cur_node, false, false);
else
} else {
check_terrain_node(cur_node, false, true);
}
}
}
i++;
@ -4320,11 +4322,13 @@ int do_fvi_terrain() {
// Check the current node for collisions -- chrishack -- This can be made iterative
cur_node = new_y * TERRAIN_DEPTH + x;
if ((fvi_terrain_visit_list[cur_node >> 3] & (0x01 << (cur_node % 8))) == 0)
if (counter < -delta_ter_check || counter > delta_ter_check)
if ((fvi_terrain_visit_list[cur_node >> 3] & (0x01 << (cur_node % 8))) == 0) {
if (counter < -delta_ter_check || counter > delta_ter_check) {
check_terrain_node(cur_node, false, false);
else
} else {
check_terrain_node(cur_node, false, true);
}
}
}
i++;