zaimoni/Cataclysm

warning/possible bug needs fixing

hirdrac opened this issue · 1 comments

} else if (vis_loc = game::active()->u.see(u.pos)) {

2 lines in vehicle::handbrake() still causing warning for Linux compiles - both actually look like bugs:

vehicle.cpp: In member function ‘void vehicle::handbrake(player&)’:
vehicle.cpp:973:24: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
973 | } else if (vis_loc = game::active()->u.see(u.pos)) {
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vehicle.cpp:981:28: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
981 | } else if (vis_loc = game::active()->u.see(u.pos)) {
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

either comparison was intended instead of assignment or 'vis_loc =' should just be removed since the value of vis_loc isn't used anywhere else in the function.

Yes, looks like an inefficient visibility test. Choice of formal fix is ae8fa91 .

(There is a long-term objective to try to use global positioning coordinates (GPS_loc), rather than reality-bubble coordinates (point).)