Skip to content

Commit 9b7c64a

Browse files
committed
ref: make thor reference explicit
1 parent 47a302d commit 9b7c64a

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

crates/engine/src/zebra.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ pub fn next_state<
212212
ComputeMoveOut: ComputeMoveOutput,
213213
FE: FrontEnd,
214214
Thor: ThorDatabase
215-
>(play_state: &mut PlayGame<Source>, move_attempt: Option<MoveAttempt>) -> PlayGameState {
215+
>(play_state: &mut PlayGame<Source>, move_attempt: Option<MoveAttempt>, thor: &Thor) -> PlayGameState {
216216
play_state.state = match play_state.state {
217217
PlayGameState::Initial => {
218218
/* Decode the predefined move sequence */

crates/legacy-zebra/src/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ pub fn fatal_error_(args: std::fmt::Arguments<'_>) -> ! {
7878
std::process::exit(1);
7979
}
8080

81-
pub struct LibcFatalError; // FIXME rename this, it's not only error anymore
82-
pub type FE = LibcFatalError;
81+
pub struct LibcFatalError;
8382

8483
impl LibcFatalError {
8584
pub fn choose_thor_opening_move_report(freq_sum: i32, match_count: i32, move_list: &[C2RustUnnamed; 64]) {

crates/legacy-zebra/src/zebra.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use engine::src::zebra::EvalResult::{LOST_POSITION, WON_POSITION};
2626
use engine::src::zebra::GameMode::{PRIVATE_GAME, PUBLIC_GAME};
2727
use libc_wrapper::{scanf, stdout, time, c_time, time_t};
2828
use crate::src::display::{dumpch, display_state, TO_SQUARE};
29-
use crate::src::error::{FE, LibcFatalError};
29+
use crate::src::error::LibcFatalError;
3030
use crate::src::game::{legacy_compute_move, global_setup, BasicBoardFileSource, LibcZebraOutput, LogFileHandler};
3131
use crate::src::learn::{init_learn, LibcLearner};
3232
use crate::src::osfbook::print_move_alternatives;
@@ -757,7 +757,7 @@ fn play_game(mut file_name: &str,
757757
loop {
758758
let state = next_state::<
759759
ZF, Source, BoardSrc, ComputeMoveLog, ComputeMoveOut, FE, Thor
760-
>(&mut play_state, move_attempt.take());
760+
>(&mut play_state, move_attempt.take(), &LegacyThor);
761761
match state {
762762
// TODO here in all these branches, we should ideally not need mutable reference to play_state
763763
PlayGameState::End => {
@@ -1107,15 +1107,15 @@ unsafe fn analyze_game(mut move_string: &str, g_state : &mut FullState) {
11071107
} else {
11081108
provided_move_count = (move_string.len()).wrapping_div(2) as i32;
11091109
if provided_move_count > 60 || (move_string.len()).wrapping_rem(2) == 1 {
1110-
FE::invalid_move_string_provided();
1110+
LibcFatalError::invalid_move_string_provided();
11111111
}
11121112
i = 0;
11131113
let move_string = move_string.as_bytes();
11141114
while i < provided_move_count {
11151115
col = (*move_string.offset((2 * i) as isize) as char).to_ascii_lowercase() as u8 - b'a' + 1;
11161116
row = *move_string.offset((2 * i + 1) as isize) - b'0';
11171117
if col < 1 || col > 8 || row < 1 || row > 8 {
1118-
FE::unexpected_character_in_a_move_string();
1118+
LibcFatalError::unexpected_character_in_a_move_string();
11191119
}
11201120
provided_move[i as usize] = (10 * row + col) as i8;
11211121
i += 1

webzebra/crate/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl ZebraGame {
296296
let mut play_state = &mut self.game;
297297
let state = next_state::<
298298
WasmFrontend, WasmInitialMoveSource, WasmBoardSource, WasmComputeMoveLogger, WasmFrontend, WasmFrontend, WasmThor
299-
>(&mut play_state, move_attempt.take());
299+
>(&mut play_state, move_attempt.take(), &WasmThor{});
300300
match state {
301301
PlayGameState::GetPass { provided_move_count } => {
302302
// TODO signal this to frontend

0 commit comments

Comments
 (0)