Mercurial > otakunoraifu
diff scn2k/command_handler.cc @ 55:f1a27ee7e03c
* started the same changes on scn2k_text.cc
* handle opcodes childObj*. In fact, it was handled (in a strange way, but it worked) before the previous changeset
author | thib |
---|---|
date | Wed, 22 Apr 2009 15:01:42 +0000 |
parents | d7cde171a1de |
children |
line wrap: on
line diff
--- a/scn2k/command_handler.cc +++ b/scn2k/command_handler.cc @@ -53,6 +53,30 @@ void CommandHandler::RegisterCommand(int command_map[cmd] = info; } +void CommandHandler::PrintCmd(Cmd& cmd) +{ + CommandMap::iterator it; + it = command_map.find(cmd); + + fprintf(stderr, "%d - %d : ", cmd.scn, cmd.pos); + if (it == command_map.end()) + fprintf(stderr, "%02d:%02d:%04d", cmd.cmd1, cmd.cmd2, cmd.cmd3); + else + fprintf(stderr, "%s", it->second.descr); + fprintf(stderr, "[%d] (", cmd.cmd4); + int i; + for (i=0; i<cmd.args.size(); i++) { + VarInfo info = cmd.args[i]; + if (info.type == TYPE_STR || info.type == TYPE_VARSTR) + fprintf(stderr, "\"%s\"", cmd.Str(info)); + else + fprintf(stderr, "%d", info.value); + if (i < cmd.args.size()-1) + fprintf(stderr, ", "); + } + fprintf(stderr,");\n"); +} + bool CommandHandler::Exec(Cmd &cmd) { CommandMap::iterator it;