// save
project.getCache().put(id, list);
return list;
} else if (type == Type.MAP) {
final RubyHash r = (RubyHash) RGSS1Load.loadFile(project, new File(RGSS1Load.getDataFile(project), "MapInfos.rxdata"));
Set<?> set = r.keySet();
int max = 0;
HashMap<Integer, RubyObject> o = new HashMap<Integer, RubyObject>();
o.put(0, null);
// build the list
for (Object i : set) {
int roid = Integer.valueOf(i.toString());
o.put(roid, (RubyObject) RGSS1Load.loadFile(project, RGSS1Load.getMapFile(project, roid)));
o.get(roid).setInstanceVariable("@id", RubyFixnum.newFixnum(o.get(roid).getRuntime(), roid));
o.get(roid).setInstanceVariable("@name", ((RubyObject) r.get(roid)).getInstanceVariable("@name"));
// search for the hightes id
if (roid > max) {
max = roid;
}
}
// build the list
ArrayList<SystemGObject> ro = new ArrayList<SystemGObject>();
for (int i = 0; i <= max; i++) {
// add it
if (o.containsKey(i)) {
ro.add(new SystemGObject(o.get(i)));
} else {
// build filler
RubyObject no = (RubyObject) RGSSProjectHelper.getInterpreter(project).runScriptlet("return RPG::Map.new(20,15)");
no.setInstanceVariable("@name", RubyString.newString(r.getRuntime(), "Fill " + i));
no.setInstanceVariable("@id", RubyFixnum.newFixnum(o.get(i).getRuntime(), i));
// add filler
ro.add(new SystemGObject(no));
}