Rev 177 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 177 | Rev 193 | ||
|---|---|---|---|
| Line 45... | Line 45... | ||
| 45 | // reset all selection and hovering information |
45 | // reset all selection and hovering information |
| 46 | Board_SetSelectedAndHovered (board, -1, -1, -1, -1); |
46 | Board_SetSelectedAndHovered (board, -1, -1, -1, -1); |
| 47 | 47 | ||
| 48 | // set the game rules to the specified one |
48 | // set the game rules to the specified one |
| 49 | wcscpy_s (board->game_rules, WCHAR_SIZEOF (board->game_rules), game_rules); |
49 | wcscpy_s (board->game_rules, WCHAR_SIZEOF (board->game_rules), game_rules); |
| - | 50 | ||
| - | 51 | // if white is human AND black is computer AND white prefers to play black, swap sides |
|
| - | 52 | if ((white_playertype == PLAYER_HUMAN) && (black_playertype == PLAYER_COMPUTER) && options.want_playblackside) |
|
| - | 53 | board->want_playerswap = true; // remember to swap sides |
|
| 50 | 54 | ||
| 51 | // notify that board was just set up |
55 | // notify that board was just set up |
| 52 | board->was_setup = true; |
56 | board->was_setup = true; |
| 53 | board->players[COLOR_WHITE].should_wakeup = true; |
57 | board->players[COLOR_WHITE].should_wakeup = true; |
| 54 | board->players[COLOR_BLACK].should_wakeup = true; |
58 | board->players[COLOR_BLACK].should_wakeup = true; |
| Line 256... | Line 260... | ||
| 256 | 260 | ||
| 257 | // get a quick access to board's last move |
261 | // get a quick access to board's last move |
| 258 | last_move = &board->moves[board->move_count - 1]; |
262 | last_move = &board->moves[board->move_count - 1]; |
| 259 | 263 | ||
| 260 | // prepare the new move |
264 | // prepare the new move |
| - | 265 | memset (&new_move, 0, sizeof (new_move)); |
|
| 261 | new_move.color = 1 - last_move->color; // switch colors |
266 | new_move.color = 1 - last_move->color; // switch colors |
| 262 | new_move.part = last_move->slots[from_line][from_column].part; // save the move part type |
267 | new_move.part = last_move->slots[from_line][from_column].part; // save the move part type |
| 263 | new_move.promotion_type = promotion_type; // save the promotion type |
268 | new_move.promotion_type = promotion_type; // save the promotion type |
| 264 | new_move.has_captured = false; // assume there's no capture until told otherwise |
269 | new_move.has_captured = false; // assume there's no capture until told otherwise |
| 265 | new_move.is_enpassant = false; // assume no en passant coup is played until told otherwise |
270 | new_move.is_enpassant = false; // assume no en passant coup is played until told otherwise |
| Line 377... | Line 382... | ||
| 377 | // evaluate check and stalemate status |
382 | // evaluate check and stalemate status |
| 378 | new_move.is_check = Move_IsCheck (&new_move, 1 - new_move.color); // save whether opponent is in check or not |
383 | new_move.is_check = Move_IsCheck (&new_move, 1 - new_move.color); // save whether opponent is in check or not |
| 379 | new_move.is_stalemate = Move_IsStaleMate (&new_move, 1 - new_move.color); // save whether opponent is stalemate |
384 | new_move.is_stalemate = Move_IsStaleMate (&new_move, 1 - new_move.color); // save whether opponent is stalemate |
| 380 | 385 | ||
| 381 | // describe our move in Standard Abbreviated Notation and describe the resulting table in Forsyth-Edwards Notation |
386 | // describe our move in Standard Abbreviated Notation and describe the resulting table in Forsyth-Edwards Notation |
| 382 | Move_DescribeInSAN (&new_move, |
387 | Move_DescribeInSAN (&new_move, last_move, new_move.pgntext, WCHAR_SIZEOF (new_move.pgntext), false); // don't use the localized part abbreviations |
| 383 | Move_DescribeInFEN (&new_move); |
388 | Move_DescribeInFEN (&new_move); |
| 384 | 389 | ||
| 385 | // resize the previous moves array and insert our new move at the end of it |
390 | // resize the previous moves array and insert our new move at the end of it |
| 386 | board->moves = (boardmove_t *) SAFE_realloc (board->moves, board->move_count, board->move_count + 1, sizeof (boardmove_t), false); |
391 | board->moves = (boardmove_t *) SAFE_realloc (board->moves, board->move_count, board->move_count + 1, sizeof (boardmove_t), false); |
| 387 | memcpy (&board->moves[board->move_count], &new_move, sizeof (boardmove_t)); |
392 | memcpy (&board->moves[board->move_count], &new_move, sizeof (boardmove_t)); |