From 22a375ba730d0acf02b0ee279bc9d7ae99ea58e6 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Mon, 2 May 2005 15:52:19 +0000 Subject: (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'. - Some variables are really special and cannot be assigned normally, use their callback procedure for assignment/querying. This commit also obsoletes "[1172804] Console set command cleanup" --- console_cmds.c | 1498 +++++++++++++++++++++++++++----------------------------- 1 file changed, 721 insertions(+), 777 deletions(-) (limited to 'console_cmds.c') diff --git a/console_cmds.c b/console_cmds.c index 88b7bb3c2..d0c316777 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -1,4 +1,3 @@ -/* -------------------- dont cross this line --------------------- */ #include "stdafx.h" #include "ttd.h" #include "console.h" @@ -15,93 +14,67 @@ #include "settings.h" #include "hal.h" /* for file list */ - // ** scriptfile handling ** // -static FILE * _script_file; +static FILE *_script_file; static bool _script_running; // ** console command / variable defines ** // - -#define DEF_CONSOLE_CMD(yyyy) static _iconsole_var * yyyy(byte argc, char* argv[], byte argt[]) -#define DEF_CONSOLE_CMD_HOOK(yyyy) static bool yyyy(_iconsole_cmd * hookcmd) -#define DEF_CONSOLE_VAR_HOOK(yyyy) static bool yyyy(_iconsole_var * hookvar) +#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[]) +#define DEF_CONSOLE_HOOK(function) static bool function(void) -// ** supporting functions ** // - -static uint32 GetArgumentInteger(const char* arg) -{ - uint32 result; - sscanf(arg, "%u", &result); - - if (result == 0 && arg[0] == '0' && arg[1] == 'x') - sscanf(arg, "%x", &result); - - return result; -} - /* **************************** */ /* variable and command hooks */ /* **************************** */ #ifdef ENABLE_NETWORK -DEF_CONSOLE_CMD_HOOK(ConCmdHookNoNetwork) +static inline bool NetworkAvailable(void) { - if (_networking) { - IConsoleError("This command is forbidden in multiplayer."); + if (!_network_available) { + IConsoleError("You cannot use this command because there is no network available."); return false; } return true; } -DEF_CONSOLE_VAR_HOOK(ConVarHookNoNetClient) +DEF_CONSOLE_HOOK(ConHookServerOnly) { - if (!_network_available) { - IConsoleError("You can not use this command because there is no network available."); - return false; - } + if (!NetworkAvailable()) return false; + if (!_network_server) { - IConsoleError("This variable only makes sense for a network server."); + IConsoleError("This variable is only available to a network server."); return false; } return true; } -DEF_CONSOLE_CMD_HOOK(ConCmdHookNoNetClient) +DEF_CONSOLE_HOOK(ConHookClientOnly) { - if (!_network_available) { - IConsoleError("You can not use this command because there is no network available."); - return false; - } - if (!_network_server) { - IConsoleError("This command is only available for a network server."); + if (!NetworkAvailable()) return false; + + if (_network_server) { + IConsoleError("This command is not available to a network server."); return false; } return true; } -DEF_CONSOLE_CMD_HOOK(ConCmdHookNoNetServer) +DEF_CONSOLE_HOOK(ConHookNeedNetwork) { - if (!_network_available) { - IConsoleError("You can not use this command because there is no network available."); - return false; - } - if (_network_server) { - IConsoleError("You can not use this command because you are a network-server."); + if (!NetworkAvailable()) return false; + + if (!_networking) { + IConsoleError("Not connected. This command is only available in multiplayer."); return false; } return true; } -DEF_CONSOLE_CMD_HOOK(ConCmdHookNeedNetwork) +DEF_CONSOLE_HOOK(ConHookNoNetwork) { - if (!_network_available) { - IConsoleError("You can not use this command because there is no network available."); - return false; - } - if (!_networking) { - IConsoleError("Not connected. Multiplayer only command."); + if (_networking) { + IConsoleError("This command is forbidden in multiplayer."); return false; } return true; @@ -109,72 +82,90 @@ DEF_CONSOLE_CMD_HOOK(ConCmdHookNeedNetwork) #endif /* ENABLE_NETWORK */ -/* **************************** */ -/* reset commands */ -/* **************************** */ +static void IConsoleHelp(const char *str) +{ + IConsolePrintF(_iconsole_color_warning, "- %s", str); +} DEF_CONSOLE_CMD(ConResetEngines) { + if (argc == 0) { + IConsoleHelp("Reset status data of all engines. This might solve some issues with 'lost' engines. Usage: 'resetengines'"); + return true; + } + StartupEngines(); - return 0; + return true; } #ifdef _DEBUG DEF_CONSOLE_CMD(ConResetTile) { + if (argc == 0) { + IConsoleHelp("Reset a tile to bare land. Usage: 'resettile '"); + IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)"); + return true; + } + if (argc == 2) { - TileIndex tile = (TileIndex)GetArgumentInteger(argv[1]); - DoClearSquare(tile); + uint32 result; + if (GetArgumentInteger(&result, argv[1])) { + DoClearSquare((TileIndex)result); + return true; + } } - return 0; + return false; } -#endif DEF_CONSOLE_CMD(ConScrollToTile) { + if (argc == 0) { + IConsoleHelp("Center the screen on a given tile. Usage: 'scrollto '"); + IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)"); + return true; + } + if (argc == 2) { - TileIndex tile = (TileIndex)GetArgumentInteger(argv[1]); - ScrollMainWindowToTile(tile); + uint32 result; + if (GetArgumentInteger(&result, argv[1])) { + ScrollMainWindowToTile((TileIndex)result); + return true; + } } - return 0; + return false; } +#endif /* _DEBUG */ extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm); extern void BuildFileList(void); extern void SetFiosType(const byte fiostype); -/* Save the map to current dir */ -static void SaveMap(const char *filename) -{ - char buf[200]; - - snprintf(buf, lengthof(buf), "%s%s%s.sav", _path.save_dir, PATHSEP, filename); - IConsolePrint(_iconsole_color_default, "Saving map..."); - - if (SaveOrLoad(buf, SL_SAVE) != SL_OK) { - IConsolePrint(_iconsole_color_error, "SaveMap failed"); - } else - IConsolePrintF(_iconsole_color_default, "Map sucessfully saved to %s", buf); -} - /* Save the map to a file */ DEF_CONSOLE_CMD(ConSave) { - /* We need 1 argument */ + if (argc == 0) { + IConsoleHelp("Save the current game. Usage: 'save '"); + return true; + } + if (argc == 2) { - /* Save the map */ - SaveMap(argv[1]); - return NULL; + char buf[200]; + + snprintf(buf, lengthof(buf), "%s%s%s.sav", _path.save_dir, PATHSEP, argv[1]); + IConsolePrint(_iconsole_color_default, "Saving map..."); + + if (SaveOrLoad(buf, SL_SAVE) != SL_OK) { + IConsolePrint(_iconsole_color_error, "SaveMap failed"); + } else + IConsolePrintF(_iconsole_color_default, "Map sucessfully saved to %s", buf); + return true; } - /* Give usage */ - IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: save "); - return NULL; + return false; } - static const FiosItem* GetFiosItem(const char* file) { int i; @@ -198,104 +189,101 @@ static const FiosItem* GetFiosItem(const char* file) DEF_CONSOLE_CMD(ConLoad) { - const FiosItem* item; - const char* file; + const FiosItem *item; + const char *file; - if (argc != 2) { - IConsolePrint(_iconsole_color_default, "Usage: load "); - return NULL; + if (argc == 0) { + IConsoleHelp("Load a game by name or index. Usage: 'load '"); + return true; } + if (argc != 2) return false; + file = argv[1]; item = GetFiosItem(file); if (item != NULL) { switch (item->type) { - case FIOS_TYPE_FILE: - case FIOS_TYPE_OLDFILE: + case FIOS_TYPE_FILE: case FIOS_TYPE_OLDFILE: _switch_mode = SM_LOAD; SetFiosType(item->type); strcpy(_file_to_saveload.name, FiosBrowseTo(item)); break; - - default: - IConsolePrintF(_iconsole_color_error, "%s: Not a map.", file); - break; + default: IConsolePrintF(_iconsole_color_error, "%s: Not a savegame.", file); } - } else { - IConsolePrintF(_iconsole_color_error, "%s: No such file or directory.", - file); - } + } else + IConsolePrintF(_iconsole_color_error, "%s: No such file or directory.", file); FiosFreeSavegameList(); - return NULL; + return true; } - /* List all the files in the current dir via console */ DEF_CONSOLE_CMD(ConListFiles) { int i; + if (argc == 0) { + IConsoleHelp("List all the files in the current dir via console. Usage: 'ls | dir'"); + return true; + } + BuildFileList(); for (i = 0; i < _fios_num; i++) { - const FiosItem* item = &_fios_list[i]; - - IConsolePrintF(_iconsole_color_default, "%d) %s", - i, item->title[0] != '\0' ? item->title : item->name); + const FiosItem *item = &_fios_list[i]; + IConsolePrintF(_iconsole_color_default, "%d) %s", i, (item->title[0] != '\0') ? item->title : item->name); } FiosFreeSavegameList(); - return NULL; + return true; } - /* Change the dir via console */ DEF_CONSOLE_CMD(ConChangeDirectory) { - const FiosItem* item; - const char* file; + const FiosItem *item; + const char *file; - if (argc != 2) { - IConsolePrint(_iconsole_color_default, "Usage: cd "); - return NULL; + if (argc == 0) { + IConsoleHelp("Change the dir via console. Usage: 'cd '"); + return true; } + if (argc != 2) return false; + file = argv[1]; item = GetFiosItem(file); if (item != NULL) { switch (item->type) { - case FIOS_TYPE_DIR: - case FIOS_TYPE_DRIVE: - case FIOS_TYPE_PARENT: + case FIOS_TYPE_DIR: case FIOS_TYPE_DRIVE: case FIOS_TYPE_PARENT: FiosBrowseTo(item); break; - - default: - IConsolePrintF(_iconsole_color_error, "%s: Not a directory.", file); - break; + default: IConsolePrintF(_iconsole_color_error, "%s: Not a directory.", file); } - } else { - IConsolePrintF(_iconsole_color_error, "%s: No such file or directory.", - file); - } + } else + IConsolePrintF(_iconsole_color_error, "%s: No such file or directory.", file); FiosFreeSavegameList(); - return NULL; + return true; } DEF_CONSOLE_CMD(ConPrintWorkingDirectory) { - const char* path; + const char *path; + + if (argc == 0) { + IConsoleHelp("Print out the current working directory. Usage: 'pwd'"); + return true; + } - // XXX Workaround for broken file handling + // XXX - Workaround for broken file handling FiosGetSavegameList(&_fios_num, SLD_LOAD_GAME); FiosFreeSavegameList(); FiosGetDescText(&path, NULL); IConsolePrint(_iconsole_color_default, path); - return NULL; + return true; } @@ -307,72 +295,81 @@ DEF_CONSOLE_CMD(ConPrintWorkingDirectory) DEF_CONSOLE_CMD(ConBan) { NetworkClientInfo *ci; + uint32 index; - if (argc == 2) { - uint32 index = atoi(argv[1]); - if (index == NETWORK_SERVER_INDEX) { - IConsolePrint(_iconsole_color_default, "Silly boy, you can not ban yourself!"); - return NULL; - } - if (index == 0) { - IConsoleError("Invalid Client-ID"); - return NULL; - } + if (argc == 0) { + IConsoleHelp("Ban a player from a network game. Usage: 'ban '"); + IConsoleHelp("For client-id's, see the command 'clients'"); + return true; + } - ci = NetworkFindClientInfoFromIndex(index); + if (argc != 2) return false; - if (ci != NULL) { - uint i; - /* Add user to ban-list */ - for (i = 0; i < lengthof(_network_ban_list); i++) { - if (_network_ban_list[i] == NULL || _network_ban_list[i][0] == '\0') { - _network_ban_list[i] = strdup(inet_ntoa(*(struct in_addr *)&ci->client_ip)); - break; - } - } + index = atoi(argv[1]); - SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED); - return NULL; - } else { - IConsoleError("Client-ID not found"); - return NULL; - } + if (index == NETWORK_SERVER_INDEX) { + IConsolePrint(_iconsole_color_default, "Silly boy, you can not ban yourself!"); + return true; + } + if (index == 0) { + IConsoleError("Invalid Client-ID"); + return true; } - IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: ban . For client-ids, see 'clients'."); - - return NULL; -} + ci = NetworkFindClientInfoFromIndex(index); -DEF_CONSOLE_CMD(ConUnBan) -{ - if (argc == 2) { + if (ci != NULL) { uint i; + /* Add user to ban-list */ for (i = 0; i < lengthof(_network_ban_list); i++) { - if (_network_ban_list[i] == NULL || _network_ban_list[i][0] == '\0') - continue; - - if (strncmp(_network_ban_list[i], argv[1], strlen(_network_ban_list[i])) == 0) { - _network_ban_list[i][0] = '\0'; - IConsolePrint(_iconsole_color_default, "IP unbanned."); - return NULL; + if (_network_ban_list[i] == NULL || _network_ban_list[i][0] == '\0') { + _network_ban_list[i] = strdup(inet_ntoa(*(struct in_addr *)&ci->client_ip)); + break; } } - IConsolePrint(_iconsole_color_default, "IP not in ban-list."); + SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED); + } else + IConsoleError("Client-ID not found"); - return NULL; + return true; +} + +DEF_CONSOLE_CMD(ConUnBan) +{ + uint i; + + if (argc == 0) { + IConsoleHelp("Unban a player from a network game. Usage: 'unban '"); + return true; } - IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: unban ."); + if (argc != 2) return false; + + for (i = 0; i < lengthof(_network_ban_list); i++) { + if (_network_ban_list[i] == NULL || _network_ban_list[i][0] == '\0') + continue; + + if (strncmp(_network_ban_list[i], argv[1], strlen(_network_ban_list[i])) == 0) { + _network_ban_list[i][0] = '\0'; + IConsolePrint(_iconsole_color_default, "IP unbanned."); + return true; + } + } - return NULL; + IConsolePrint(_iconsole_color_default, "IP not in ban-list."); + return true; } DEF_CONSOLE_CMD(ConBanList) { uint i; + if (argc == 0) { + IConsoleHelp("List the IP's of banned clients: Usage 'banlist'"); + return true; + } + IConsolePrint(_iconsole_color_default, "Banlist: "); for (i = 0; i < lengthof(_network_ban_list); i++) { @@ -382,115 +379,109 @@ DEF_CONSOLE_CMD(ConBanList) IConsolePrintF(_iconsole_color_default, " %d) %s", i + 1, _network_ban_list[i]); } - return NULL; + return true; } DEF_CONSOLE_CMD(ConPauseGame) { + if (argc == 0) { + IConsoleHelp("Pause a network game. Usage: 'pause'"); + return true; + } + if (_pause == 0) { DoCommandP(0, 1, 0, NULL, CMD_PAUSE); IConsolePrint(_iconsole_color_default, "Game paused."); } else IConsolePrint(_iconsole_color_default, "Game is already paused."); - return NULL; + return true; } DEF_CONSOLE_CMD(ConUnPauseGame) { + if (argc == 0) { + IConsoleHelp("Unpause a network game. Usage: 'unpause'"); + return true; + } + if (_pause != 0) { DoCommandP(0, 0, 0, NULL, CMD_PAUSE); IConsolePrint(_iconsole_color_default, "Game unpaused."); } else IConsolePrint(_iconsole_color_default, "Game is already unpaused."); - return NULL; + return true; } DEF_CONSOLE_CMD(ConRcon) { - if (argc < 3) { - IConsolePrint(_iconsole_color_default, "Usage: rcon "); - return NULL; + if (argc == 0) { + IConsoleHelp("Remote control the server from another client. Usage: 'rcon '"); + IConsoleHelp("Remember to enclose the command in quotes, otherwise only the first parameter is sent"); + return true; } - SEND_COMMAND(PACKET_CLIENT_RCON)(argv[1], argv[2]); + if (argc < 3) return false; - return NULL; + SEND_COMMAND(PACKET_CLIENT_RCON)(argv[1], argv[2]); + return true; } DEF_CONSOLE_CMD(ConStatus) { + static const char *stat_str[] = {"inactive", "authorized", "waiting", "loading map", "map done", "ready", "active"}; const char *status; - int lag; const NetworkClientState *cs; - const NetworkClientInfo *ci; + + if (argc == 0) { + IConsoleHelp("List the status of all clients connected to the server: Usage 'status'"); + return true; + } + FOR_ALL_CLIENTS(cs) { - lag = NetworkCalculateLag(cs); - ci = DEREF_CLIENT_INFO(cs); + int lag = NetworkCalculateLag(cs); + const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs); - switch (cs->status) { - case STATUS_INACTIVE: - status = "inactive"; - break; - case STATUS_AUTH: - status = "authorized"; - break; - case STATUS_MAP_WAIT: - status = "waiting"; - break; - case STATUS_MAP: - status = "loading map"; - break; - case STATUS_DONE_MAP: - status = "done map"; - break; - case STATUS_PRE_ACTIVE: - status = "ready"; - break; - case STATUS_ACTIVE: - status = "active"; - break; - default: - status = "unknown"; - break; - } + status = (cs->status <= STATUS_ACTIVE) ? stat_str[cs->status] : "unknown"; IConsolePrintF(8, "Client #%d/%s status: %s frame-lag: %d play-as: %d unique-id: %s", cs->index, ci->client_name, status, lag, ci->client_playas, ci->unique_id); } - return NULL; + return true; } DEF_CONSOLE_CMD(ConKick) { NetworkClientInfo *ci; + uint32 index; - if (argc == 2) { - uint32 index = atoi(argv[1]); - if (index == NETWORK_SERVER_INDEX) { - IConsolePrint(_iconsole_color_default, "Silly boy, you can not kick yourself!"); - return NULL; - } - if (index == 0) { - IConsoleError("Invalid Client-ID"); - return NULL; - } + if (argc == 0) { + IConsoleHelp("Kick a player from a network game. Usage: 'kick '"); + IConsoleHelp("For client-id's, see the command 'clients'"); + return true; + } - ci = NetworkFindClientInfoFromIndex(index); + if (argc != 2) return false; - if (ci != NULL) { - SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED); - return NULL; - } else { - IConsoleError("Client-ID not found"); - return NULL; - } + index = atoi(argv[1]); + if (index == NETWORK_SERVER_INDEX) { + IConsolePrint(_iconsole_color_default, "Silly boy, you can not kick yourself!"); + return true; } + if (index == 0) { + IConsoleError("Invalid Client-ID"); + return true; + } + + ci = NetworkFindClientInfoFromIndex(index); - IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: kick . For client-ids, see 'clients'."); + if (ci != NULL) { + SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED); + } else + IConsoleError("Client-ID not found"); - return NULL; + return true; } DEF_CONSOLE_CMD(ConResetCompany) @@ -498,79 +489,92 @@ DEF_CONSOLE_CMD(ConResetCompany) Player *p; NetworkClientState *cs; NetworkClientInfo *ci; + byte index; - if (argc == 2) { - byte index = atoi(argv[1]); + if (argc == 0) { + IConsoleHelp("Remove an (idle) company from the game. Usage: 'reset_company '"); + return true; + } - /* Check valid range */ - if (index < 1 || index > MAX_PLAYERS) { - IConsolePrintF(_iconsole_color_error, "Company does not exist. Company-ID must be between 1 and %d.", MAX_PLAYERS); - return NULL; - } + if (argc != 2) return false; - /* Check if company does exist */ - index--; - p = DEREF_PLAYER(index); - if (!p->is_active) { - IConsolePrintF(_iconsole_color_error, "Company does not exist."); - return NULL; - } + index = atoi(argv[1]); - if (p->is_ai) { - IConsolePrintF(_iconsole_color_error, "Company is owned by an AI."); - return NULL; - } + /* Check valid range */ + if (index < 1 || index > MAX_PLAYERS) { + IConsolePrintF(_iconsole_color_error, "Company does not exist. Company-ID must be between 1 and %d.", MAX_PLAYERS); + return true; + } - /* Check if the company has active players */ - FOR_ALL_CLIENTS(cs) { - ci = DEREF_CLIENT_INFO(cs); - if (ci->client_playas-1 == index) { - IConsolePrintF(_iconsole_color_error, "Cannot remove company: a client is connected to that company."); - return NULL; - } - } - ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); + /* Check if company does exist */ + index--; + p = DEREF_PLAYER(index); + if (!p->is_active) { + IConsolePrintF(_iconsole_color_error, "Company does not exist."); + return true; + } + + if (p->is_ai) { + IConsolePrintF(_iconsole_color_error, "Company is owned by an AI."); + return true; + } + + /* Check if the company has active players */ + FOR_ALL_CLIENTS(cs) { + ci = DEREF_CLIENT_INFO(cs); if (ci->client_playas-1 == index) { IConsolePrintF(_iconsole_color_error, "Cannot remove company: a client is connected to that company."); - return NULL; + return true; } - - /* It is safe to remove this company */ - DoCommandP(0, 2, index, NULL, CMD_PLAYER_CTRL); - IConsolePrint(_iconsole_color_default, "Company deleted."); - return NULL; + } + ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); + if (ci->client_playas - 1 == index) { + IConsolePrintF(_iconsole_color_error, "Cannot remove company; a client is connected to that company."); + return true; } - IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: reset_company ."); + /* It is safe to remove this company */ + DoCommandP(0, 2, index, NULL, CMD_PLAYER_CTRL); + IConsolePrint(_iconsole_color_default, "Company deleted."); - return NULL; + return true; } DEF_CONSOLE_CMD(ConNetworkClients) { NetworkClientInfo *ci; + + if (argc == 0) { + IConsoleHelp("Get a list of connected clients including their ID, name, and company-id. Usage: 'clients'"); + return true; + } + for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) { if (ci->client_index != NETWORK_EMPTY_INDEX) { IConsolePrintF(8,"Client #%d name: %s play-as: %d", ci->client_index, ci->client_name, ci->client_playas); } } - return NULL; + return true; } DEF_CONSOLE_CMD(ConNetworkConnect) { - char* ip; + char *ip; const char *port = NULL; const char *player = NULL; uint16 rport; - if (argc<2) return NULL; + if (argc == 0) { + IConsoleHelp("Connect to a remote OTTD server and join the game. Usage: 'connect '"); + IConsoleHelp("IP can contain port and player: 'IP#Player:Port', eg: 'server.ottd.org#2:443'"); + return true; + } - if (_networking) { - // We are in network-mode, first close it! + if (argc < 2) return false; + + if (_networking) // We are in network-mode, first close it! NetworkDisconnect(); - } ip = argv[1]; rport = NETWORK_DEFAULT_PORT; @@ -589,7 +593,7 @@ DEF_CONSOLE_CMD(ConNetworkConnect) NetworkClientConnectGame(ip, rport); - return NULL; + return true; } #endif /* ENABLE_NETWORK */ @@ -600,36 +604,44 @@ DEF_CONSOLE_CMD(ConNetworkConnect) DEF_CONSOLE_CMD(ConExec) { - char cmd[1024]; + char cmdline[ICON_CMDLN_SIZE]; - if (argc < 2) return NULL; + if (argc == 0) { + IConsoleHelp("Execute a local script file. Usage: 'exec