Implement Spartan Chess
[capablanca.git] / lasker-2.2.3 / src / gameproc.c
index 52f42e2..c5f5d35 100644 (file)
@@ -434,18 +434,6 @@ static int was_promoted(struct game *g, int f, int r)
   return 0;
 }
 
-static int is_virgin(struct game *g, int f, int r)
-{
-  int i;
-
-  for (i = g->numHalfMoves-2; i > 0; i -= 2) {
-    if (g->moveList[i].toFile == f && g->moveList[i].toRank == r) {
-      return 0;
-    }
-  }
-  return 1;
-}
-
 int pIsPlaying (int p)
 {
        struct player *pp = &player_globals.parray[p];
@@ -537,7 +525,7 @@ void process_move(int p, char *command)
 {
   struct player *pp = &player_globals.parray[p];
   struct game *gg;
-  int g, result, len, i;
+  int g, result, len, i, f;
   struct move_t move;
   unsigned now = 0;
 
@@ -573,9 +561,9 @@ void process_move(int p, char *command)
   }
   pp->promote = NOPIECE; // [HGM] this seemed to be uninitialized, which caused spurious promotion in Shogi
   if ((len = strlen(command)) > 1) {
-    if (command[len - 2] == '=' || gg->gameState.drops == 2 && command[len - 2] == '/') { // [HGM] encode gating as promotion
+    if (command[len - 2] == '=' || gg->game_state.drops == 2 && command[len - 2] == '/') { // [HGM] encode gating as promotion
 printf("promo '%s'\n", command);
-      switch (tolower(command[strlen(command) - 1])) {
+      switch (tolower(command[len - 1])) {
       case 'n':
        pp->promote = KNIGHT;
        break;
@@ -620,6 +608,12 @@ printf("promo '%s'\n", command);
       case 'g':
        pp->promote = MASTODON;
        break;
+      case 'l':
+       pp->promote = LIEUTENANT;
+       break;
+      case 'k':
+       pp->promote = KING;
+       break;
       // Shogi promotions
       case 'h':
        pp->promote = DRAGONHORSE;