aboutsummaryrefslogtreecommitdiff
path: root/server/src/entity
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/entity')
-rw-r--r--server/src/entity/campaign.rs6
-rw-r--r--server/src/entity/tutorial.rs12
2 files changed, 9 insertions, 9 deletions
diff --git a/server/src/entity/campaign.rs b/server/src/entity/campaign.rs
index 39926a12..7f07be48 100644
--- a/server/src/entity/campaign.rs
+++ b/server/src/entity/campaign.rs
@@ -99,9 +99,9 @@ impl GateCondition {
match self {
GateCondition::All(cs) => cs.iter().all(|c| c.check(scoreboard)),
GateCondition::Any(cs) => cs.iter().any(|c| c.check(scoreboard)),
- GateCondition::Stars(map, thres) => scoreboard.get(map).map_or(false, |s| {
- s.best.first().map_or(false, |b| b.score.stars >= *thres)
- }),
+ GateCondition::Stars(map, thres) => scoreboard
+ .get(map)
+ .is_some_and(|s| s.best.first().is_some_and(|b| b.score.stars >= *thres)),
}
}
pub fn show(&self, scoreboard: &ScoreboardStore) -> Message {
diff --git a/server/src/entity/tutorial.rs b/server/src/entity/tutorial.rs
index 60b32c79..44244862 100644
--- a/server/src/entity/tutorial.rs
+++ b/server/src/entity/tutorial.rs
@@ -144,7 +144,7 @@ impl StepContext<'_> {
.game
.players
.get(&self.player)
- .map_or(false, |p| p.item.as_ref().map_or(false, |i| i.kind == item))
+ .is_some_and(|p| p.item.as_ref().is_some_and(|i| i.kind == item))
}
pub fn find_demand(&self, item: ItemIndex) -> Option<IVec2> {
self.ent
@@ -171,7 +171,7 @@ impl StepContext<'_> {
.game
.tiles
.iter()
- .find(|(_, t)| t.item.as_ref().map_or(false, |t| t.kind == item))
+ .find(|(_, t)| t.item.as_ref().is_some_and(|t| t.kind == item))
.map(|(p, _)| *p)
}
fn find_tile(&self, tile: TileIndex) -> Option<IVec2> {
@@ -195,9 +195,9 @@ impl StepContext<'_> {
}
fn prevent_burning(&self) -> Result<(), (Option<IVec2>, Message)> {
if let Some((pos, tile)) = self.ent.game.tiles.iter().find(|(_, t)| {
- t.item.as_ref().map_or(false, |t| {
- t.active.as_ref().map_or(false, |i| i.warn && i.speed > 0.)
- })
+ t.item
+ .as_ref()
+ .is_some_and(|t| t.active.as_ref().is_some_and(|i| i.warn && i.speed > 0.))
}) {
Err((
Some(*pos),
@@ -228,7 +228,7 @@ impl StepContext<'_> {
.game
.players
.get(&self.player)
- .map_or(false, |p| p.item.as_ref().map_or(false, |i| i.kind == item))
+ .is_some_and(|p| p.item.as_ref().is_some_and(|i| i.kind == item))
{
if let Some(pos) = self.find_demand(item) {
Err((Some(pos), trm!("s.tutorial.serve")))