From e4235d4d754c9a18e473b4f5bcf453a2348d515a Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 14 Sep 2023 09:13:02 -0400 Subject: [PATCH] Bugfix in setparent. --- src/engine/objects/Zone.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index edec6d7a..bcc6da39 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -253,7 +253,17 @@ public class Zone extends AbstractGameObject { this.setBounds(); - if (this.getHeightMap() != null && this.getHeightMap().getSeaLevel() != 0) + if (this.getParent() == null) { + this.seaLevel = 0; + return; + } + + if (this.getHeightMap() == null) { + this.seaLevel = this.parent.seaLevel; + return; + } + + if (this.getHeightMap().getSeaLevel() != 0) this.seaLevel = this.worldAltitude + this.getHeightMap().getSeaLevel(); else this.seaLevel = this.parent.seaLevel;