| 314 | } |
| 315 | |
| 316 | void AddCommandString (const char *text, int keynum) |
| 317 | { |
| 318 | // Operate on a local copy instead of messing around with the data that's being passed in here. |
| 319 | TArray<char> buffer(strlen(text) + 1, true); |
| 320 | memcpy(buffer.Data(), text, buffer.Size()); |
| 321 | char *cmd = buffer.Data(); |
| 322 | char *brkpt; |
| 323 | int more; |
| 324 | |
| 325 | if (cmd) |
| 326 | { |
| 327 | while (*cmd) |
| 328 | { |
| 329 | brkpt = cmd; |
| 330 | while (*brkpt != ';' && *brkpt != '\0') |
| 331 | { |
| 332 | if (*brkpt == '\"') |
| 333 | { |
| 334 | brkpt++; |
| 335 | while (*brkpt != '\0' && (*brkpt != '\"' || *(brkpt-1) == '\\')) |
| 336 | brkpt++; |
| 337 | } |
| 338 | if (*brkpt != '\0') |
| 339 | brkpt++; |
| 340 | } |
| 341 | if (*brkpt == ';') |
| 342 | { |
| 343 | *brkpt = '\0'; |
| 344 | more = 1; |
| 345 | } |
| 346 | else |
| 347 | { |
| 348 | more = 0; |
| 349 | } |
| 350 | // Intercept wait commands here. Note: wait must be lowercase |
| 351 | while (*cmd > 0 && *cmd <= ' ') |
| 352 | cmd++; |
| 353 | if (*cmd) |
| 354 | { |
| 355 | if (!ParsingKeyConf && |
| 356 | cmd[0] == 'w' && cmd[1] == 'a' && cmd[2] == 'i' && cmd[3] == 't' && |
| 357 | (cmd[4] == 0 || cmd[4] == ' ')) |
| 358 | { |
| 359 | int tics; |
| 360 | |
| 361 | if (cmd[4] == ' ') |
| 362 | { |
| 363 | tics = (int)strtoll (cmd + 5, NULL, 0); |
| 364 | } |
| 365 | else |
| 366 | { |
| 367 | tics = 1; |
| 368 | } |
| 369 | if (tics > 0) |
| 370 | { |
| 371 | if (more) |
| 372 | { // The remainder of the command will be executed later |
| 373 | // Note that deferred commands lose track of which key |
no test coverage detected