Finally get rid of that highly non-standard use of SIGINT.
[gnushogi.git] / gnushogi / init.c
index ffef1f4..7b9663b 100644 (file)
@@ -2,11 +2,14 @@
  * FILE: init.c
  *
  * ----------------------------------------------------------------------
- *
- * Copyright (c) 2012 Free Software Foundation
+ * Copyright (c) 1993, 1994, 1995 Matthias Mutz
+ * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
  *
  * GNU SHOGI is based on GNU CHESS
  *
+ * Copyright (c) 1988, 1989, 1990 John Stanback
+ * Copyright (c) 1992 Free Software Foundation
+ *
  * This file is part of GNU SHOGI.
  *
  * GNU Shogi is free software; you can redistribute it and/or modify it
@@ -310,12 +313,12 @@ Initialize_dist(void)
 
 
 /*
- * nextpos[piece][from-square], nextdir[piece][from-square] gives vector
- * of positions reachable from from-square in ppos with piece such that the
+ * nextpos[ptype][from-square], nextdir[ptype][from-square] gives vector
+ * of positions reachable from from-square in ppos with ptype such that the
  * sequence
  *
- *     ppos = nextpos[piece][from-square];
- *     pdir = nextdir[piece][from-square];
+ *     ppos = nextpos[ptype][from-square];
+ *     pdir = nextdir[ptype][from-square];
  *     u = ppos[sq];
  *
  *     do
@@ -400,7 +403,7 @@ const small_short direc[NO_PTYPE_PIECES][8] =
 
 small_short diagonal(short d)
 {
-    return (abs(d) == 10 || abs(d) == 12);
+  return (abs(d) == (NO_COLS+1) || abs(d) == (NO_COLS+3));
 }
 
 
@@ -512,8 +515,11 @@ Initialize_moves(void)
     short dest[8][9];
     short sorted[9];
     short steps[8];
-    short fpo = 23, tpo = 120;
+    short fpo = inunmap[0], tpo = 1 + inunmap[NO_SQUARES-1];
 
+    /* pre-fill nextpos and nextdir with source position, probably so
+     * (color[u] == neutral) stops to match once all moves have been seen
+     */
     for (ptyp = 0; ptyp < NO_PTYPE_PIECES; ptyp++)
     {
         for (po = 0; po < NO_SQUARES; po++)
@@ -1271,8 +1277,6 @@ InitMain(void)
 
     if (XSHOGI)
     {
-        signal(SIGUSR1, TerminateSearch);
-
         TCmoves      = 40;
         TCminutes    = 5;
         TCseconds    = 0;