2025-08-24 16:08 CEST

spring: develop 06de8718 Diff ] Back to Repository ]
Author Committer Branch Timestamp Parent
Tobi Vollebregt Tobi Vollebregt develop 2009-09-14 15:49:19 develop df540142
Changeset Proper algorithmic improvement to GetClosestEnemyUnit, GetClosestEnemyAircraft

The improvement is that instead of looping over CQuadField::Quad::units,
we loop over all allyteams and then over CQuadField::Quad::teamUnits.

This gives enormous improvement in the common case that not much enemies
are nearby, but many allies are. (As it doesn't loop at all over any of
the nearby allied units.)

(IOW, no need for a cache at all, this is more then twice as fast as cached
original algorithm, as it was in 9246dbf450bbbb0b1ad1db83b0471f7d6a7241db)

Conflicts:

    rts/Game/GameHelper.cpp
mod - rts/Game/GameHelper.cpp Diff ] File ]