Skip to content

Commit

Permalink
Merge pull request #36 from pilksoc/sf-ui-saveplayerlocations
Browse files Browse the repository at this point in the history
stores player in global grid
  • Loading branch information
stephanie-flower authored Mar 3, 2024
2 parents 5a163c1 + e435e72 commit 514e948
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub mod grid;
pub mod space;
pub mod kube;
pub mod player;
pub mod llm;
pub mod local_grid;
pub mod cache_client;
pub mod recipe;
Expand Down
7 changes: 5 additions & 2 deletions backend/src/ws/gen_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,17 @@ fn debug_message(state: &PlayerInfo) {
fn recalculate_game(state: PlayerInfo) -> String {
debug_message(&state); //debug

// store the players location in the world
let playerspace: Space = Space::new(state.coordinates, SpaceKind::Player(state.player));
let mut grid = WORLD.lock().unwrap();
grid.insert(playerspace);

// then we want to update the grid by performing action
match state.action {
Some(p) => perform_action(p),
_ => (),
}

//store new_grid_to_send in the database

let new_grid: LocalGrid =
LocalGrid::from_grid_and_coord(&WORLD.lock().unwrap(), state.coordinates, 48);
let resp: Value;
Expand Down

0 comments on commit 514e948

Please sign in to comment.