commands.cxx

changeset 17
b4fcc69e426a
parent 16
393359908179
child 19
66993500719f
equal deleted inserted replaced
16:393359908179 17:b4fcc69e426a
161 // "float" is for now just int. 161 // "float" is for now just int.
162 // TODO: find out how BotScript floats work 162 // TODO: find out how BotScript floats work
163 // (are they real floats or fixed? how are they 163 // (are they real floats or fixed? how are they
164 // stored?) and add proper floating point support. 164 // stored?) and add proper floating point support.
165 // NOTE: Also, shouldn't use RETURNVAL for data types.. 165 // NOTE: Also, shouldn't use RETURNVAL for data types..
166 t.tolower(); 166 t = t.tolower();
167 return !t.compare ("int") ? RETURNVAL_INT : 167 return !t.compare ("int") ? RETURNVAL_INT :
168 !t.compare ("float") ? RETURNVAL_INT : 168 !t.compare ("float") ? RETURNVAL_INT :
169 !t.compare ("str") ? RETURNVAL_STRING : 169 !t.compare ("str") ? RETURNVAL_STRING :
170 !t.compare ("void") ? RETURNVAL_VOID : 170 !t.compare ("void") ? RETURNVAL_VOID :
171 !t.compare ("bool") ? RETURNVAL_BOOLEAN : -1; 171 !t.compare ("bool") ? RETURNVAL_BOOLEAN : -1;
181 } 181 }
182 182
183 return ""; 183 return "";
184 } 184 }
185 185
186 CommandDef* GetCommandByName (str a) { 186 CommandDef* GetCommandByName (str fname) {
187 a.tolower (); 187 CommandDef* comm;
188 CommandDef* c; 188 ITERATE_COMMANDS (comm) {
189 ITERATE_COMMANDS (c) { 189 if (!fname.icompare (comm->name))
190 str b = c->name; 190 return comm;
191 b.tolower ();
192 if (!a.compare (b))
193 return c;
194 } 191 }
195 192
196 return NULL; 193 return NULL;
197 } 194 }

mercurial