std::vector<twindow_builder::tresolution>::const_iterator get_window_builder(const std::string& type) { twindow::update_screen_size(); std::map<std::string, twindow_builder>::const_iterator window = current_gui->second.window_types.find(type); if(true) { // FIXME Test for default gui. if(window == current_gui->second.window_types.end()) { throw twindow_builder_invalid_id(); } } else { // FIXME Get the definition in the default gui and do an assertion test. } for(std::vector<twindow_builder::tresolution>::const_iterator itor = window->second.resolutions.begin(), end = window->second.resolutions.end(); itor != end; ++itor) { if(settings::screen_width <= itor->window_width && settings::screen_height <= itor->window_height) { return itor; } else if(itor == end - 1) { return itor; } } ERROR_LOG(false); }
std::vector<twindow_builder::tresolution>::const_iterator get_window_builder(const std::string& type) { twindow::update_screen_size(); std::map<std::string, twindow_builder>::const_iterator window = current_gui->second.window_types.find(type); if(window == current_gui->second.window_types.end()) { if(current_gui != default_gui) { window = default_gui->second.window_types.find(type); if(window == default_gui->second.window_types.end()) { throw twindow_builder_invalid_id(); } } else if(window == current_gui->second.window_types.end()) { throw twindow_builder_invalid_id(); } } for(std::vector<twindow_builder::tresolution>::const_iterator itor = window->second.resolutions.begin(), end = window->second.resolutions.end(); itor != end; ++itor) { if(settings::screen_width <= itor->window_width && settings::screen_height <= itor->window_height) { return itor; } else if(itor == end - 1) { return itor; } } FAIL(formatter() << "Window '" << type << "' has no resolutions.\n"); }