Rev 71 | Rev 119 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 71 | Rev 72 | ||
---|---|---|---|
Line 75... | Line 75... | ||
75 | while ((buffer = sgets (line_buffer, sizeof (line_buffer), buffer)) != NULL) |
75 | while ((buffer = sgets (line_buffer, sizeof (line_buffer), buffer)) != NULL) |
76 | { |
76 | { |
77 | // is it a new game ? |
77 | // is it a new game ? |
78 | if (strncmp (line_buffer, "[Event \"", 8) == 0) |
78 | if (strncmp (line_buffer, "[Event \"", 8) == 0) |
79 | { |
79 | { |
- | 80 | memset (&games[entry_count], 0, sizeof (games[entry_count])); |
|
80 | COPY_TIL_LAST_QUOTEMARK (games[entry_count].event_str, &line_buffer[8]); // copy event |
81 | COPY_TIL_LAST_QUOTEMARK (games[entry_count].event_str, &line_buffer[8]); // copy event |
81 | 82 | ||
82 | // assume a default "standard chess" start position unless told otherwise later |
83 | // assume a default "standard chess" start position unless told otherwise later |
83 | wcscpy_s (games[entry_count].fen_str, WCHAR_SIZEOF (games[entry_count].fen_str), FENSTARTUP_STANDARDCHESS); |
84 | wcscpy_s (games[entry_count].fen_str, WCHAR_SIZEOF (games[entry_count].fen_str), FENSTARTUP_STANDARDCHESS); |
84 | 85 | ||
Line 111... | Line 112... | ||
111 | } |
112 | } |
112 | 113 | ||
113 | // else is it the beginning of a game ? |
114 | // else is it the beginning of a game ? |
114 | else if (strncmp (line_buffer, "1.", 2) == 0) |
115 | else if (strncmp (line_buffer, "1.", 2) == 0) |
115 | games[entry_count - 1].gamedata_start = file_index; // remember where this game starts |
116 | games[entry_count - 1].gamedata_start = file_index; // remember where this game starts |
- | 117 | else if ((ptr = strstr (line_buffer, "} 1.")) != NULL) |
|
- | 118 | games[entry_count - 1].gamedata_start = (ptr + 2 - pgnfile_data); // remember where this game starts |
|
116 | } |
119 | } |
117 | 120 | ||
118 | file_index = buffer - pgnfile_data; // save current file pointer index |
121 | file_index = buffer - pgnfile_data; // save current file pointer index |
119 | } |
122 | } |
120 | 123 |