equal
deleted
inserted
replaced
230 } |
230 } |
231 |
231 |
232 void IConsoleInit(void) |
232 void IConsoleInit(void) |
233 { |
233 { |
234 uint i; |
234 uint i; |
235 #ifdef WITH_REV_HACK |
|
236 #define WITH_REV |
|
237 const char _openttd_revision[] = WITH_REV_HACK; |
|
238 #else |
|
239 #if defined(WITH_REV) |
|
240 extern char _openttd_revision[]; |
|
241 #endif |
|
242 #endif |
|
243 _iconsole_output_file = NULL; |
235 _iconsole_output_file = NULL; |
244 _iconsole_color_default = 1; |
236 _iconsole_color_default = 1; |
245 _iconsole_color_error = 3; |
237 _iconsole_color_error = 3; |
246 _iconsole_color_warning = 13; |
238 _iconsole_color_warning = 13; |
247 _iconsole_color_debug = 5; |
239 _iconsole_color_debug = 5; |
602 if (cmdline[i] == '%') { |
594 if (cmdline[i] == '%') { |
603 i++; |
595 i++; |
604 if (cmdline[i] == '+') { |
596 if (cmdline[i] == '+') { |
605 // all params seperated: "[param 1]" "[param 2]" |
597 // all params seperated: "[param 1]" "[param 2]" |
606 t=1; |
598 t=1; |
607 while ((tokens[t]!=NULL) && (t<20) && |
599 while ((tokens[t]!=NULL) && (t<20) && |
608 ((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { |
600 ((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { |
609 int l2 = strlen(tokens[t]); |
601 int l2 = strlen(tokens[t]); |
610 *linestream = '"'; |
602 *linestream = '"'; |
611 linestream++; |
603 linestream++; |
612 memcpy(linestream,tokens[t],l2); |
604 memcpy(linestream,tokens[t],l2); |
621 } else if (cmdline[i] == '!') { |
613 } else if (cmdline[i] == '!') { |
622 // merge the params to one: "[param 1] [param 2] [param 3...]" |
614 // merge the params to one: "[param 1] [param 2] [param 3...]" |
623 t=1; |
615 t=1; |
624 *linestream = '"'; |
616 *linestream = '"'; |
625 linestream++; |
617 linestream++; |
626 while ((tokens[t]!=NULL) && (t<20) && |
618 while ((tokens[t]!=NULL) && (t<20) && |
627 ((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { |
619 ((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { |
628 int l2 = strlen(tokens[t]); |
620 int l2 = strlen(tokens[t]); |
629 memcpy(linestream,tokens[t],l2); |
621 memcpy(linestream,tokens[t],l2); |
630 linestream += l2; |
622 linestream += l2; |
631 *linestream = ' '; |
623 *linestream = ' '; |
638 x += 2; |
630 x += 2; |
639 } else { |
631 } else { |
640 // one specific parameter: %A = [param 1] %B = [param 2] ... |
632 // one specific parameter: %A = [param 1] %B = [param 2] ... |
641 int l2; |
633 int l2; |
642 t = ((byte)cmdline[i]) - 64; |
634 t = ((byte)cmdline[i]) - 64; |
643 if ((t<20) && (tokens[t]!=NULL) && |
635 if ((t<20) && (tokens[t]!=NULL) && |
644 ((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { |
636 ((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { |
645 l2 = strlen(tokens[t]); |
637 l2 = strlen(tokens[t]); |
646 *linestream = '"'; |
638 *linestream = '"'; |
647 linestream++; |
639 linestream++; |
648 memcpy(linestream,tokens[t],l2); |
640 memcpy(linestream,tokens[t],l2); |