00001 /* $Id: console_internal.h 19085 2010-02-10 18:18:08Z smatz $ */ 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 "console_type.h" 00016 00017 enum { 00018 ICON_CMDLN_SIZE = 1024, 00019 ICON_MAX_STREAMSIZE = 2048, 00020 }; 00021 00029 typedef bool IConsoleCmdProc(byte argc, char *argv[]); 00030 typedef bool IConsoleHook(); 00031 struct IConsoleCmd { 00032 char *name; 00033 IConsoleCmd *next; 00034 00035 IConsoleCmdProc *proc; 00036 IConsoleHook *hook; 00037 }; 00038 00050 struct IConsoleAlias { 00051 char *name; 00052 IConsoleAlias *next; 00053 00054 char *cmdline; 00055 }; 00056 00057 /* console parser */ 00058 extern IConsoleCmd *_iconsole_cmds; 00059 extern IConsoleAlias *_iconsole_aliases; 00060 00061 /* console functions */ 00062 void IConsoleClearBuffer(); 00063 00064 /* Commands */ 00065 void IConsoleCmdRegister(const char *name, IConsoleCmdProc *proc, IConsoleHook *hook = NULL); 00066 void IConsoleAliasRegister(const char *name, const char *cmd); 00067 IConsoleCmd *IConsoleCmdGet(const char *name); 00068 IConsoleAlias *IConsoleAliasGet(const char *name); 00069 00070 /* console std lib (register ingame commands/aliases) */ 00071 void IConsoleStdLibRegister(); 00072 00073 /* Supporting functions */ 00074 bool GetArgumentInteger(uint32 *value, const char *arg); 00075 00076 void IConsoleGUIInit(); 00077 void IConsoleGUIFree(); 00078 void IConsoleGUIPrint(ConsoleColour colour_code, char *string); 00079 00080 #endif /* CONSOLE_INTERNAL_H */