chiark / gitweb /
rename GOccults from GameOccults
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 May 2022 11:14:12 +0000 (12:14 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 May 2022 12:00:58 +0000 (13:00 +0100)
Tried to refer to it as GOccults (without looking it up) and obviously
that's what it ought to be.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
13 files changed:
src/clock.rs
src/currency.rs
src/deck.rs
src/dice.rs
src/fastsplit.rs
src/gamestate.rs
src/hand.rs
src/hidden.rs
src/pcrender.rs
src/pieces.rs
src/shapelib.rs
src/updates.rs
src/vpid.rs

index be445a53e3c7604ad934006bd36488bcb278969a..0e11b946544a7f58d2c6889c54212dd73fa2d4ab 100644 (file)
@@ -535,7 +535,7 @@ impl PieceTrait for Clock {
   }
 
   #[throws(IE)]
-  fn describe_html(&self, _gpc: &GPiece, _goccults: &GameOccults) -> Html {
+  fn describe_html(&self, _gpc: &GPiece, _goccults: &GOccults) -> Html {
     Html::lit("the chess clock").into()
   }
 
index 44c54dfe40a9883503308d40c0735f2e297cbdb4..408f1334c654e2e0fa9cb292745ce8e8390a5896 100644 (file)
@@ -99,7 +99,7 @@ impl PieceBaseTrait for Banknote {
 #[typetag::serde(name="Currency")]
 impl PieceTrait for Banknote {
   #[throws(IE)]
-  fn describe_html(&self, gpc: &GPiece, _: &GameOccults) -> Html {
+  fn describe_html(&self, gpc: &GPiece, _: &GOccults) -> Html {
     let value: &Value = gpc.xdata.get_exp()?;
     hformat!("{}, {}{}",
              self.image.describe_html(gpc.face)?,
@@ -130,7 +130,7 @@ impl PieceTrait for Banknote {
       move |ig: &mut InstanceGuard, (player, tpiece)|
   {
     ig.fastsplit_split(player, tpiece, show, new_z,
-      move |_: &IOccults, _: &GameOccults, gpl: &GPlayer,
+      move |_: &IOccults, _: &GOccults, gpl: &GPlayer,
             tgpc: &mut GPiece, tipc: &IPiece,
             ngpc: &mut GPiece|
   {
index 15328ef56c2696c99dad19126c8248ce37a16408..ecdfcaefeb55b0190bd61ec6cd09f1c76c97d530 100644 (file)
@@ -77,7 +77,7 @@ impl PieceSpec for piece_specs::Deck {
 
 impl Deck {
   #[throws(IE)]
-  fn state(&self, gpc: &GPiece, goccults: &GameOccults) -> State {
+  fn state(&self, gpc: &GPiece, goccults: &GOccults) -> State {
     match gpc.occult.active_views(goccults)? {
       None                                                       => Disabled,
       Some(OccultationViews { defview: OccK::Visible,..       }) => Counting,
@@ -88,7 +88,7 @@ impl Deck {
   }
 
   #[throws(IE)]
-  fn current_face(&self, gpc: &GPiece, goccults: &GameOccults) -> FaceId {
+  fn current_face(&self, gpc: &GPiece, goccults: &GOccults) -> FaceId {
     RawFaceId::into(match self.state(gpc, goccults)? {
       Disabled | Counting => 0,
       Enabled             => 1,
@@ -128,7 +128,7 @@ impl PieceTrait for Deck {
   }
 
   #[throws(IE)]
-  fn describe_html(&self, gpc: &GPiece, goccults: &GameOccults) -> Html {
+  fn describe_html(&self, gpc: &GPiece, goccults: &GOccults) -> Html {
     match self.state(gpc, goccults)? {
       Disabled => DISABLED_DESC,
       Counting => COUNTING_DESC,
index b2597784dcb406ae27f2677ff3ca2277502ecdbc..9807947a5fd1d29db9009f72701e7aa2f3956b15 100644 (file)
@@ -328,7 +328,7 @@ impl PieceBaseTrait for Die {
 #[typetag::serde(name="Die")]
 impl PieceTrait for Die {
   #[throws(IE)]
-  fn describe_html(&self, gpc: &GPiece, _: &GameOccults) -> Html {
+  fn describe_html(&self, gpc: &GPiece, _: &GOccults) -> Html {
     let nfaces = self.nfaces();
     let showing = {
       let label = &self.labels[gpc.face];
index b8930072ca2b47029ee446bb42923bec1d7742d5..005cf69a0caf04daca8ada99a9b83177de2a299a 100644 (file)
@@ -86,7 +86,7 @@ impl InstanceGuard<'_> {
     tpiece: PieceId, _: ShowUnocculted, tpc_new_z: ShouldSetZLevel,
     implementation: I
   ) -> UpdateFromOpComplex
-  where I: FnOnce(&IOccults, &GameOccults, &GPlayer,
+  where I: FnOnce(&IOccults, &GOccults, &GPlayer,
                   &mut GPiece, &IPiece,
                   &mut GPiece)
                   -> Result<UpdateFromOpComplex, ApiPieceOpError>
index cdd9aed05f71fcbdaeba7dbacfaa11db7268f4dc..0599e994ba83406b8092ba561174734ad261f217 100644 (file)
@@ -49,7 +49,7 @@ pub struct GameState { // usual variable: gs
   pub log: VecDeque<(Generation, Arc<CommittedLogEntry>)>,
   pub max_z: ZLevel,
   pub players: GPlayers,
-  pub occults: GameOccults,
+  pub occults: GOccults,
 }
 
 pub type GPlayers = DenseSlotMap<PlayerId, GPlayer>;
@@ -219,7 +219,7 @@ pub trait PieceTrait: PieceBaseTrait + Downcast + Send + Debug + 'static {
   fn svg_piece(&self, f: &mut Html, gpc: &GPiece, gs: &GameState,
                id: VisiblePieceId) -> Result<(),IE>;
 
-  fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults)
+  fn describe_html(&self, gpc: &GPiece, _goccults: &GOccults)
                    -> Result<Html,IE>;
 
   /// Piece is responsible for dealing with the possibility that they
index 955e632e80d4a971fa12f4771bcabc6570776751..c5b8bc7bfe9250f0bbcc449bea362b7bf4eed966 100644 (file)
@@ -196,7 +196,7 @@ impl PieceTrait for Hand {
   }
 
   #[throws(IE)]
-  fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -> Html {
+  fn describe_html(&self, gpc: &GPiece, _goccults: &GOccults) -> Html {
     let xdata = gpc.xdata.get()?;
     self.behaviour.describe_html_inner(xdata)
   }
index 021339492e3bc37aa44c898678877dc374bf359d..283164f903ae0aac6c31131784cdb5597d9a5fcc 100644 (file)
@@ -30,7 +30,7 @@ pub struct OcculterRotationChecked(());
 pub struct IPieceTraitObj(Box<dyn PieceTrait>);
 
 #[derive(Clone,Debug,Default,Serialize,Deserialize)]
-pub struct GameOccults {
+pub struct GOccults {
   occults: DenseSlotMap<OccId, Occultation>,
 }
 
@@ -114,7 +114,7 @@ impl PieceOccult {
   pub fn is_active(&self) -> bool { self.active.is_some() }
 
   #[throws(IE)]
-  fn active_occ<'r>(&'r self, goccults: &'r GameOccults)
+  fn active_occ<'r>(&'r self, goccults: &'r GOccults)
                     -> Option<&'r Occultation> {
     if let Some(occid) = self.active {
       let occ = goccults.occults.get(occid).ok_or_else(
@@ -126,7 +126,7 @@ impl PieceOccult {
   }
 
   #[throws(IE)]
-  pub fn active_views<'r>(&'r self, goccults: &'r GameOccults)
+  pub fn active_views<'r>(&'r self, goccults: &'r GOccults)
                           -> Option<&'r OccultationViews> {
     self.active_occ(goccults)?.map(
       |occ| &occ.views
@@ -134,7 +134,7 @@ impl PieceOccult {
   }
 
   #[throws(IE)]
-  pub fn active_region<'r>(&'r self, goccults: &'r GameOccults)
+  pub fn active_region<'r>(&'r self, goccults: &'r GOccults)
                            -> Option<&'r Region> {
     self.active_occ(goccults)?.map(
       |occ| &occ.region
@@ -142,7 +142,7 @@ impl PieceOccult {
   }
 
   #[throws(IE)]
-  pub fn active_total_ppieces(&self, goccults: &GameOccults)
+  pub fn active_total_ppieces(&self, goccults: &GOccults)
                               -> Option<usize> {
     self.active_occ(goccults)?.map(|occ| {
       let notches_len = usize::try_from(occ.notches.len()).unwrap();
@@ -151,7 +151,7 @@ impl PieceOccult {
   }
 
   pub fn passive_occid(&self) -> Option<OccId> { Some(self.passive?.occid) }
-  pub fn passive_delete_hook(&self, goccults: &mut GameOccults,
+  pub fn passive_delete_hook(&self, goccults: &mut GOccults,
                              piece: PieceId) {
     if_chain! {
       if let Some(Passive { occid, permute_notch }) = self.passive;
@@ -257,7 +257,7 @@ impl Occultation {
   }
 }
 
-impl GameOccults {
+impl GOccults {
   #[throws(IE)]
   fn by_id(&self, occid: OccId) -> &Occultation {
     self.occults.get(occid).ok_or_else(
@@ -272,7 +272,7 @@ impl GameOccults {
   }
 
   #[throws(IE)]
-  pub fn pos_occulter(&self, goccults: &GameOccults, pos: Pos)
+  pub fn pos_occulter(&self, goccults: &GOccults, pos: Pos)
                       -> Option<PieceId> {
     goccults.occults.iter().find_map(|(_occid, occ)| {
       if occ.in_region(pos) {
@@ -284,7 +284,7 @@ impl GameOccults {
   }
 
   pub fn is_empty(&self) -> bool {
-    let GameOccults { occults } = self;
+    let GOccults { occults } = self;
     occults.is_empty()
   }
 }
@@ -294,7 +294,7 @@ impl GameOccults {
 /// None => do not render at all
 pub fn piece_pri(
   _ioccults: &IOccults,
-  occults: &GameOccults,
+  occults: &GOccults,
   player: PlayerId, gpl: &mut GPlayer,
   piece: PieceId, gpc: &GPiece, _ipc: &IPiece,
 ) -> Option<PieceRenderInstructions>
@@ -462,7 +462,7 @@ impl GPiece {
   }
 
 
-  pub fn fully_visible_to(&self, goccults: &GameOccults, player: PlayerId)
+  pub fn fully_visible_to(&self, goccults: &GOccults, player: PlayerId)
                           -> Option<ShowUnocculted>
   {
     const HIDE: Option<ShowUnocculted> = None;
@@ -521,7 +521,7 @@ fn recalculate_occultation_general<
   gen: &mut UniqueGenGen,
   //
   gplayers: &GPlayers, gpieces: &mut GPieces,
-  goccults: &mut GameOccults, ipieces: &IPieces, ioccults: &IOccults,
+  goccults: &mut GOccults, ipieces: &IPieces, ioccults: &IOccults,
   //
   to_recalculate: &mut ToRecalculate, piece: PieceId,
   // if no change, we return ret_vanilla()
@@ -707,7 +707,7 @@ fn recalculate_occultation_general<
 
   (||{
     let occultation:
-       &mut dyn for<'g> FnMut(&'g mut GameOccults, OccId) -> &mut Occultation
+       &mut dyn for<'g> FnMut(&'g mut GOccults, OccId) -> &mut Occultation
       = &mut |goccults, occid|
       // rust-lang/rust/issues/58525
     {
@@ -805,7 +805,7 @@ fn recalculate_occultation_ofmany(
   gen: &mut UniqueGenGen,
   gplayers: &GPlayers,
   gpieces: &mut GPieces,
-  goccults: &mut GameOccults,
+  goccults: &mut GOccults,
   ipieces: &IPieces,
   ioccults: &IOccults,
   to_recalculate: &mut ToRecalculate,
@@ -853,7 +853,7 @@ mod recompute {
     pub fn implement(self,
                      gplayers: &mut GPlayers,
                      gpieces: &mut GPieces,
-                     goccults: &mut GameOccults,
+                     goccults: &mut GOccults,
                      ipieces: &IPieces) -> Implemented {
       let mut unprepared = vec![];
 
@@ -919,7 +919,7 @@ pub fn create_occultation(
   max_z: &mut ZLevel,
   gplayers: &mut GPlayers,
   gpieces: &mut GPieces,
-  goccults: &mut GameOccults,
+  goccults: &mut GOccults,
   ipieces: &IPieces,
   ioccults: &IOccults,
   to_recalculate: &mut ToRecalculate,
@@ -1029,7 +1029,7 @@ pub fn remove_occultation(
   gen: &mut UniqueGenGen,
   gplayers: &mut GPlayers,
   gpieces: &mut GPieces,
-  goccults: &mut GameOccults,
+  goccults: &mut GOccults,
   ipieces: &IPieces,
   ioccults: &IOccults,
   to_recalculate: &mut ToRecalculate,
index 02719dcd1749addaf64edb07c07c3c31085afcbb..44bcbb7b51b404f98d112e6dd00cc533ed76b4ae 100644 (file)
@@ -66,7 +66,7 @@ impl<P,Z> PriOccultedGeneral<P,Z> {
     }
   }
 
-  pub fn describe(&self, ioccults: &IOccults, goccults: &GameOccults,
+  pub fn describe(&self, ioccults: &IOccults, goccults: &GOccults,
                   gpc: &GPiece, ipc: &IPiece) -> Html
   {
     self.describe_fallible(ioccults, goccults, gpc, ipc)
@@ -78,7 +78,7 @@ impl<P,Z> PriOccultedGeneral<P,Z> {
 
   #[throws(IE)]
   pub fn describe_fallible(&self, ioccults: &IOccults,
-                           goccults: &GameOccults,
+                           goccults: &GOccults,
                            gpc: &GPiece, ipc: &IPiece) -> Html {
     match self.instead(ioccults, ipc)? {
       Left(y) => ipc.show(y).describe_html(gpc, goccults)?,
index b0927596ab5f53e94d71e9ec80d6cbc54d2c2141..0b83470c1a04099773896429255f9357469e6ac6 100644 (file)
@@ -134,7 +134,7 @@ impl PieceTrait for SimpleShape {
     self.svg_piece_raw(f, gpc.face, &mut |_|Ok(()))?;
   }
   #[throws(IE)]
-  fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -> Html {
+  fn describe_html(&self, gpc: &GPiece, _goccults: &GOccults) -> Html {
     let r = if_chain! {
       if let face = gpc.face;
       if let Some(colour) = self.colours.get(face);
index 2ef4e32a7f66c24bec4634655be9ebc8456840aa..5a0c47119cc4617744209fd13c4e1ebea53f9340 100644 (file)
@@ -389,7 +389,7 @@ impl PieceTrait for Item {
     self.svg_face(f, gpc.face, vpid, &gpc.xdata)?;
   }
   #[throws(IE)]
-  fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -> Html {
+  fn describe_html(&self, gpc: &GPiece, _goccults: &GOccults) -> Html {
     self.describe_face(gpc.face)?
   }
 
index 817db00c013a93ee7d41265a7d749023989fcc08..20d8cd94ba0d8227e94760d13c968cf97a5ed30f 100644 (file)
@@ -316,7 +316,7 @@ struct FormattedLogEntry<'u> {
 // ---------- helpful utilities ----------
 
 #[throws(Fatal)]
-pub fn log_did_to_piece_whoby(ioccults: &IOccults, goccults: &GameOccults,
+pub fn log_did_to_piece_whoby(ioccults: &IOccults, goccults: &GOccults,
                               by_gpl: &GPlayer,
                               gpc: &GPiece, ipc: &IPiece, did: &str)
                               -> (Vec<LogEntry>, Option<Html>)
@@ -343,7 +343,7 @@ pub fn log_did_to_piece_whoby(ioccults: &IOccults, goccults: &GameOccults,
 }
 
 #[throws(Fatal)]
-pub fn log_did_to_piece(ioccults: &IOccults, goccults: &GameOccults,
+pub fn log_did_to_piece(ioccults: &IOccults, goccults: &GOccults,
                         by_gpl: &GPlayer,
                         gpc: &GPiece, ipc: &IPiece, did: &str)
                         -> Vec<LogEntry> {
index a1785839a4e7087b056fcbb58ecb7d1777d0845b..10ca8e326fa7459d01d0d733a8912abf4c46f582 100644 (file)
@@ -372,14 +372,14 @@ pub fn permute(occid: OccId,
 pub fn consistency_check(
   _gplayers: &GPlayers,
   _gpieces: &GPieces,
-  _goccults: &GameOccults,
+  _goccults: &GOccults,
 ) { }
 
 #[cfg(debug_assertions)]
 pub fn consistency_check(
   gplayers: &GPlayers,
   gpieces: &GPieces,
-  goccults: &GameOccults,
+  goccults: &GOccults,
 ) {
   for (_player, gpl) in gplayers.iter() {
     for (piece, &vpid) in gpl.idmap.f.iter() {