[Commits] [wesnoth/wesnoth] b223b3: fixup inefficient invisibility calculation for uni...
GitHub
noreply at github.com
Wed Jul 2 22:33:23 UTC 2014
Branch: refs/heads/master
Home: https://github.com/wesnoth/wesnoth
Commit: b223b37829bd96259c07f26ea66c94e872718a2a
https://github.com/wesnoth/wesnoth/commit/b223b37829bd96259c07f26ea66c94e872718a2a
Author: Chris Beck <render787 at gmail.com>
Date: 2014-07-02 (Wed, 02 Jul 2014)
Changed paths:
M src/unit.cpp
Log Message:
-----------
fixup inefficient invisibility calculation for units
Units have a function with signature
bool unit::invisible(const map_location & loc, bool see_all)
which determines whether the unit, if it is invisible, would be
revealed if it were moved to map_location & loc.
The implementation of this function was needlessly inefficient, it
requires us to loop through the entire unit_map (all of the units)
to determine if any of them could ambush the unit.
However, in the course of this check, it filters out any units
whose location is not adjacent to the target location.
This function is called constantly whenever the display is updated
or the minimap is drawn, or when a unit is moved.
The improved implementation does not loop over all units, instead
it gets the list of (6) map locations which could be adjacent and
have a unit, and then queries for a unit at each of those
locations.
Commit: e8bc775ba498627c404604124234a1ed23daba4b
https://github.com/wesnoth/wesnoth/commit/e8bc775ba498627c404604124234a1ed23daba4b
Author: Chris Beck <render787 at gmail.com>
Date: 2014-07-02 (Wed, 02 Jul 2014)
Changed paths:
M changelog
Log Message:
-----------
changelog
Compare: https://github.com/wesnoth/wesnoth/compare/b70576c52624...e8bc775ba498
More information about the Commits
mailing list