]> skyeroc.xyz Git - dgamelaunch/commitdiff
add redraw command to redraw the banner when info might change
authorTangles <andyrthomson@gmail.com>
Wed, 22 Jan 2020 14:22:32 +0000 (01:22 +1100)
committerTangles <andyrthomson@gmail.com>
Wed, 22 Jan 2020 14:22:32 +0000 (01:22 +1100)
config.l
dgamelaunch.c
dgamelaunch.h
dgl-common.c

index 73def409ebd42eff5dd079674a5ef727ea4b3a2e..52a29d0fdbef011ed2c3847f334925ffc900490e 100644 (file)
--- a/config.l
+++ b/config.l
@@ -138,6 +138,7 @@ play_game   { yylval.i = DGLCMD_PLAYGAME;    return TYPE_DGLCMD1; }
 play_if_exist  { yylval.i = DGLCMD_PLAY_IF_EXIST;    return TYPE_DGLCMD2; }
 submenu                { yylval.i = DGLCMD_SUBMENU;     return TYPE_DGLCMD1; }
 return         { yylval.i = DGLCMD_RETURN;      return TYPE_DGLCMD0; }
+redraw         { yylval.i = DGLCMD_REDRAW;     return TYPE_DGLCMD0; }
 rawprint       { yylval.i = DGLCMD_RAWPRINT;    return TYPE_DGLCMD1; }
 DEFINE         { return TYPE_DEFINE_GAME; }
 
index 9845eba40ff22849e315436609be4f67f2ae788c..eea98acadcbe139291f404094e2b4cfee3e371de 100644 (file)
@@ -2173,7 +2173,7 @@ int
 readprefs ()
 {
     FILE *upf;
-    struct userpref **cpref = &userprefs;
+    struct userpref **cpref;
     int prefcount = 0;
     char buf[256];
     char *p;
@@ -2183,6 +2183,7 @@ readprefs ()
     freeprefs();
     upf = fopen(userpref_path, "r");
     if (!upf) return -1;
+    cpref = &userprefs;
     while (fgets(buf, 256, upf)) {
         /* first token is 'name' - must start with letter */
         /* skip over any leading non-letter garbage */
@@ -2860,6 +2861,12 @@ runmenuloop(struct dg_menu *menu)
                tmpopt = tmpopt->next;
            }
        }
+        if (redraw_banner) {
+            redraw_banner = 0;
+            freebanner(&ban);
+            loadbanner(menu->banner_fn, &ban);
+            doclear = 1;
+        }
 
        if (return_from_submenu) {
            freebanner(&ban);
index d8516121362e48ffb556003600fc9bd67991eaa2..f561f6a999fa357df9c8fd22a24539a726f9e7e5 100644 (file)
@@ -80,6 +80,7 @@ typedef enum
     DGLCMD_PLAYGAME,   /* play_game "foo" */
     DGLCMD_PLAY_IF_EXIST,      /* play_if_exist "game" "file" */
     DGLCMD_SUBMENU,    /* submenu "foo" */
+    DGLCMD_REDRAW,     /* redraw */
     DGLCMD_RETURN      /* return */
 } dglcmd_actions;
 
@@ -278,6 +279,7 @@ extern int set_max;
 
 extern int selected_game;
 extern int return_from_submenu;
+extern int redraw_banner;
 
 extern struct dg_globalconfig globalconfig;
 
index 0bccdeb61ddb1934031e2b87602bebc626b58ce2..514b361e4ee30ee0893a6bc6d88917fe9a79029a 100644 (file)
@@ -58,6 +58,7 @@ int curses_resize = 0;
 
 int selected_game = 0;
 int return_from_submenu = 0;
+int redraw_banner = 0;
 char *userpref_path = NULL;
 
 mode_t default_fmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
@@ -411,6 +412,9 @@ dgl_exec_cmdqueue_w(struct dg_cmdpart *queue, int game, struct dg_user *me, char
            if (p1)
                runmenuloop(dgl_find_menu(p1));
            break;
+       case DGLCMD_REDRAW:
+           redraw_banner = 1;
+           break;
        case DGLCMD_RETURN:
            return_from_submenu = 1;
            break;