00001 /* $Id: console_internal.h 24900 2013-01-08 22:46:42Z planetmaker $ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. 00006 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00007 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. 00008 */ 00009 00012 #ifndef CONSOLE_INTERNAL_H 00013 #define CONSOLE_INTERNAL_H 00014 00015 #include "gfx_type.h" 00016 00017 static const uint ICON_CMDLN_SIZE = 1024; 00018 static const uint ICON_MAX_STREAMSIZE = 2048; 00019 00021 enum ConsoleHookResult { 00022 CHR_ALLOW, 00023 CHR_DISALLOW, 00024 CHR_HIDE, 00025 }; 00026 00035 typedef bool IConsoleCmdProc(byte argc, char *argv[]); 00036 typedef ConsoleHookResult IConsoleHook(bool echo); 00037 struct IConsoleCmd { 00038 char *name; 00039 IConsoleCmd *next; 00040 00041 IConsoleCmdProc *proc; 00042 IConsoleHook *hook; 00043 }; 00044 00057 struct IConsoleAlias { 00058 char *name; 00059 IConsoleAlias *next; 00060 00061 char *cmdline; 00062 }; 00063 00064 /* console parser */ 00065 extern IConsoleCmd *_iconsole_cmds; 00066 extern IConsoleAlias *_iconsole_aliases; 00067 00068 /* console functions */ 00069 void IConsoleClearBuffer(); 00070 00071 /* Commands */ 00072 void IConsoleCmdRegister(const char *name, IConsoleCmdProc *proc, IConsoleHook *hook = NULL); 00073 void IConsoleAliasRegister(const char *name, const char *cmd); 00074 IConsoleCmd *IConsoleCmdGet(const char *name); 00075 IConsoleAlias *IConsoleAliasGet(const char *name); 00076 00077 /* console std lib (register ingame commands/aliases) */ 00078 void IConsoleStdLibRegister(); 00079 00080 /* Supporting functions */ 00081 bool GetArgumentInteger(uint32 *value, const char *arg); 00082 00083 void IConsoleGUIInit(); 00084 void IConsoleGUIFree(); 00085 void IConsoleGUIPrint(TextColour colour_code, char *string); 00086 char *RemoveUnderscores(char *name); 00087 00088 #endif /* CONSOLE_INTERNAL_H */