Use the new assert macros and fixed a bug in them.

This commit is contained in:
Mark de Wever 2008-12-07 09:54:31 +00:00
parent 687abbab11
commit d1e3e29419
2 changed files with 4 additions and 5 deletions

View file

@ -35,7 +35,7 @@
//for custom logging. Example usage:
//assert_log(x != y, "x not equal to y. Value of x: " << x << ", y: " << y);
#define ASSERT_LOG(a,b) if( !(a) ) { std::cerr << __FILE__ << ":" << __LINE__ << " ASSSERTION FAILED: " << (b) << "\n"; abort(); }
#define ASSERT_LOG(a,b) if( !(a) ) { std::cerr << __FILE__ << ":" << __LINE__ << " ASSSERTION FAILED: " << b << "\n"; abort(); }
#endif

View file

@ -18,6 +18,7 @@
*/
#include "asserts.hpp"
#include "filesystem.hpp"
#include "gettext.hpp"
#include "gui/widgets/window.hpp"
@ -1208,10 +1209,8 @@ tresolution_definition_ptr get_control(
const tgui_definition::tcontrol_definition_map::const_iterator
control_definition = current_gui->second.control_definition.find(control_type);
if(control_definition == current_gui->second.control_definition.end()) {
ERR_GUI << "Type '" << control_type << "' is unknown.\n";
assert(false);
}
ASSERT_LOG(control_definition != current_gui->second.control_definition.end(),
"Type '" << control_type << "' is unknown.");
std::map<std::string, tcontrol_definition_ptr>::const_iterator
control = control_definition->second.find(definition);