summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-05-24 13:54:14 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-24 13:54:14 (GMT)
commiteafcdf8ec94b058707f1a6b8a2b9b5076c6275ca (patch)
treee255f2ebfc0d1935209c0de52271e6d5da79df9d /src/main.c
parent128e8c1ff8a27ae96b414bed4cc8f5a294063136 (diff)
downloadpowder-eafcdf8ec94b058707f1a6b8a2b9b5076c6275ca.zip
powder-eafcdf8ec94b058707f1a6b8a2b9b5076c6275ca.tar.gz
Improve error handling on display initialisation
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 7317f45..1f12c3f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1231,11 +1231,18 @@ char my_uri[] = "http://" SERVER "/Update.api?Action=Download&Architecture="
#endif
;
-void set_scale(int scale, int kiosk){
+int set_scale(int scale, int kiosk){
+ int old_scale = sdl_scale, old_kiosk = kiosk_enable;
sdl_scale = scale;
kiosk_enable = kiosk;
- sdl_open();
- return;
+ if (!sdl_open())
+ {
+ sdl_scale = old_scale;
+ kiosk_enable = old_kiosk;
+ sdl_open();
+ return 0;
+ }
+ return 1;
}
void update_grav_async()
@@ -1564,7 +1571,7 @@ int main(int argc, char *argv[])
stamp_init();
- sdl_open();
+ if (!sdl_open()) exit(1);
http_init(http_proxy_string[0] ? http_proxy_string : NULL);
if (cpu_check())