summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4617ae5)
raw | patch | inline | side by side (parent: 4617ae5)
author | fred-boy <fred-boy@protonmail.com> | |
Wed, 25 Apr 2018 13:05:48 +0000 (20:05 +0700) | ||
committer | fred-boy <fred-boy@protonmail.com> | |
Wed, 25 Apr 2018 13:09:02 +0000 (20:09 +0700) |
core/src/ru/deadsoftware/cavecraft/game/GameWorld.java | patch | blob | history |
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java
index 0c3ac52f40fc1804d29017470e315eaffda5ee0c..fc0c24712a88999124dac75967302106f7a06401 100644 (file)
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
+import com.badlogic.gdx.utils.ArrayMap;
public class GameWorld {
private int WIDTH, HEIGHT;
+ private ArrayMap<String, Integer> metaMap;
private int[][] foreMap;
private int[][] backMap;
}
}
+ public int getMeta(int x, int y) {
+ if (metaMap.containsKey(x+"_"+y)) return metaMap.get(x+"_"+y);
+ else return 0;
+ }
+
+ public void setMeta(int x, int y, int value) {
+ if (metaMap.containsKey(x+"_"+y)) metaMap.removeKey(x+"_"+y);
+ metaMap.put(x+"_"+y, value);
+ }
+
public void placeToForeground(int x, int y, int value) {
if (getForeMap(x,y) == 0 || value == 0) {
setForeMap(x,y,value);
WorldGen.genWorld(WIDTH,HEIGHT);
foreMap = WorldGen.getForeMap();
backMap = WorldGen.getBackMap();
+ metaMap = new ArrayMap<String, Integer>();
WorldGen.clear();
}