From e505c6df0d99d8ca7d0f19ff93f1e8661b99e21a Mon Sep 17 00:00:00 2001 From: Sergey Lapin Date: Sat, 14 Sep 2024 21:19:33 +0300 Subject: [PATCH] Started working on building creation --- src/modules/stream/stream.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/modules/stream/stream.cpp b/src/modules/stream/stream.cpp index 520b759..d1a3223 100644 --- a/src/modules/stream/stream.cpp +++ b/src/modules/stream/stream.cpp @@ -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);