From f2d6504634cb8360b7d91b897b31a1f39b816c55 Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 19 Jun 2022 13:19:15 +0100 Subject: [PATCH] Fix bug in room position generation --- src/Dodge/Data.hs | 1 - src/Dodge/PlacementSpot.hs | 7 +++++++ src/Dodge/Room/Procedural.hs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 687349e0d..04500210d 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -477,7 +477,6 @@ data Equipment = Equipment _itUseAimStance :: Item -> AimStance _itUseAimStance = _aimStance . _useAim . _itUse - data ItemConsumption = LoadableAmmo { _laType :: AmmoType diff --git a/src/Dodge/PlacementSpot.hs b/src/Dodge/PlacementSpot.hs index adb4bbb16..28512edbd 100644 --- a/src/Dodge/PlacementSpot.hs +++ b/src/Dodge/PlacementSpot.hs @@ -4,6 +4,7 @@ module Dodge.PlacementSpot , rpIsOnPath , rpIsOffPath , rpOffPathEdge + , rpOnPathEdge , useUnusedLnk , psRandRanges , useRoomPosCond @@ -86,6 +87,12 @@ rpOffPathEdge pe = any f . _rpType where f rt = maybe False (any (== pe)) (rt ^? offPathEdges) +-- test whether a roomPos is on the path with a given from edge value +rpOnPathEdge :: PathEdge -> RoomPos -> Bool +rpOnPathEdge pe = any f . _rpType + where + f rt = maybe False (any (== pe)) (rt ^? onPathEdges) + resetPLUse :: PlacementSpot -> PlacementSpot resetPLUse (PSPos f g fallback) = PSPos f' g fallback where diff --git a/src/Dodge/Room/Procedural.hs b/src/Dodge/Room/Procedural.hs index 7d657d715..7b82ef65d 100644 --- a/src/Dodge/Room/Procedural.hs +++ b/src/Dodge/Room/Procedural.hs @@ -93,7 +93,7 @@ roomRect x y xn yn = defaultRoom ,PathFromEdge East (xn-a) ,PathFromEdge West a ] - posps' = map (over _1 (+.+ V2 20 20)) $ gridPoints'' xd (xn+1) yd (xn+1) + posps' = map (over _1 (+.+ V2 20 20)) $ gridPoints'' xd (xn+1) yd (yn+1) interposps' = map (over _1 (+.+ V2 (20 + xd/2) (20 + yd/2))) $ gridPoints'' xd xn yd yn makeoffpos (p,a) = RoomPos p 0 (S.singleton $ RoomPosOffPath $ makerpedges' a) NotLink 0 makerpedges' (a,b) = S.fromList