Package: rott
Version: 1.1.2+svn287-1
Severity: normal
Tags: patch

Hi,

If someone has installed rott without providing some data in
/usr/share/games/rott; when the game is selected from a desktop environment,
nothing happens. (well something is printed to stderr, but user never sees it)

Here is a patch that forward the message to a dialog box.

Much simpler function "SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,"
is only available for SDL2+.

Screenshot of basicaly the same patch for OpenTyrian:
http://users.teledisnet.be/ade15809/tyrian/

----

Step 2 is appending a Debian-specific wording to "W_InitFiles: no files found"
to let the user known he can automaticaly install the data with game-data-
packager.

Alexandre



-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing'), (450, 'unstable'), (400, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.19.0-trunk-amd64 (SMP w/6 CPU cores)
Locale: LANG=fr_BE.UTF-8, LC_CTYPE=fr_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages rott depends on:
ii  libc6            2.19-18
ii  libsdl-mixer1.2  1.2.12-11+b1
ii  libsdl1.2debian  1.2.15-11

Versions of packages rott recommends:
ii  freepats                20060219-1
ii  game-data-packager      42
ii  musescore-soundfont-gm  1.3+dfsg1-0.1

rott suggests no packages.

-- no debconf information
diff --git a/rott/rt_util.c b/rott/rt_util.c
index e455b5f..f912cb7 100644
--- a/rott/rt_util.c
+++ b/rott/rt_util.c
@@ -446,6 +446,34 @@ void Error (char *error, ...)
    #if USE_SDL
    SDL_Quit();
    #endif
+   #ifdef PLATFORM_UNIX
+   char* argv[6];
+   char zenity_buf[300] = "--text=\0";
+   strncat(zenity_buf,msgbuf,sizeof(zenity_buf)-8);
+   pid_t child_pid;
+   child_pid = fork();
+   if(child_pid == 0) {
+       argv[0] = "zenity";
+       argv[1] = "--error";
+       argv[2] = zenity_buf;
+       argv[3] = "--title=ROTT";
+       argv[4] = NULL;
+       execvp(argv[0], argv);
+       argv[0] = "kdialog";
+       argv[2] = msgbuf;
+       execvp(argv[0], argv);
+       argv[0] = "xmessage";
+       argv[1] = "-center";
+       argv[3] = NULL;
+       execvp(argv[0], argv);
+       argv[0] = "notify-send";
+       argv[1] = "ROTT";
+       argv[3] = "-i";
+       argv[4] = "dialog-error";
+       argv[5] = NULL;
+       execvp(argv[0], argv);
+   }
+   #endif
 
    exit (1);
 }

Reply via email to