/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package transientlibs.bindedobjects.gamecontent;
import java.util.ArrayList;
import transientlibs.slick2d.util.Log;
import transientlibs.bindedobjects.core.Binding;
import transientlibs.bindedobjects.core.datasets.LesserBindedValue;
import transientlibs.tex.StringAnalyst;
/**
*
* @author kibertoad
*/
public class Needs extends LesserBindedValue {
public static ArrayList<Needs> needs = new ArrayList<Needs>();
public static Needs lastNeeds;
public static void loadNeeds (){
if (StringAnalyst.isFileExist("needs.dat")) {
StringAnalyst reader = new StringAnalyst();
reader.openFile("needs.dat");
while (!reader.eof) {
reader.readRow();
analyzeStringForNeedss (reader);
}
reader.closeFile();
}
}
public static void analyzeStringForNeedss (StringAnalyst analyst) {
analyzeStringForNeedss ("-NO-", analyst);
}
public static void analyzeStringForNeedss (String getString, StringAnalyst analyst) {
if (!"-NO-".equals(getString)) {analyst.fullStr = getString;}
analyst.getNextString();
String nowStr = analyst.lastStr;
boolean withResult = false;
if (nowStr.equals("need")) {
needs.add (new Needs ());
lastNeeds = needs.get(needs.size()-1);
lastNeeds.ID = analyst.getBinding (Binding.needBinding);
//ReqList.lastReqList = lastNeeds.trainReqs;
withResult = true;
}
if (nowStr.equals("name")) {
lastNeeds.LName.value = analyst.getNextString();
withResult = true;
}
if (nowStr.equals("desc")) {
lastNeeds.desc = analyst.restOfRow();
withResult = true;
}
if ((withResult == false) && (nowStr.length()>2) && (!nowStr.startsWith("//"))) {
Log.error("Unknown string: "+nowStr); }
}
}