@@ -23,6 +23,7 @@ use crate::common::types::{
23
23
atom_from_clvm, u64_from_atom, usize_from_atom, Aggsig , AllocEncoder , Amount , Error , Hash ,
24
24
IntoErr , Node ,
25
25
} ;
26
+ use crate :: referee:: GameMoveDetails ;
26
27
27
28
pub fn chia_dialect ( ) -> ChiaDialect {
28
29
ChiaDialect :: new ( NO_UNKNOWN_OPS )
@@ -70,24 +71,23 @@ fn get_my_turn_debug_flag(_: &MyTurnInputs) -> bool {
70
71
pub struct MyTurnResult {
71
72
// Next player's turn game handler.
72
73
pub waiting_driver : GameHandler ,
73
- pub move_data : Vec < u8 > ,
74
74
pub validation_program : NodePtr ,
75
- pub validation_program_hash : Hash ,
76
75
pub state : NodePtr ,
77
- pub max_move_size : usize ,
78
- pub mover_share : Amount ,
76
+ pub game_move : GameMoveDetails ,
79
77
pub message_parser : Option < MessageHandler > ,
80
78
}
81
79
82
80
pub struct TheirTurnInputs < ' a > {
83
81
pub amount : Amount ,
84
82
pub last_state : NodePtr ,
83
+
84
+ /// Only needs a couple things from last move.
85
85
pub last_move : & ' a [ u8 ] ,
86
86
pub last_mover_share : Amount ,
87
- pub new_move : & ' a [ u8 ] ,
88
- pub new_validation_info_hash : Hash ,
89
- pub new_max_move_size : usize ,
90
- pub new_mover_share : Amount ,
87
+
88
+ /// New move is a full move details.
89
+ pub new_move : GameMoveDetails ,
90
+
91
91
#[ cfg( test) ]
92
92
pub run_debug : bool ,
93
93
}
@@ -270,12 +270,14 @@ impl GameHandler {
270
270
271
271
Ok ( MyTurnResult {
272
272
waiting_driver : GameHandler :: their_driver_from_nodeptr ( pl[ 6 ] ) ,
273
- move_data,
274
273
validation_program : pl[ 1 ] ,
275
- validation_program_hash,
276
274
state : pl[ 3 ] ,
277
- max_move_size,
278
- mover_share,
275
+ game_move : GameMoveDetails {
276
+ move_made : move_data,
277
+ validation_info_hash : validation_program_hash,
278
+ max_move_size,
279
+ mover_share,
280
+ } ,
279
281
message_parser,
280
282
} )
281
283
}
@@ -290,12 +292,12 @@ impl GameHandler {
290
292
(
291
293
Node ( inputs. last_state . clone ( ) ) ,
292
294
(
293
- Node ( allocator. encode_atom ( inputs. new_move ) . into_gen ( ) ?) ,
295
+ Node ( allocator. encode_atom ( & inputs. new_move . move_made ) . into_gen ( ) ?) ,
294
296
(
295
- inputs. new_validation_info_hash . clone ( ) ,
297
+ inputs. new_move . validation_info_hash . clone ( ) ,
296
298
(
297
- inputs. new_max_move_size . clone ( ) ,
298
- ( inputs. new_mover_share . clone ( ) , ( ) ) ,
299
+ inputs. new_move . max_move_size . clone ( ) ,
300
+ ( inputs. new_move . mover_share . clone ( ) , ( ) ) ,
299
301
) ,
300
302
) ,
301
303
) ,
0 commit comments