@@ 20,6 20,7 @@ struct CreateActionPost {
invoker: String,
target: String,
command: Command,
+ seed: u64,
}
pub fn create_action(
@@ 31,6 32,7 @@ pub fn create_action(
invoker: action.invoker.to_string(),
target: action.target.to_string(),
command: action.command.clone(),
+ seed: action.seed,
});
Ok(res.json().unwrap())
@@ 54,6 54,27 @@ pub struct Action {
pub seed: u64,
}
+impl Action {
+ pub fn new(
+ game_id: &str,
+ invoker: &str,
+ target: &str,
+ command: &Command,
+ seed: u64
+ ) -> Self {
+ Self {
+ id: "".to_string(),
+ created_at: "".to_string(),
+ updated_at: "".to_string(),
+ game_id: game_id.to_string(),
+ invoker: invoker.to_string(),
+ target: target.to_string(),
+ command: command.clone(),
+ seed,
+ }
+ }
+}
+
#[derive(Debug, Deserialize_repr, Clone, PartialEq)]
#[repr(u8)]
pub enum GameState {