commands.cxx

changeset 8
c8bfa7e6ae1b
parent 7
118d3d5db64f
child 10
2c0f76090372
equal deleted inserted replaced
7:118d3d5db64f 8:c8bfa7e6ae1b
46 #include "str.h" 46 #include "str.h"
47 #include "commands.h" 47 #include "commands.h"
48 48
49 CommandDef* g_CommDef; 49 CommandDef* g_CommDef;
50 50
51 #define MAX
52 void ReadCommands () { 51 void ReadCommands () {
53 ScriptReader* r = new ScriptReader ((char*)"commands.def"); 52 ScriptReader* r = new ScriptReader ((char*)"commands.def");
54 g_CommDef = NULL; 53 g_CommDef = NULL;
55 CommandDef* curdef = g_CommDef; 54 CommandDef* curdef = g_CommDef;
56 unsigned int numCommDefs = 0; 55 unsigned int numCommDefs = 0;
140 */ 139 */
141 140
142 delete r; 141 delete r;
143 printf ("%d command definitions read.\n", numCommDefs); 142 printf ("%d command definitions read.\n", numCommDefs);
144 } 143 }
144
145 CommandDef* GetCommandByName (str a) {
146 a.tolower ();
147 CommandDef* c;
148 ITERATE_COMMANDS (c) {
149 str b = c->name;
150 b.tolower ();
151 if (!a.compare (b))
152 return c;
153 }
154
155 return NULL;
156 }

mercurial