More refactoring and cleanup

This commit is contained in:
2021-11-16 13:14:59 -05:00
parent 077b2fc23b
commit 51a95cc964
8 changed files with 49 additions and 36 deletions

View File

@@ -26,7 +26,6 @@ private:
LuaConsole console_;
PrintChanneler print_channeler_;
Gui gui_;
int64_t gui_place_;
int64_t actor_id_;
void do_lua_command(const StringVec &words) {
@@ -38,21 +37,13 @@ private:
}
void do_view_command(const StringVec &cmd) {
for (int64_t id : world_->get_near(actor_id_, 100, true)) {
const Tangible *tan = world_->tangible_get(id);
const AnimStep &aqback = tan->anim_queue_.back();
stdostream() << id << ": " << aqback.graphic() << " " << aqback.plane() << " " << aqback.xyz().debug_string() << std::endl;
}
stdostream() << world_->tangibles_near_debug_string(actor_id_, 100);
}
void do_menu_command(const StringVec &cmd) {
gui_place_ = util::strtoint(cmd[1], actor_id_);
world_->update_gui(actor_id_, gui_place_, &gui_);
int index = 0;
for (const GuiElt &elt : gui_.elts()) {
stdostream() << index << " " << elt.label() << std::endl;
index += 1;
}
int64_t place = util::strtoint(cmd[1], actor_id_);
world_->update_gui(actor_id_, place, &gui_);
stdostream() << gui_.menu_debug_string();
}
void do_choose_command(const StringVec &cmd) {
@@ -61,7 +52,7 @@ private:
stdostream() << "Invalid menu item #" << std::endl;
return;
}
Invocation inv(Invocation::KIND_PLAN, actor_id_, gui_place_, action);
Invocation inv(Invocation::KIND_PLAN, actor_id_, gui_.place(), action);
stdostream() << "Invoking: " << inv.debug_string() << std::endl;
world_->invoke(inv);
}
@@ -104,7 +95,7 @@ private:
if (p.first == actor_id_) {
actor_id_ = p.second;
stdostream() << "Login actor ID: " << actor_id_ << std::endl;
gui_.clear();
gui_.clear(0);
}
}
}