comparison 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
comparison
equal deleted inserted replaced
54:d7cde171a1de 55:f1a27ee7e03c
51 #endif 51 #endif
52 52
53 command_map[cmd] = info; 53 command_map[cmd] = info;
54 } 54 }
55 55
56 void CommandHandler::PrintCmd(Cmd& cmd)
57 {
58 CommandMap::iterator it;
59 it = command_map.find(cmd);
60
61 fprintf(stderr, "%d - %d : ", cmd.scn, cmd.pos);
62 if (it == command_map.end())
63 fprintf(stderr, "%02d:%02d:%04d", cmd.cmd1, cmd.cmd2, cmd.cmd3);
64 else
65 fprintf(stderr, "%s", it->second.descr);
66 fprintf(stderr, "[%d] (", cmd.cmd4);
67 int i;
68 for (i=0; i<cmd.args.size(); i++) {
69 VarInfo info = cmd.args[i];
70 if (info.type == TYPE_STR || info.type == TYPE_VARSTR)
71 fprintf(stderr, "\"%s\"", cmd.Str(info));
72 else
73 fprintf(stderr, "%d", info.value);
74 if (i < cmd.args.size()-1)
75 fprintf(stderr, ", ");
76 }
77 fprintf(stderr,");\n");
78 }
79
56 bool CommandHandler::Exec(Cmd &cmd) { 80 bool CommandHandler::Exec(Cmd &cmd) {
57 CommandMap::iterator it; 81 CommandMap::iterator it;
58 82
59 it = command_map.find(cmd); 83 it = command_map.find(cmd);
60 if (it == command_map.end()) { 84 if (it == command_map.end()) {