chiark / gitweb /
gen in GameState
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 27 Jun 2020 22:11:17 +0000 (23:11 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 27 Jun 2020 22:11:17 +0000 (23:11 +0100)
junk/instance.rs
src/gamestate.rs

index d02f52128ac1fe3acf07f08738cc548c198b15c6..3ce166448e9bcaa8b42bbbd6c4efcca7c095255f 100644 (file)
@@ -10,7 +10,6 @@ pub struct Instance {
 
 #[derive(Debug)]
 struct Game {
-  gen : Counter,
   log : VecDeque<LogEntry>,
 }
 
index a85cdbf23d238a7004521ea103ac34f9d9a42028..7eca3e8e5c23f83b30ad9977ac7ed70e2cf95527 100644 (file)
@@ -5,6 +5,8 @@ slotmap::new_key_type!{
   pub struct PieceId;
 }
 
+type Counter = u64;
+
 visible_slotmap_key!{ VisiblePieceId('.') }
 
 pub fn make_pieceid_visible(p : PieceId) -> VisiblePieceId {
@@ -52,6 +54,7 @@ pub struct PieceRecord {
 pub struct GameState {
   pub pieces : DenseSlotMap<PieceId,PieceRecord>,
   pub players : DenseSlotMap<PlayerId,Player>,
+  pub gen : Counter,
 }
 
 #[derive(Debug)]
@@ -69,5 +72,5 @@ pub fn xxx_gamestate_init() -> GameState {
     };
     pieces.insert(pr);
   }
-  GameState { pieces, players : Default::default() }
+  GameState { pieces, gen : 1, players : Default::default(),  }
 }