para_server: New command line option: --autoplay_delay
[paraslash.git] / sdl_gui.c
index b67b3d1e48554993f61f836e5bc3a60e23f828a1..97d0573a8e3b455a95e26139a9c1ee30c30682e8 100644 (file)
--- a/sdl_gui.c
+++ b/sdl_gui.c
@@ -356,7 +356,7 @@ static void init_SDL(void)
        SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE);
        /* Set the window manager title bar */
        SDL_WM_SetCaption("The Gui of death that makes you blind (paraslash "
        SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE);
        /* Set the window manager title bar */
        SDL_WM_SetCaption("The Gui of death that makes you blind (paraslash "
-               VERSION ")", "SFont");
+               PACKAGE_VERSION ")", "SFont");
 }
 
 /*
 }
 
 /*
@@ -739,7 +739,7 @@ static int configfile_exists(void)
  */
 int main(int argc, char *argv[])
 {
  */
 int main(int argc, char *argv[])
 {
-       int i, ret, fd;
+       int i, ret, fd = -1;
        SDLKey sym;
 
        sdl_gui_cmdline_parser(argc, argv, &args_info);
        SDLKey sym;
 
        sdl_gui_cmdline_parser(argc, argv, &args_info);
@@ -759,7 +759,6 @@ int main(int argc, char *argv[])
        height = args_info.height_arg;
 //     printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg);
        init_stat_items();
        height = args_info.height_arg;
 //     printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg);
        init_stat_items();
-       fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
        init_SDL();
        for (i = 0; fonts[i].name[0]; i++) {
                char buf[MAXLINE];
        init_SDL();
        for (i = 0; fonts[i].name[0]; i++) {
                char buf[MAXLINE];
@@ -775,6 +774,11 @@ int main(int argc, char *argv[])
                update_input();
        }
        for (;;) {
                update_input();
        }
        for (;;) {
+               if (fd < 0) {
+                       fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
+                       if (fd < 0)
+                               clean_exit(EXIT_FAILURE);
+               }
                ret = draw_status(fd);
                if (ret < 0) {
                        close(fd);
                ret = draw_status(fd);
                if (ret < 0) {
                        close(fd);
@@ -802,10 +806,6 @@ int main(int argc, char *argv[])
                                || sym == SDLK_COMPOSE
                                )
                                continue;
                                || sym == SDLK_COMPOSE
                                )
                                continue;
-                       if (fd < 0) {
-                               kill(0, SIGINT);
-                               close(fd);
-                       }
                        fill_input_rect();
                        update_input();
                        if (!command_handler())
                        fill_input_rect();
                        update_input();
                        if (!command_handler())
@@ -814,7 +814,6 @@ int main(int argc, char *argv[])
                        print_help();
                        update_pic();
                        SDL_UpdateRect(screen, 0, 0, 0, 0);
                        print_help();
                        update_pic();
                        SDL_UpdateRect(screen, 0, 0, 0, 0);
-                       fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
                        break;
                }
        }
                        break;
                }
        }