From: Ian Jackson Date: Sat, 30 Apr 2022 10:14:17 +0000 (+0100) Subject: fastsplit: Add some imprecations about not dropping FastSplitId X-Git-Tag: otter-1.1.0~409 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b33002e50ba2aa091f2f069f98f98f8e5c48f18b;p=otter.git fastsplit: Add some imprecations about not dropping FastSplitId Signed-off-by: Ian Jackson --- diff --git a/src/fastsplit.rs b/src/fastsplit.rs index 39424e53..2b2c61a1 100644 --- a/src/fastsplit.rs +++ b/src/fastsplit.rs @@ -80,6 +80,8 @@ impl Record { impl IFastSplits { /// During piece addition: make this into a new fastsplit piece family + /// + /// Do not just drop the result, because it contains an OwningOccultIlkId pub fn new_original(&mut self, ilks: &mut OccultIlks, ipc: IPiece) -> (IPiece, FastSplitId) { let ipc = Arc::new(ipc); @@ -89,6 +91,9 @@ impl IFastSplits { } /// During game load: recover a proper IPiece for a fastsplit piece + /// + /// Just dropping the result on error is ok, despite it containing + /// an OwningOccultIlkId, because in that case the whole game is toast. #[throws(as Option)] pub fn recover_ipc(&self, ilks: &mut OccultIlks, fsid: FastSplitId) -> IPiece { @@ -96,6 +101,7 @@ impl IFastSplits { Self::make_ipc(ilks, record.ipc.clone()) } + /// Do not just drop the result, because it contains an OwningOccultIlkId fn make_ipc(ilks: &mut OccultIlks, ipc: Arc) -> IPiece { let occilk = ipc.occilk.as_ref().map(|i| ilks.clone_iilk(i)); let special = ipc.special.clone();