Merge lp:~qcumber-some/widelands/bug704637 into lp:widelands

Proposed by Jens Beyer
Status: Merged
Merged at revision: 6520
Proposed branch: lp:~qcumber-some/widelands/bug704637
Merge into: lp:widelands
Diff against target: 47 lines (+16/-4)
2 files modified
src/constants.h (+4/-0)
src/graphic/graphic.cc (+12/-4)
To merge this branch: bzr merge lp:~qcumber-some/widelands/bug704637
Reviewer Review Type Date Requested Status
SirVer Approve
Jens Beyer Needs Resubmitting
Review via email: mp+150915@code.launchpad.net

Description of the change

Just as hjd proposed in the bug, simply try to fall back to default settings if the other two tries fail.

Interesting "feature" is, that the setting from .config file is still visible in the config screen, while the window is in tiny 640x480. I don't think this is a bug, but you may comment on that.

I don't know if we should tell the user that something's wrong, this could be quite difficult this early in the game. On the other hand, if I am faced by this tiny window, I am definitely looking for the graphics configuration ingame to fix it, so I will see my mistake.

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

Thanks for tackling this!

Move the second check (!sdlsurface) into the first - otherwise you check twice for the same condition. I suggest merging the log's into one. And I suggest making the minimum graphics explicit via some consts in constants.h or widelands.h.

review: Needs Fixing
Revision history for this message
Jens Beyer (qcumber-some) wrote :

Updated as suggested.

review: Needs Resubmitting
Revision history for this message
SirVer (sirver) wrote :

Cool. One more thing I noticed: when disabling opengl, g_opengl (a global variable) must also be set to false. Can you make sure this is the case here? I think this is then ready for merging - feel free to do it yourself or ping me so I can do it. Thanks for fixing this issue!

And secondly - this will still seem strange to users. They choose one mode but they get a completely different one without noticfication (because most will not read the console output). I have no idea how to solve this properly though - some kind of state must be passed back and conserved till we could display a message box. Well, we can find a solution in another patch for this.

review: Approve
Revision history for this message
Jens Beyer (qcumber-some) wrote :

I didn't do anything to OpenGL.

If I understand the code correctly, the OpenGL stuff is before, and when we arrive at line 31, in the case of !sdl_surface, opengl is already false anyway, and flags is set &~SDL_OPENGL.

So the handling of the OpenGL stuff is completely untouched by me.

Maybe someone else can check on this, too. If noone objects, I'll merge this tonight.

Revision history for this message
SirVer (sirver) wrote :

I just checked the code and you are right, this does not need any changes to g_opengl. Thanks for caring for this bug!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/constants.h'
--- src/constants.h 2013-02-11 19:51:33 +0000
+++ src/constants.h 2013-02-28 15:58:25 +0000
@@ -41,6 +41,10 @@
41#define XRES 800 ///< Fullscreen Menu Width41#define XRES 800 ///< Fullscreen Menu Width
42#define YRES 600 ///< Fullscreen Menu Height42#define YRES 600 ///< Fullscreen Menu Height
4343
44#define FALLBACK_GRAPHICS_WIDTH 640
45#define FALLBACK_GRAPHICS_HEIGHT 480
46#define FALLBACK_GRAPHICS_DEPTH 16
47
44/// \name Fonts48/// \name Fonts
45/// Font constants, defined including size49/// Font constants, defined including size
46//@{50//@{
4751
=== modified file 'src/graphic/graphic.cc'
--- src/graphic/graphic.cc 2013-02-16 08:02:26 +0000
+++ src/graphic/graphic.cc 2013-02-28 15:58:25 +0000
@@ -119,16 +119,24 @@
119 // If we tried opengl and it was not successful try without opengl119 // If we tried opengl and it was not successful try without opengl
120 if (!sdlsurface and opengl)120 if (!sdlsurface and opengl)
121 {121 {
122 log("Graphics: Could not set videomode: %s\n", SDL_GetError());122 log("Graphics: Could not set videomode: %s, trying without opengl\n", SDL_GetError());
123 log("Graphics: Trying without opengl\n");
124 flags &= ~SDL_OPENGL;123 flags &= ~SDL_OPENGL;
125 sdlsurface = SDL_SetVideoMode(w, h, bpp, flags);124 sdlsurface = SDL_SetVideoMode(w, h, bpp, flags);
126 }125 }
127#endif126#endif
128127
129 if (!sdlsurface)128 if (!sdlsurface)
130 throw wexception129 {
131 ("Graphics: could not set video mode: %s", SDL_GetError());130 log
131 ("Graphics: Could not set videomode: %s, trying minimum graphics settings\n",
132 SDL_GetError());
133 flags &= ~SDL_FULLSCREEN;
134 sdlsurface = SDL_SetVideoMode
135 (FALLBACK_GRAPHICS_WIDTH, FALLBACK_GRAPHICS_HEIGHT, FALLBACK_GRAPHICS_DEPTH, flags);
136 if (!sdlsurface)
137 throw wexception
138 ("Graphics: could not set video mode: %s", SDL_GetError());
139 }
132140
133 // setting the videomode was successful. Print some information now141 // setting the videomode was successful. Print some information now
134 log("Graphics: Setting video mode was successful\n");142 log("Graphics: Setting video mode was successful\n");

Subscribers

People subscribed via source and target branches

to status/vote changes: