From ce0dfdabfb507a1860e5fbaab0e403f04a1b2444 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 22 Oct 2023 11:48:15 -0400 Subject: [PATCH] Zones with zero blend inherit from parent --- src/engine/InterestManagement/Terrain.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index 4db671ab..6b962fda 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -62,11 +62,22 @@ public class Terrain { // the blending area between child and parent terrains when // they are stitched together. - Vector2f major_blend = new Vector2f(this.zone.template.max_blend / this.zone.major_radius, - this.zone.template.min_blend / this.zone.major_radius); + float max_blend = this.zone.template.max_blend; + float min_blend = this.zone.template.min_blend; - Vector2f minor_blend = new Vector2f(this.zone.template.max_blend / this.zone.minor_radius, - this.zone.template.min_blend / this.zone.minor_radius); + // Zones with a zero blend inherit from their parent terrain + + if (this.zone.template.max_blend == 0) { + Zone parentZone = this.getNextZoneWithTerrain(this.zone); + max_blend = parentZone.template.max_blend; + min_blend = parentZone.template.min_blend; + } + + Vector2f major_blend = new Vector2f(max_blend / this.zone.major_radius, + min_blend / this.zone.major_radius); + + Vector2f minor_blend = new Vector2f(max_blend / this.zone.minor_radius, + min_blend / this.zone.minor_radius); if (major_blend.y > 0.4f) blend_ratio.x = major_blend.y;