[ create a new paste ] login | about

Link: http://codepad.org/TJJkZPsP    [ raw code | fork ]

C++, pasted on Jun 16:
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 5abe36b..b6b58b8 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -1908,21 +1908,24 @@ void GUIFormSpecMenu::acceptInput(int eventtype)
 					fields[wide_to_narrow(s.fname.c_str())] = ss.str();
 				}
 				else if (s.ftype == f_TabHeader) {
-					gui::IGUITabControl *e =
-						dynamic_cast<gui::IGUITabControl*>(getElementFromId(s.fid));
-
-					if (e != 0) {
+					IGUIElement *e = getElementFromId(s.fid);
+					if(e != NULL)
+					{
+						assert(e->getType() == gui::EGUIET_TAB_CONTROL);
+						gui::IGUITabControl *e_tab =
+							static_cast<gui::IGUITabControl*>(e);
 						std::stringstream ss;
-						ss << (e->getActiveTab() +1);
+						ss << (e_tab->getActiveTab() +1);
 						fields[wide_to_narrow(s.fname.c_str())] = ss.str();
 					}
 				}
 				else if (s.ftype == f_CheckBox) {
-					gui::IGUICheckBox *e =
-						dynamic_cast<gui::IGUICheckBox*>(getElementFromId(s.fid));
-
-					if (e != 0) {
-						if (e->isChecked())
+					IGUIElement *e = getElementFromId(s.fid);
+					if (e != NULL) {
+						assert(e->getType() == gui::EGUIET_CHECK_BOX);
+						gui::IGUICheckBox *e_cb =
+							static_cast<gui::IGUICheckBox*>(e);
+						if (e_cb->isChecked())
 							fields[wide_to_narrow(s.fname.c_str())] = "true";
 						else
 							fields[wide_to_narrow(s.fname.c_str())] = "false";


Create a new paste based on this one


Comments: