From 28e1cfa50847de1a7347531054bd62c88f304678 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 24 Jan 2026 18:43:49 +0100 Subject: update server to new tile stacks --- server/data/src/filter_demands.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'server/data/src') diff --git a/server/data/src/filter_demands.rs b/server/data/src/filter_demands.rs index cb29a678..4eb2d597 100644 --- a/server/data/src/filter_demands.rs +++ b/server/data/src/filter_demands.rs @@ -15,13 +15,12 @@ along with this program. If not, see . */ -use hurrycurry_protocol::{Demand, ItemIndex, Recipe, TileIndex}; +use hurrycurry_protocol::{Demand, ItemIndex, Recipe, TileIndex, glam::IVec2}; use log::debug; use std::collections::{HashMap, HashSet}; pub fn filter_demands_and_recipes( - map_tiles: &HashSet, - map_items: &HashSet, + initial_map: &HashMap, Option)>, demands: &mut Vec, recipes: &mut Vec, ) { @@ -31,6 +30,17 @@ pub fn filter_demands_and_recipes( demands.len() ); + let map_tiles = initial_map + .values() + .flat_map(|(t, _)| t) + .copied() + .collect::>(); + let map_items = initial_map + .values() + .flat_map(|(_, i)| i) + .copied() + .collect::>(); + // Remove tile-bound recipes that cant be performed recipes.retain(|r| r.tile().is_none_or(|t| map_tiles.contains(&t))); -- cgit v1.3