Refactor needlessly-complicated Raw_SelectLevel.
[gnushogi.git] / gnushogi / commondsp.c
index a5a3b42..422dab6 100644 (file)
@@ -124,8 +124,6 @@ movealgbr(short m, char *s)
 #endif /* BOOKTEST */
 
 
-
-
 /*
  * Generate move strings in different formats.
  *
@@ -217,7 +215,6 @@ algbr(short f, short t, short flag)
 }
 
 
-
 /*
  * Compare the string 's' to the list of legal moves available for the
  * opponent. If a match is found, make the move on the board.
@@ -352,9 +349,8 @@ VerifyMove(char *s, VerifyMove_mode iop, unsigned short *mv)
 }
 
 
-
 static int
-parser(char *f, int side, short *fpiece)
+parser(char *f, short *fpiece)
 {
     int c1, r1, c2, r2;
     short i, p = false;
@@ -402,7 +398,6 @@ skip()
 }
 
 
-
 void
 skipb()
 {
@@ -593,7 +588,7 @@ GetGame(void)
             InPtr = fname;
             skipb();
             g = &GameList[GameCnt];
-            g->gmove = parser(InPtr, side, &g->fpiece);
+            g->gmove = parser(InPtr, &g->fpiece);
             skip();
             g->score = atoi(InPtr);
             skip();
@@ -652,7 +647,6 @@ GetGame(void)
 }
 
 
-
 void
 SaveGame(void)
 {
@@ -800,7 +794,6 @@ SaveGame(void)
 }
 
 
-
 /*
  * GetXGame, SaveXGame and BookGame used to only be defined if
  * xshogi wasn't defined -- wonder why?
@@ -1107,7 +1100,6 @@ BookSave(void)
 }
 
 
-
 void
 ListGame(void)
 {
@@ -1235,7 +1227,6 @@ ListGame(void)
 }
 
 
-
 void
 FlagMove(char c)
 {
@@ -1258,8 +1249,6 @@ FlagMove(char c)
 }
 
 
-
-
 /*
  * Undo the most recent half-move.
  */
@@ -1321,7 +1310,6 @@ Undo(void)
 }
 
 
-
 void
 FlagString(unsigned short flags, char *s)
 {
@@ -1374,7 +1362,6 @@ FlagString(unsigned short flags, char *s)
 }
 
 
-
 void
 TestSpeed(void(*f)(short side, short ply,
                    short in_check, short blockable),
@@ -1429,11 +1416,10 @@ TestSpeed(void(*f)(short side, short ply,
 }
 
 
-
 void
 TestPSpeed(short(*f) (short side), unsigned j)
 {
-    short i;
+    unsigned i;
     long cnt, t1, t2;
 #ifdef HAVE_GETTIMEOFDAY
     struct timeval tv;
@@ -1467,7 +1453,6 @@ TestPSpeed(short(*f) (short side), unsigned j)
 }
 
 
-
 void
 SetOppTime(char *s)
 {
@@ -1481,6 +1466,7 @@ SetOppTime(char *s)
     if (*time == ':')
     {
         time++;
+       /* FIXME: sec is parsed but ignored */
         sec = (int)strtol(time, &time, 10);
     }
 
@@ -1502,7 +1488,6 @@ SetOppTime(char *s)
 }
 
 
-
 void
 SetMachineTime(char *s)
 {
@@ -1516,6 +1501,7 @@ SetMachineTime(char *s)
     if (*time == ':')
     {
         time++;
+       /* FIXME: sec is parsed but ignored */
         sec = (int)strtol(time, &time, 10);
     }
 
@@ -1537,9 +1523,6 @@ SetMachineTime(char *s)
 }
 
 
-
-
-
 /* FIXME!  This is truly the function from hell! */
 
 /*
@@ -1761,10 +1744,13 @@ InputCommand(char *command)
         {
             ListGame();
         }
-        else if ((strcmp(s, "level") == 0)
-                 || (strcmp(s, "clock") == 0))
+        else if (strcmp(s, "level") == 0)
+        {
+            dsp->SelectLevel(sx + strlen("level"));
+        }
+        else if (strcmp(s, "clock") == 0)
         {
-            dsp->SelectLevel(sx);
+            dsp->SelectLevel(sx + strlen("clock"));
         }
         else if (strcmp(s, "hash") == 0)
         {
@@ -2061,8 +2047,6 @@ InputCommand(char *command)
 }
 
 
-
-
 void
 SetTimeControl(void)
 {