storm-devs / storm-engine

Game engine behind Sea Dogs, Pirates of the Caribbean and Age of Pirates games.
https://storm-devs.github.io/storm-engine
GNU General Public License v3.0
845 stars 120 forks source link

Prevent crashes when running an empty project in fullscreen mode #487

Closed Hammie closed 1 year ago

Hammie commented 1 year ago

If you create an "empty" project with the following files:

engine.ini

run = main.c

full_screen = 1
screen_x = 1920
screen_y = 1080

main.c

object Render;

int iScriptVersion = 54128;

void Main() {}

the engine would crash if you tabbed out.

This was caused by the fact that no services get initialized by the script, but upon losing focus the sound service is requested to mute the audio. This will then request the render service, which fails to create because it is running in unfocused full-screen mode.

Not a very useful or common scenario, but it's always better for things not to crash.