{
ListGame();
}
- else if ((strcmp(s, "level") == 0)
- || (strcmp(s, "clock") == 0))
+ else if (strcmp(s, "level") == 0)
{
- dsp->SelectLevel(sx);
+ dsp->SelectLevel(sx + strlen("level"));
+ }
+ else if (strcmp(s, "clock") == 0)
+ {
+ dsp->SelectLevel(sx + strlen("clock"));
}
else if (strcmp(s, "hash") == 0)
{
void
Raw_SelectLevel(char *sx)
{
+ char T[NO_SQUARES + 1], *p;
- char T[NO_SQUARES + 1], *p, *q;
+ strncpy(T, sx, NO_SQUARES);
+ T[NO_SQUARES] = '\0';
- if ((p = strstr(sx, "level")) != NULL)
- p += strlen("level");
- else if ((p = strstr(sx, "clock")) != NULL)
- p += strlen("clock");
-
- strcat(sx, "XX");
- q = T;
- *q = '\0';
-
- for (; *p != 'X'; *q++ = *p++);
-
- *q = '\0';
-
- /* line empty ask for input */
+ /* if line empty, ask for input */
if (!T[0])
{
fputs("Enter #moves #minutes: ", stdout);
fgets(T, NO_SQUARES + 1, stdin);
- strcat(T, "XX");
}
/* skip blackspace */
if (*p == 'f')
{
/* its a fischer clock game */
+ char *q;
p++;
TCminutes = (short)strtol(p, &q, 10);
TCadd = (short)strtol(q, NULL, 10) *100;
else
{
/* regular game */
+ char *q;
TCadd = 0;
TCmoves = (short)strtol(p, &q, 10);
TCminutes = (short)strtol(q, &q, 10);