/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package transientlibs.bindedobjects.core.datasets;
import transientlibs.bindedobjects.core.datasets.Action;
import transientlibs.tex.BranchList;
import transientlibs.tex.ReqList;
import java.util.ArrayList;
import java.util.HashMap;
import transientlibs.slick2d.util.Log;
import transientlibs.bindedobjects.core.Binding;
import transientlibs.bindedobjects.core.loaders.LandmarksLoader;
import transientlibs.objects.primitives.Int;
import transientlibs.objects.general.MapNode;
import transientlibs.preui.objects.gui.interfaces.IImage;
import transientlibs.preui.objects.gui.interfaces.ISound;
import transientlibs.tex.ActList;
import transientlibs.tex.Branch;
/**
*
* @author kibertoad
*/
public class Landmarks extends BindedValue {
public HashMap<String, Int> values = new HashMap<String, Int>();
public int doorDeltaX = 0;
public int doorDeltaY = 0;
public ArrayList<MapNode> childLandmarks = new ArrayList<MapNode>();
public static ArrayList<Landmarks> landmarks = new ArrayList<Landmarks>();
public static Landmarks lastLandmark;
public ISound visitSound;
public Action action = null;
public BranchList onVisitTex = null;
public IImage image;
public int tileSizeX = -1;
public int tileSizeY = -1;
public ArrayList<Action> relatedActions = new ArrayList<Action>();
public Branch eval = null;
public static ReqList globalCostReqs = new ReqList();
public static ActList globalCostActs = new ActList();
public ReqList costReqs = new ReqList(); //requirement to place
public ActList costActs = new ActList(); //action after placement
public static BindedValueContainer<Landmarks> container = new BindedValueContainer<Landmarks>(Binding.landmarkBinding);
public static void loadLandmarks() {
LandmarksLoader loader = new LandmarksLoader(container);
loader.loadAllLandmarks();
}
@Override
public void reEvaluate() {
if (eval != null) {
eval.processSilently();
}
}
public static Landmarks getLandmarkByCode(String getCode) {
//return getLandmarkByID (Binding.getBinding(Binding.landmarkBinding, getCode));
return container.getByCode(getCode);
}
public static Landmarks getLandmarkByID(int getCode) {
return container.getByID(getCode);
//Log.error("No landmark with code: "+getCode);
//return null;
}
public Int getValue(String ofKey) {
if (values.containsKey(ofKey)) {
return values.get(ofKey);
} else {
values.put(ofKey, new Int(0));
Log.warn("No value with key " + ofKey);
return values.get(ofKey);
}
}
public static String getBindCode(int forType) {
return Binding.getBindCode(Binding.landmarkBinding, forType);
}
}