diff --git a/panda/src/gui/guiButton.cxx b/panda/src/gui/guiButton.cxx index 4c57344d74..8d4830c78a 100644 --- a/panda/src/gui/guiButton.cxx +++ b/panda/src/gui/guiButton.cxx @@ -77,7 +77,7 @@ static void exit_button(CPT_Event e) { static void click_button_down(CPT_Event e) { const MouseWatcherRegion* rgn = DCAST(MouseWatcherRegion, e->get_parameter(0).get_ptr()); string button = e->get_parameter(1).get_string_value(); - if ((button != "mouse1") && (button != "mouse2") && (button != "mouse3")) + if (!(button == "mouse1" || button == "mouse2" || button == "mouse3")) return; GuiButton* val = find_in_buttons_map(rgn); if (val == (GuiButton *)0L) @@ -89,7 +89,7 @@ static void click_button_down(CPT_Event e) { static void click_button_up(CPT_Event e) { const MouseWatcherRegion* rgn = DCAST(MouseWatcherRegion, e->get_parameter(0).get_ptr()); string button = e->get_parameter(1).get_string_value(); - if ((button != "mouse1") && (button != "mouse2") && (button != "mouse3")) + if (!(button == "mouse1" || button == "mouse2" || button == "mouse3")) return; GuiButton* val = find_in_buttons_map(rgn); if (val == (GuiButton *)0L) @@ -471,7 +471,7 @@ GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down) _rgn = new MouseWatcherRegion("button-" + name, _left, _right, _bottom, _top); _rgn->set_suppress_below(true); - buttons[this->_rgn] = this; + buttons[this->_rgn.p()] = this; } GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down, @@ -491,7 +491,7 @@ GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down, _rgn = new MouseWatcherRegion("button-" + name, _left, _right, _bottom, _top); _rgn->set_suppress_below(true); - buttons[this->_rgn] = this; + buttons[this->_rgn.p()] = this; } GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* up_roll, @@ -512,7 +512,7 @@ GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* up_roll, _rgn = new MouseWatcherRegion("button-" + name, _left, _right, _bottom, _top); _rgn->set_suppress_below(true); - buttons[this->_rgn] = this; + buttons[this->_rgn.p()] = this; } GuiButton::~GuiButton(void) { @@ -521,7 +521,7 @@ GuiButton::~GuiButton(void) { // Remove the names from the buttons map, so we don't end up with // an invalid pointer. string name = get_name(); - buttons.erase(this->_rgn); + buttons.erase(this->_rgn.p()); if ((buttons.size() == 0) && added_hooks) { _eh->remove_hook("gui-enter", enter_button); _eh->remove_hook("gui-exit" + get_name(), exit_button); diff --git a/panda/src/gui/guiRollover.cxx b/panda/src/gui/guiRollover.cxx index e9107a99e3..13f05f6e40 100644 --- a/panda/src/gui/guiRollover.cxx +++ b/panda/src/gui/guiRollover.cxx @@ -75,7 +75,7 @@ GuiRollover::GuiRollover(const string& name, GuiLabel* off, GuiLabel* on) _rgn = new MouseWatcherRegion("rollover-" + name, _left, _right, _bottom, _top); _rgn->set_suppress_below(false); - rollovers[this->_rgn] = this; + rollovers[this->_rgn.p()] = this; } GuiRollover::~GuiRollover(void) { @@ -84,7 +84,7 @@ GuiRollover::~GuiRollover(void) { // Remove the names from the rollovers map, so we don't end up with // an invalid pointer. string name = get_name(); - rollovers.erase(this->_rgn); + rollovers.erase(this->_rgn.p()); if ((rollovers.size() == 0) && added_hooks) { _eh->remove_hook("gui-enter", enter_rollover); _eh->remove_hook("gui-exit", exit_rollover);