Make code a bit more robust at detecting problems (not fixed yet though)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9904 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-09-27 22:53:13 +00:00
parent 29453de9fa
commit 480ab1c436
6 changed files with 18 additions and 2 deletions

View File

@ -628,9 +628,11 @@ EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int
}
else
{
if (w->transmitEvent(w, w->m_properties[PROP_ID], playerID) == EVENT_LET)
std::string id = w->m_properties[PROP_ID];
if (w->transmitEvent(w, id, playerID) == EVENT_LET)
{
sendEventToUser(w, w->m_properties[PROP_ID], playerID);
assert(w->ok());
sendEventToUser(w, id, playerID);
}
}

View File

@ -48,6 +48,9 @@ void CheckBoxWidget::add()
// -----------------------------------------------------------------------------
EventPropagation CheckBoxWidget::transmitEvent(Widget* w, std::string& originator, const int playerID)
{
assert(m_magic_number == 0xCAFEC001);
/* toggle */
m_state = !m_state;

View File

@ -630,6 +630,9 @@ EventPropagation DynamicRibbonWidget::leftPressed(const int playerID)
// -----------------------------------------------------------------------------
EventPropagation DynamicRibbonWidget::transmitEvent(Widget* w, std::string& originator, const int playerID)
{
assert(m_magic_number == 0xCAFEC001);
if (m_deactivated) return EVENT_LET;
if (originator=="left")

View File

@ -361,6 +361,9 @@ void ListWidget::markItemBlue(const int id, bool blue)
EventPropagation ListWidget::transmitEvent(Widget* w, std::string& originator, const int playerID)
{
assert(m_magic_number == 0xCAFEC001);
if (originator.find(m_properties[PROP_ID] + "_column_") != std::string::npos)
{
int col = originator[ (m_properties[PROP_ID] + "_column_").size() ] - '0';

View File

@ -584,6 +584,9 @@ void RibbonWidget::updateSelection()
// -----------------------------------------------------------------------------
EventPropagation RibbonWidget::transmitEvent(Widget* w, std::string& originator, const int playerID)
{
assert(m_magic_number == 0xCAFEC001);
if (!m_deactivated)
{
const int subbuttons_amount = m_children.size();

View File

@ -270,6 +270,8 @@ EventPropagation SpinnerWidget::leftPressed(const int playerID)
EventPropagation SpinnerWidget::transmitEvent(Widget* w, std::string& originator, const int playerID)
{
assert(m_magic_number == 0xCAFEC001);
// if widget is deactivated, do nothing
if (m_deactivated) return EVENT_BLOCK;