diff options
Diffstat (limited to 'src/core/commandbuffer.cc')
-rw-r--r-- | src/core/commandbuffer.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc index 78b76af..53d200f 100644 --- a/src/core/commandbuffer.cc +++ b/src/core/commandbuffer.cc @@ -121,9 +121,20 @@ void func_list_var(std::string const &args) Cvar::list(); } -void func_list_ent(std::string const &args) +void func_list_entity(std::string const &args) { - Entity::list(); + unsigned long id; + std::istringstream argstream(args); + if (argstream >> id) { + Entity *entity = Entity::find(id); + if (entity) { + entity->print(); + } else { + con_print << "Could not find entity with id " << id << std::endl; + } + } else { + Entity::list(); + } } void func_list_inventory(std::string const &args) @@ -133,7 +144,8 @@ void func_list_inventory(std::string const &args) if (argstream >> id) { Entity *entity = Entity::find(id); if (entity) { - entity->list_inventory(); + entity->print_header(); + entity->print_inventory(); } else { con_print << "Could not find entity with id " << id << std::endl; } @@ -269,7 +281,7 @@ void CommandBuffer::init() //con_debug << "Initializing command buffer...\n"; Func *func = 0; - func = Func::add("list_ent", (FuncPtr)func_list_ent); + func = Func::add("list_entity", (FuncPtr)func_list_entity); func->set_info("list entities"); func = Func::add("list_func", (FuncPtr)func_list_func); |