Started working on building creation
This commit is contained in:
@@ -532,6 +532,20 @@ void StreamWorld::run_command(const String &command, const Array &args)
|
||||
update_items();
|
||||
print_line("changed building: " + itos(id) +
|
||||
" from: " + old_type + " to: " + new_type);
|
||||
} else if (command == "create_building") {
|
||||
int i;
|
||||
if (args.size() == 0) {
|
||||
print_error("bad command: not enough args: " + command);
|
||||
return;
|
||||
}
|
||||
const Dictionary &building_dict = args[0];
|
||||
const String &key = args[1];
|
||||
struct building b;
|
||||
// TODO: check that key is valid
|
||||
building::from_dict(&b, building_dict, key);
|
||||
buildings.push_back(b);
|
||||
load_building(buildings.size() - 1);
|
||||
// TODO: check it is enmough
|
||||
} else if (command == "remove_building") {
|
||||
if (args.size() == 0) {
|
||||
print_error("bad command: not enough args: " + command);
|
||||
|
||||
Reference in New Issue
Block a user