diff --git a/panda/src/tform/mouseWatcher.cxx b/panda/src/tform/mouseWatcher.cxx index 7e87efde52..f4a868c302 100644 --- a/panda/src/tform/mouseWatcher.cxx +++ b/panda/src/tform/mouseWatcher.cxx @@ -174,8 +174,21 @@ write(ostream &out, int indent_level) const { // false if it was already on the list. //////////////////////////////////////////////////////////////////// bool MouseWatcher:: -add_group(MouseWatcherGroup *group) { - return _groups.insert(group).second; +add_group(PT(MouseWatcherGroup) group) { + // return _groups.insert(group).second; + + // See if the group is in the set/vector already + Groups::const_iterator gi = find(_groups.begin(), + _groups.end(), + group); + if (gi != _groups.end()) { + // Already in the set, return false + return false; + } + + // Not in the set, add it and return true + _groups.push_back(group); + return true; } //////////////////////////////////////////////////////////////////// @@ -187,7 +200,7 @@ add_group(MouseWatcherGroup *group) { // removed or was never added via add_group(). //////////////////////////////////////////////////////////////////// bool MouseWatcher:: -remove_group(MouseWatcherGroup *group) { +remove_group(PT(MouseWatcherGroup) group) { remove_regions_from(_current_regions, group); if (group->has_region(_preferred_region)) { _preferred_region = (MouseWatcherRegion *)NULL; @@ -196,7 +209,18 @@ remove_group(MouseWatcherGroup *group) { _preferred_button_down_region = (MouseWatcherRegion *)NULL; } - return _groups.erase(group) != 0; + // See if the group is in the set/vector + Groups::iterator gi = find(_groups.begin(), + _groups.end(), + group); + if (gi != _groups.end()) { + // Found it, now erase it + _groups.erase(gi); + return true; + } + + // Did not find the group to erase + return false; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/tform/mouseWatcher.h b/panda/src/tform/mouseWatcher.h index 34631f27fd..5be5a48b74 100644 --- a/panda/src/tform/mouseWatcher.h +++ b/panda/src/tform/mouseWatcher.h @@ -34,7 +34,7 @@ #include "modifierButtons.h" #include "buttonHandle.h" -#include "pset.h" +#include "pvector.h" class MouseWatcherParameter; @@ -110,8 +110,8 @@ public: virtual void output(ostream &out) const; virtual void write(ostream &out, int indent_level = 0) const; - bool add_group(MouseWatcherGroup *group); - bool remove_group(MouseWatcherGroup *group); + bool add_group(PT(MouseWatcherGroup) group); + bool remove_group(PT(MouseWatcherGroup) group); protected: typedef pvector< PT(MouseWatcherRegion) > VRegions; @@ -143,7 +143,9 @@ protected: void enter_region(MouseWatcherRegion *region, const MouseWatcherParameter ¶m); void exit_region(MouseWatcherRegion *region, const MouseWatcherParameter ¶m); - typedef pset< PT(MouseWatcherGroup) > Groups; + // This wants to be a set, but because you cannot export sets across + // dlls in windows, we will make it a vector instead + typedef pvector< PT(MouseWatcherGroup) > Groups; Groups _groups; bool _has_mouse;