From 607cb4de1c75d053c44a20aa486cb6c7be6bc8a2 Mon Sep 17 00:00:00 2001 From: ntr Date: Thu, 17 Jan 2019 19:34:41 +1100 Subject: [PATCH] rare spec dupe check --- server/WORKLOG.md | 3 --- server/src/cryp.rs | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/WORKLOG.md b/server/WORKLOG.md index fe390aaa..09ffd399 100644 --- a/server/WORKLOG.md +++ b/server/WORKLOG.md @@ -33,9 +33,6 @@ strangle ## NOW * check zone completion -* serialize modified stats - * remove spec from cryp - * dupe rare specs check ## SOON * clean up categories diff --git a/server/src/cryp.rs b/server/src/cryp.rs index fca92035..fdb6a338 100644 --- a/server/src/cryp.rs +++ b/server/src/cryp.rs @@ -295,7 +295,10 @@ impl Cryp { return Err(format_err!("cryp at maximum rare specalisations ({:})", max_rare)) } - // check dupes + if self.specs.rare.iter().find(|s| s.spec == spec.spec).is_some() { + return Err(format_err!("duplicate rare specialisation {:?}", spec.spec)); + } + self.specs.rare.push(spec); }, };