Proper display of building types
This commit is contained in:
@@ -36,13 +36,6 @@ void StreamWorld::read_buildings_json(const String &buildings_path)
|
||||
continue;
|
||||
}
|
||||
building::from_dict(&b, json[key], key);
|
||||
#if 0
|
||||
b.key = key;
|
||||
b.id = json[key].get("id");
|
||||
String aabb_s = json[key].get("aabb");
|
||||
b.xform = from_string<Transform>(key);
|
||||
b.aabb = from_string<AABB>(aabb_s);
|
||||
#endif
|
||||
buildings.push_back(b);
|
||||
e = e->next();
|
||||
}
|
||||
@@ -67,7 +60,7 @@ void StreamWorld::save_buildings_json(const String &buildings_path)
|
||||
int i;
|
||||
String buildings_json = FileAccess::get_file_as_string(buildings_path);
|
||||
String backup_path = buildings_path + ".bak";
|
||||
String store_path = buildings_path + ".new";
|
||||
String store_path = buildings_path;
|
||||
FileAccess *fa = FileAccess::open(backup_path, FileAccess::WRITE);
|
||||
fa->store_string(buildings_json);
|
||||
fa->close();
|
||||
@@ -410,11 +403,12 @@ void StreamWorld::run_command(const String &command, const Array &args)
|
||||
}
|
||||
}
|
||||
Array ret_data;
|
||||
ret_data.resize(4);
|
||||
ret_data.resize(5);
|
||||
ret_data[0] = ret;
|
||||
ret_data[1] = dst;
|
||||
ret_data[2] = rkey;
|
||||
ret_data[3] = id;
|
||||
ret_data[4] = buildings[id].id;
|
||||
emit_signal("command_result", command, ret_data);
|
||||
} else if (command == "get_building_id_for_key") {
|
||||
if (args.size() == 0) {
|
||||
@@ -454,6 +448,12 @@ void StreamWorld::run_command(const String &command, const Array &args)
|
||||
String buildings_path =
|
||||
config.get_value("buildings", "buildings_path");
|
||||
save_buildings_json(buildings_path);
|
||||
} else if (command == "get_building_types") {
|
||||
Dictionary buildings_data =
|
||||
config.get_value("buildings", "building_data");
|
||||
Array ret_data;
|
||||
ret_data.push_back(buildings_data);
|
||||
emit_signal("command_result", command, ret_data);
|
||||
} else
|
||||
print_error("No command " + command);
|
||||
}
|
||||
|
||||
@@ -132,6 +132,10 @@ void WorldEditor::editor_command(const String &command, const Array &args)
|
||||
if (stream_world) {
|
||||
stream_world->run_command(command, args);
|
||||
}
|
||||
} else if (command == "get_building_types") {
|
||||
if (stream_world) {
|
||||
stream_world->run_command(command, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user