icculus / Serious-Engine

An open source version of a game engine developed by Croteam for the classic Serious Sam games.
GNU General Public License v2.0
164 stars 21 forks source link

avoid assert when 640x480 resolution not found #64

Open comicfans opened 8 years ago

comicfans commented 8 years ago

original code search 640x480 as fallback resolution, and crash if not found, but this resolution is not always avaible. this fix just return last resolution (which is lowest). this may fix #60 (not confirmed)

yamgent commented 8 years ago

I feel that, instead of removing the assert completely, it should check for extreme cases where no resolutions were given at all, i.e.

ASSERT(_ctResolutions <= 0);
comicfans commented 8 years ago

if no resolution avaible , can SDL video init successful ? (I've not check the whole logic flow, not sure if these resolution detected by SDL)

yamgent commented 8 years ago

The list of resolutions are not generated by SDL afaik.

That's kinda the point of assertions though, no need to second guess the assumptions, just test them :).