turn window bigger, and block alarm when refreshing
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Sat, 10 Dec 1983 05:32:09 +0000 (21:32 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Sat, 10 Dec 1983 05:32:09 +0000 (21:32 -0800)
SCCS-vsn: games/sail/player.h 2.4
SCCS-vsn: games/sail/pl_1.c 2.4
SCCS-vsn: games/sail/pl_2.c 2.3
SCCS-vsn: games/sail/pl_3.c 2.2
SCCS-vsn: games/sail/pl_5.c 2.2
SCCS-vsn: games/sail/pl_6.c 2.2
SCCS-vsn: games/sail/pl_7.c 2.4

usr/src/games/sail/pl_1.c
usr/src/games/sail/pl_2.c
usr/src/games/sail/pl_3.c
usr/src/games/sail/pl_5.c
usr/src/games/sail/pl_6.c
usr/src/games/sail/pl_7.c
usr/src/games/sail/player.h

index c36d3e0..c68279e 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)pl_1.c      2.3 83/11/02";
+static char *sccsid = "@(#)pl_1.c      2.4 83/12/09";
 #endif
 
 #include "player.h"
 #endif
 
 #include "player.h"
@@ -234,7 +234,9 @@ reprint:
        }
 
        initscreen();
        }
 
        initscreen();
+       blockalarm();
        draw_board();
        draw_board();
+       unblockalarm();
        (void) sprintf(message, "Captain %s assuming command", captain);
        Write(W_SIGNAL, ms, 1, (int)message, 0, 0, 0);
        newturn();
        (void) sprintf(message, "Captain %s assuming command", captain);
        Write(W_SIGNAL, ms, 1, (int)message, 0, 0, 0);
        newturn();
index 3abcd5c..b5e27c2 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)pl_2.c      2.2 83/11/08";
+static char *sccsid = "@(#)pl_2.c      2.3 83/12/09";
 #endif
 
 #include "player.h"
 #endif
 
 #include "player.h"
@@ -47,8 +47,10 @@ play()
                        break;
                case '\f':
                        centerview();
                        break;
                case '\f':
                        centerview();
+                       blockalarm();
                        draw_board();
                        draw_screen();
                        draw_board();
                        draw_screen();
+                       unblockalarm();
                        break;
                case 'L':
                        mf->loadL = L_EMPTY;
                        break;
                case 'L':
                        mf->loadL = L_EMPTY;
@@ -76,31 +78,43 @@ play()
                        break;
                case 'C':
                        centerview();
                        break;
                case 'C':
                        centerview();
+                       blockalarm();
                        draw_view();
                        draw_view();
+                       unblockalarm();
                        break;
                case 'U':
                        upview();
                        break;
                case 'U':
                        upview();
+                       blockalarm();
                        draw_view();
                        draw_view();
+                       unblockalarm();
                        break;
                case 'D':
                case 'N':
                        downview();
                        break;
                case 'D':
                case 'N':
                        downview();
+                       blockalarm();
                        draw_view();
                        draw_view();
+                       unblockalarm();
                        break;
                case 'H':
                        leftview();
                        break;
                case 'H':
                        leftview();
+                       blockalarm();
                        draw_view();
                        draw_view();
+                       unblockalarm();
                        break;
                case 'J':
                        rightview();
                        break;
                case 'J':
                        rightview();
+                       blockalarm();
                        draw_view();
                        draw_view();
+                       unblockalarm();
                        break;
                case 'F':
                        lookout();
                        break;
                case 'S':
                        dont_adjust = !dont_adjust;
                        break;
                case 'F':
                        lookout();
                        break;
                case 'S':
                        dont_adjust = !dont_adjust;
+                       blockalarm();
                        draw_turn();
                        draw_turn();
+                       unblockalarm();
                        break;
                }
        }
                        break;
                }
        }
index 9355a66..5f9bfe7 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)pl_3.c      2.1 83/10/31";
+static char *sccsid = "@(#)pl_3.c      2.2 83/12/09";
 #endif
 
 #include "player.h"
 #endif
 
 #include "player.h"
@@ -170,7 +170,9 @@ acceptcombat()
                Signal("Unable to fire %s broadside",
                        (struct ship *)0, r ? "right" : "left");
        }
                Signal("Unable to fire %s broadside",
                        (struct ship *)0, r ? "right" : "left");
        }
+       blockalarm();
        draw_stat();
        draw_stat();
+       unblockalarm();
 }
 
 grapungrap()
 }
 
 grapungrap()
index d512fd1..b026f1d 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)pl_5.c      2.1 83/10/31";
+static char *sccsid = "@(#)pl_5.c      2.2 83/12/09";
 #endif
 
 #include "player.h"
 #endif
 
 #include "player.h"
@@ -157,7 +157,9 @@ acceptboard()
                        (struct ship *)0, 1);
                parties(crew, ms, 1, c);
        }
                        (struct ship *)0, 1);
                parties(crew, ms, 1, c);
        }
+       blockalarm();
        draw_slot();
        draw_slot();
+       unblockalarm();
 }
 
 parties(crew, to, isdefense, buf)
 }
 
 parties(crew, to, isdefense, buf)
index 8446a0b..054291b 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)pl_6.c      2.1 83/10/31";
+static char *sccsid = "@(#)pl_6.c      2.2 83/12/09";
 #endif
 
 #include "player.h"
 #endif
 
 #include "player.h"
@@ -73,10 +73,14 @@ repair()
                        *repairs = 2;
                } else {
                        *repairs = 0;
                        *repairs = 2;
                } else {
                        *repairs = 0;
+                       blockalarm();
                        draw_stat();
                        draw_stat();
+                       unblockalarm();
                }
        }
                }
        }
+       blockalarm();
        draw_slot();
        draw_slot();
+       unblockalarm();
 }
 
 turned()
 }
 
 turned()
index f7a4009..36daf48 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)pl_7.c      2.3 83/11/08";
+static char *sccsid = "@(#)pl_7.c      2.4 83/12/09";
 #endif
 
 #include "player.h"
 #endif
 
 #include "player.h"
@@ -32,6 +32,7 @@ initscreen()
 
 cleanupscreen()
 {
 
 cleanupscreen()
 {
+       /* alarm already turned off */
        if (done_curses) {
                (void) wmove(scroll_w, SCROLL_Y - 1, 0);
                (void) wclrtoeol(scroll_w);
        if (done_curses) {
                (void) wmove(scroll_w, SCROLL_Y - 1, 0);
                (void) wclrtoeol(scroll_w);
index cd967e4..5864064 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * sccsid = "@(#)player.h      2.3 %G%";
+ * sccsid = "@(#)player.h      2.4 %G%";
  */
 #include <curses.h>
 #include "externs.h"
  */
 #include <curses.h>
 #include "externs.h"
@@ -21,7 +21,7 @@
 #define BOX_R          (BOX_L+BOX_X-1)
 
 #define TURN_T         BOX_B
 #define BOX_R          (BOX_L+BOX_X-1)
 
 #define TURN_T         BOX_B
-#define TURN_X         8
+#define TURN_X         9
 #define TURN_L         ((BOX_L+BOX_R-TURN_X)/2)
 #define TURN_Y         1
 #define TURN_B         (TURN_T+TURN_Y+1)
 #define TURN_L         ((BOX_L+BOX_R-TURN_X)/2)
 #define TURN_Y         1
 #define TURN_B         (TURN_T+TURN_Y+1)
@@ -81,3 +81,6 @@ struct shipspecs *mc;         /* ms->specs */
 #define LEAVE_HURRICAN 2
 #define LEAVE_DRIVER   3
 #define LEAVE_FORK     4
 #define LEAVE_HURRICAN 2
 #define LEAVE_DRIVER   3
 #define LEAVE_FORK     4
+
+#define blockalarm()   ((void) sigblock(1 << SIGALRM-1))
+#define unblockalarm() ((void) sigsetmask(sigblock(0) & ~(1 << SIGALRM-1)))