mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
optimization
This commit is contained in:
parent
ead5bf92d1
commit
a495248019
@ -41,14 +41,20 @@ bool MouseWatcherGroup::
|
|||||||
add_region(MouseWatcherRegion *region) {
|
add_region(MouseWatcherRegion *region) {
|
||||||
//return _regions.insert(region).second;
|
//return _regions.insert(region).second;
|
||||||
|
|
||||||
// See if the region is in the set/vector already
|
|
||||||
PT(MouseWatcherRegion) pt = region;
|
PT(MouseWatcherRegion) pt = region;
|
||||||
|
|
||||||
|
// We will only bother to check for duplicates in the region list if
|
||||||
|
// we are building opt 1 or 2. The overhead for doing this may be
|
||||||
|
// too high if we have many regions.
|
||||||
|
#ifdef _DEBUG
|
||||||
|
// See if the region is in the set/vector already
|
||||||
Regions::const_iterator ri =
|
Regions::const_iterator ri =
|
||||||
find(_regions.begin(), _regions.end(), pt);
|
find(_regions.begin(), _regions.end(), pt);
|
||||||
if (ri != _regions.end()) {
|
if (ri != _regions.end()) {
|
||||||
// Already in the set, return false
|
// Already in the set, return false
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Not in the set, add it and return true
|
// Not in the set, add it and return true
|
||||||
_regions.push_back(pt);
|
_regions.push_back(pt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user