logents);
let update=
- recalculate_occultation(
+ recalculate_occultation_piece(
gs,
who_by,
ipieces,
piece,
vanilla,
- |who_by, old, new, show| vec![ LogEntry { html: Html(format!(
- "{} moved {} from {} to {}",
- &who_by.0,
- if let Some(show) = show { &show.0 } else { "something" },
- &old.0, &new.0,
- ))}],
-
).map_err(|e| OnlineError::from(e))?;
update
// xxx this means this only happens on ungrab I think ?
#[throws(InternalError)]
-pub fn recalculate_occultation<
+fn recalculate_occultation_general<
L: FnOnce(&Html, Html, Html, Option<&Html>) -> Vec<LogEntry>,
>(
gs: &mut GameState,
update
}
+
+#[throws(InternalError)]
+pub fn recalculate_occultation_piece(
+ gs: &mut GameState,
+ who_by: Html,
+ ipieces: &PiecesLoaded,
+ piece: PieceId,
+ vanilla: PUFOS,
+)
+ -> PieceUpdate
+{
+ recalculate_occultation_general(
+ gs,
+ who_by,
+ ipieces,
+ piece,
+ vanilla,
+ |who_by, old, new, show| vec![ LogEntry { html: Html(format!(
+ "{} moved {} from {} to {}",
+ &who_by.0,
+ if let Some(show) = show { &show.0 } else { "something" },
+ &old.0, &new.0,
+ ))}]
+ )?
+}