[Freeciv-Dev] remove nearest_real_pos uses (PR#1211)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
The attached patch removes two unnecessary (incorrect AFAICT) uses of
nearest_real_pos.
1. In map_get_player_tile(), I've replaced the nearest_real_pos call
with a CHECK_MAP_POS check (included in map_inx). I haven't verified
that all calls to the code are safe, but (1) the error message that is
currently displayed for non-real tiles is never shown and (2)
extensively running autogames has yet to turn up a failed assert.
Note that Ross's corecleanups return NULL in the case of a non-real map
position, but this isn't desired IMO and isn't feasible at this time
(since it would require converting all uses to check the return value,
which they currently do not do).
2. In auto_settler_do_goto(), it has been simply replaced by
CHECK_MAP_POS. Here I've scanned all the calls to the function, and it
looks like they should all pass Good coordinates. Again there have been
no failed assertions in my autogames.
Note that Ross's corecleanups handle this incorrectly, as they call
normalize_map_pos on the coordinates and ignore the return value
(verboten! Ross, you should know better!). This will result in
unpredictible behavior if non-real coordinates are ever passed in; most
likely (and hopefully) a failed CHECK_MAP_POS check later on when the
coordinates are actually used.
If this patch is applied, the only remaining nearest_real_pos use will
be in map_pos_to_canvas_pos in mapview_common. If one of these places
does need to use nearest_real_pos (which seems inconceivable), a comment
should be added explaining why.
jason
- [Freeciv-Dev] remove nearest_real_pos uses (PR#1211),
jdorje <=
|
|