From f64607531150f6585513c8d5427074e6e55a3fc6 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 14 Sep 2023 12:28:36 -0400 Subject: [PATCH] Static method to save memory. --- src/engine/InterestManagement/HeightMap.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index 77b12f8b..12e28ac1 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -103,7 +103,7 @@ public class HeightMap { // Generate pixel array from image data - generatePixelData(); + generatePixelData(this); HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this); @@ -423,19 +423,19 @@ public class HeightMap { return interpolatedHeight; } - private void generatePixelData() { + private static void generatePixelData(HeightMap heightMap) { Color color; // Generate altitude lookup table for this heightmap - this.pixelColorValues = new int[this.heightmapImage.getWidth()][this.heightmapImage.getHeight()]; + heightMap.pixelColorValues = new int[heightMap.heightmapImage.getWidth()][heightMap.heightmapImage.getHeight()]; - for (int y = 0; y < this.heightmapImage.getHeight(); y++) { - for (int x = 0; x < this.heightmapImage.getWidth(); x++) { + for (int y = 0; y < heightMap.heightmapImage.getHeight(); y++) { + for (int x = 0; x < heightMap.heightmapImage.getWidth(); x++) { - color = new Color(this.heightmapImage.getRGB(x, y)); - pixelColorValues[x][y] = color.getRed(); + color = new Color(heightMap.heightmapImage.getRGB(x, y)); + heightMap.pixelColorValues[x][y] = color.getRed(); } }