705 } |
705 } |
706 |
706 |
707 if (!CloseConsoleLogIfActive()) { |
707 if (!CloseConsoleLogIfActive()) { |
708 if (argc < 2) return false; |
708 if (argc < 2) return false; |
709 |
709 |
710 IConsolePrintF(_icolour_def, "file output started to: %s", argv[1]); |
710 IConsolePrintF(_icolour_def, "file output started to: %s", argv[1]); |
711 _iconsole_output_file = fopen(argv[1], "ab"); |
711 _iconsole_output_file = fopen(argv[1], "ab"); |
712 if (_iconsole_output_file == NULL) IConsoleError("could not open file"); |
712 if (_iconsole_output_file == NULL) IConsoleError("could not open file"); |
713 } |
713 } |
714 |
714 |
715 return true; |
715 return true; |
900 const IConsoleCmd *cmd; |
900 const IConsoleCmd *cmd; |
901 const IConsoleVar *var; |
901 const IConsoleVar *var; |
902 const IConsoleAlias *alias; |
902 const IConsoleAlias *alias; |
903 |
903 |
904 cmd = IConsoleCmdGet(argv[1]); |
904 cmd = IConsoleCmdGet(argv[1]); |
905 if (cmd != NULL) { |
905 if (cmd != NULL) { |
906 cmd->proc(0, NULL); |
906 cmd->proc(0, NULL); |
907 return true; |
907 return true; |
908 } |
908 } |
909 |
909 |
910 alias = IConsoleAliasGet(argv[1]); |
910 alias = IConsoleAliasGet(argv[1]); |
911 if (alias != NULL) { |
911 if (alias != NULL) { |
912 cmd = IConsoleCmdGet(alias->cmdline); |
912 cmd = IConsoleCmdGet(alias->cmdline); |
913 if (cmd != NULL) { |
913 if (cmd != NULL) { |
914 cmd->proc(0, NULL); |
914 cmd->proc(0, NULL); |
915 return true; |
915 return true; |
916 } |
916 } |
917 IConsolePrintF(_icolour_err, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline); |
917 IConsolePrintF(_icolour_err, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline); |
918 return true; |
918 return true; |
919 } |
919 } |
920 |
920 |
921 var = IConsoleVarGet(argv[1]); |
921 var = IConsoleVarGet(argv[1]); |
922 if (var != NULL && var->help != NULL) { |
922 if (var != NULL && var->help != NULL) { |
923 IConsoleHelp(var->help); |
923 IConsoleHelp(var->help); |
924 return true; |
924 return true; |
925 } |
925 } |
926 |
926 |
927 IConsoleError("command or variable not found"); |
927 IConsoleError("command or variable not found"); |
928 return true; |
928 return true; |
929 } |
929 } |
930 |
930 |
931 IConsolePrint(13, " ---- OpenTTD Console Help ---- "); |
931 IConsolePrint(13, " ---- OpenTTD Console Help ---- "); |
932 IConsolePrint( 1, " - variables: [command to list all variables: list_vars]"); |
932 IConsolePrint( 1, " - variables: [command to list all variables: list_vars]"); |
933 IConsolePrint( 1, " set value with '<var> = <value>', use '++/--' to in-or decrement"); |
933 IConsolePrint( 1, " set value with '<var> = <value>', use '++/--' to in-or decrement"); |
934 IConsolePrint( 1, " or omit '=' and just '<var> <value>'. get value with typing '<var>'"); |
934 IConsolePrint( 1, " or omit '=' and just '<var> <value>'. get value with typing '<var>'"); |
1250 IConsoleCmdRegister("resetengines", ConResetEngines); |
1250 IConsoleCmdRegister("resetengines", ConResetEngines); |
1251 IConsoleCmdRegister("return", ConReturn); |
1251 IConsoleCmdRegister("return", ConReturn); |
1252 IConsoleCmdRegister("screenshot", ConScreenShot); |
1252 IConsoleCmdRegister("screenshot", ConScreenShot); |
1253 IConsoleCmdRegister("script", ConScript); |
1253 IConsoleCmdRegister("script", ConScript); |
1254 IConsoleCmdRegister("scrollto", ConScrollToTile); |
1254 IConsoleCmdRegister("scrollto", ConScrollToTile); |
1255 IConsoleCmdRegister("alias", ConAlias); |
1255 IConsoleCmdRegister("alias", ConAlias); |
1256 IConsoleCmdRegister("load", ConLoad); |
1256 IConsoleCmdRegister("load", ConLoad); |
1257 IConsoleCmdRegister("save", ConSave); |
1257 IConsoleCmdRegister("save", ConSave); |
1258 IConsoleCmdRegister("ls", ConListFiles); |
1258 IConsoleCmdRegister("ls", ConListFiles); |
1259 IConsoleCmdRegister("cd", ConChangeDirectory); |
1259 IConsoleCmdRegister("cd", ConChangeDirectory); |
1260 IConsoleCmdRegister("pwd", ConPrintWorkingDirectory); |
1260 IConsoleCmdRegister("pwd", ConPrintWorkingDirectory); |
1261 IConsoleCmdRegister("clear", ConClearBuffer); |
1261 IConsoleCmdRegister("clear", ConClearBuffer); |
1262 IConsoleCmdRegister("stopall", ConStopAllVehicles); |
1262 IConsoleCmdRegister("stopall", ConStopAllVehicles); |