zaimoni / Cataclysm

A post-apocalyptic roguelike. New features relative to C:Whales are scheduled for after 0.2.0, the savefile breaking release.
http://www.bay12forums.com/smf/index.php?topic=174897
Other
27 stars 3 forks source link

warning/possible bug needs fixing #161

Closed hirdrac closed 2 years ago

hirdrac commented 2 years ago

https://github.com/zaimoni/Cataclysm/blob/25fb8f054d441d9410b34f42156dae723e96853a/vehicle.cpp#L973

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.

zaimoni commented 2 years ago

Yes, looks like an inefficient visibility test. Choice of formal fix is https://github.com/zaimoni/Cataclysm/commit/ae8fa91040a40095c281bbe678a01dbfee7f295e .

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