Bug#395217: applying options changes crashes wormux

Hanna Ollila hamaolli at cc.jyu.fi
Sun Nov 12 16:06:17 CET 2006


severity 395217 serious
tags 395217 patch
thanks

Hello,

It seems that the bug was due to a problem of the resolution settings.
Sometimes none of the resolutions available are selected when the program
starts: I only had 1024x768 listed but the program starts with 800x600. We
edited the file in src/menu/options.cpp to always list 800x600 since it is
minimum resolution and also to list the current resolution.

We also changed the break into a continue just in case there are suitable
modes later in the list.

Please find the patch enclosed :)

Regards,
Hanna Ollila

-- 
The early bird catches the worm,
but the second mouse gets the cheese.
-------------- next part --------------
--- wormux-0.7.4/src/menu/options_menu.cpp	2006-08-16 00:29:30.000000000 +0300
+++ wormux-0.7.4-new/src/menu/options_menu.cpp	2006-11-12 16:31:07.000000000 +0200
@@ -132,20 +132,17 @@
   /* Check is there are any modes available */
   AppWormux * app = AppWormux::GetInstance();
 
-  if(modes == (SDL_Rect **)0){
+  std::ostringstream ss,ss2;
+  ss << app->video.window.GetWidth() << "x" << app->video.window.GetHeight();
+  ss2 << "Current ("<< app->video.window.GetWidth() << "x" << app->video.window.GetHeight() << ")";
+  lbox_video_mode->AddItem(true, ss2.str(), ss.str());
+  
+  lbox_video_mode->AddItem(false, "Minimum (800x600)", "800x600");
+  for(int i=0;modes[i];++i) {
+    if (modes[i]->w < 800 || modes[i]->h < 600) continue;
     std::ostringstream ss;
-    ss << app->video.window.GetWidth() << "x" << app->video.window.GetHeight();
-    lbox_video_mode->AddItem(false, "No modes available!", ss.str());
-  } else {
-    for(int i=0;modes[i];++i) {
-      if (modes[i]->w < 800 || modes[i]->h < 600) break;
-      std::ostringstream ss;
-      ss << modes[i]->w << "x" << modes[i]->h ;
-      if (modes[i]->w == app->video.window.GetWidth() && modes[i]->h == app->video.window.GetHeight())
-	lbox_video_mode->AddItem(true, ss.str(), ss.str());
-      else
-	lbox_video_mode->AddItem(false, ss.str(), ss.str());
-    }
+    ss << modes[i]->w << "x" << modes[i]->h ;
+    lbox_video_mode->AddItem(false, ss.str(), ss.str());
   }
 
   // Generate sound mode list


More information about the Pkg-games-devel mailing list