Implementation of the console hooks. More...
#include "stdafx.h"#include "console_internal.h"#include "debug.h"#include "engine_func.h"#include "landscape.h"#include "saveload/saveload.h"#include "network/network.h"#include "network/network_func.h"#include "network/network_base.h"#include "network/network_admin.h"#include "network/network_client.h"#include "command_func.h"#include "settings_func.h"#include "fios.h"#include "fileio_func.h"#include "screenshot.h"#include "genworld.h"#include "strings_func.h"#include "viewport_func.h"#include "window_func.h"#include "date_func.h"#include "company_func.h"#include "gamelog.h"#include "ai/ai.hpp"#include "ai/ai_config.hpp"#include "newgrf.h"#include "console_func.h"#include "engine_base.h"#include "game/game.hpp"#include "table/strings.h"#include "network/network_content.h"Go to the source code of this file.
Data Structures | |
| struct | ConsoleContentCallback |
| Asynchronous callback. More... | |
Defines | |
| #define | DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[]) |
| #define | DEF_CONSOLE_HOOK(function) static ConsoleHookResult function(bool echo) |
Functions | |
| static bool | NetworkAvailable (bool echo) |
| Check network availability and inform in console about failure of detection. | |
| DEF_CONSOLE_HOOK (ConHookServerOnly) | |
| Check whether we are a server. | |
| DEF_CONSOLE_HOOK (ConHookClientOnly) | |
| Check whether we are a client in a network game. | |
| DEF_CONSOLE_HOOK (ConHookNeedNetwork) | |
| Check whether we are in a multiplayer game. | |
| DEF_CONSOLE_HOOK (ConHookNoNetwork) | |
| Check whether we are in single player mode. | |
| DEF_CONSOLE_HOOK (ConHookNewGRFDeveloperTool) | |
| static void | IConsoleHelp (const char *str) |
| Show help for the console. | |
| DEF_CONSOLE_CMD (ConResetEngines) | |
| Reset status of all engines. | |
| DEF_CONSOLE_CMD (ConResetEnginePool) | |
| Reset status of the engine pool. | |
| DEF_CONSOLE_CMD (ConScrollToTile) | |
| Scroll to a tile on the map. | |
| DEF_CONSOLE_CMD (ConSave) | |
| Save the map to a file. | |
| DEF_CONSOLE_CMD (ConSaveConfig) | |
| Explicitly save the configuration. | |
| static const FiosItem * | GetFiosItem (const char *file) |
| Get savegame file informations. | |
| DEF_CONSOLE_CMD (ConLoad) | |
| DEF_CONSOLE_CMD (ConRemove) | |
| DEF_CONSOLE_CMD (ConListFiles) | |
| DEF_CONSOLE_CMD (ConChangeDirectory) | |
| DEF_CONSOLE_CMD (ConPrintWorkingDirectory) | |
| DEF_CONSOLE_CMD (ConClearBuffer) | |
| static bool | ConKickOrBan (const char *argv, bool ban) |
| DEF_CONSOLE_CMD (ConKick) | |
| DEF_CONSOLE_CMD (ConBan) | |
| DEF_CONSOLE_CMD (ConUnBan) | |
| DEF_CONSOLE_CMD (ConBanList) | |
| DEF_CONSOLE_CMD (ConPauseGame) | |
| DEF_CONSOLE_CMD (ConUnpauseGame) | |
| DEF_CONSOLE_CMD (ConRcon) | |
| DEF_CONSOLE_CMD (ConStatus) | |
| DEF_CONSOLE_CMD (ConServerInfo) | |
| DEF_CONSOLE_CMD (ConClientNickChange) | |
| DEF_CONSOLE_CMD (ConJoinCompany) | |
| DEF_CONSOLE_CMD (ConMoveClient) | |
| DEF_CONSOLE_CMD (ConResetCompany) | |
| DEF_CONSOLE_CMD (ConNetworkClients) | |
| DEF_CONSOLE_CMD (ConNetworkReconnect) | |
| DEF_CONSOLE_CMD (ConNetworkConnect) | |
| DEF_CONSOLE_CMD (ConExec) | |
| DEF_CONSOLE_CMD (ConReturn) | |
| bool | CloseConsoleLogIfActive () |
| DEF_CONSOLE_CMD (ConScript) | |
| DEF_CONSOLE_CMD (ConEcho) | |
| DEF_CONSOLE_CMD (ConEchoC) | |
| DEF_CONSOLE_CMD (ConNewGame) | |
| DEF_CONSOLE_CMD (ConRestart) | |
| static void | PrintLineByLine (char *buf) |
| Print a text buffer line by line to the console. | |
| DEF_CONSOLE_CMD (ConListAILibs) | |
| DEF_CONSOLE_CMD (ConListAI) | |
| DEF_CONSOLE_CMD (ConListGameLibs) | |
| DEF_CONSOLE_CMD (ConListGame) | |
| DEF_CONSOLE_CMD (ConStartAI) | |
| DEF_CONSOLE_CMD (ConReloadAI) | |
| DEF_CONSOLE_CMD (ConStopAI) | |
| DEF_CONSOLE_CMD (ConRescanAI) | |
| DEF_CONSOLE_CMD (ConRescanGame) | |
| DEF_CONSOLE_CMD (ConRescanNewGRF) | |
| DEF_CONSOLE_CMD (ConGetSeed) | |
| DEF_CONSOLE_CMD (ConGetDate) | |
| DEF_CONSOLE_CMD (ConAlias) | |
| DEF_CONSOLE_CMD (ConScreenShot) | |
| DEF_CONSOLE_CMD (ConInfoCmd) | |
| DEF_CONSOLE_CMD (ConDebugLevel) | |
| DEF_CONSOLE_CMD (ConExit) | |
| DEF_CONSOLE_CMD (ConPart) | |
| DEF_CONSOLE_CMD (ConHelp) | |
| DEF_CONSOLE_CMD (ConListCommands) | |
| DEF_CONSOLE_CMD (ConListAliases) | |
| DEF_CONSOLE_CMD (ConSay) | |
| DEF_CONSOLE_CMD (ConCompanies) | |
| DEF_CONSOLE_CMD (ConSayCompany) | |
| DEF_CONSOLE_CMD (ConSayClient) | |
| DEF_CONSOLE_CMD (ConCompanyPassword) | |
| static ContentType | StringToContentType (const char *str) |
| Resolve a string to a content type. | |
| DEF_CONSOLE_CMD (ConContent) | |
| DEF_CONSOLE_CMD (ConSetting) | |
| DEF_CONSOLE_CMD (ConSettingNewgame) | |
| DEF_CONSOLE_CMD (ConListSettings) | |
| DEF_CONSOLE_CMD (ConGamelogPrint) | |
| DEF_CONSOLE_CMD (ConNewGRFReload) | |
| void | IConsoleStdLibRegister () |
Variables | |
| static bool | _script_running |
| Script is running (used to abort execution when ConReturn is encountered). | |
Implementation of the console hooks.
Definition in file console_cmds.cpp.
| DEF_CONSOLE_CMD | ( | ConResetEngines | ) |
Reset status of all engines.
Definition at line 164 of file console_cmds.cpp.
References IConsoleHelp(), and StartupEngines().
| DEF_CONSOLE_CMD | ( | ConResetEnginePool | ) |
Reset status of the engine pool.
Definition at line 180 of file console_cmds.cpp.
References IConsoleError(), IConsoleHelp(), and EngineOverrideManager::ResetToCurrentNewGRFConfig().
| DEF_CONSOLE_CMD | ( | ConScrollToTile | ) |
Scroll to a tile on the map.
| arg1 | tile tile number or tile x coordinate. | |
| arg2 | optionally tile y coordinate. |
Definition at line 235 of file console_cmds.cpp.
References CC_ERROR, GetArgumentInteger(), IConsoleHelp(), IConsolePrint(), MapSize(), MapSizeX(), MapSizeY(), ScrollMainWindowToTile(), and TileXY().
| DEF_CONSOLE_CMD | ( | ConSave | ) |
Save the map to a file.
| filename | the filename to save the map to. |
Definition at line 279 of file console_cmds.cpp.
References CC_DEFAULT, CC_ERROR, free(), IConsoleHelp(), IConsolePrint(), IConsolePrintF(), SAVE_DIR, SaveOrLoad(), SL_OK, SL_SAVE, and str_fmt().
| DEF_CONSOLE_CMD | ( | ConSaveConfig | ) |
Explicitly save the configuration.
Definition at line 306 of file console_cmds.cpp.
References CC_DEFAULT, IConsoleHelp(), IConsolePrint(), and SaveToConfig().
| DEF_CONSOLE_HOOK | ( | ConHookNeedNetwork | ) |
Check whether we are in a multiplayer game.
Definition at line 107 of file console_cmds.cpp.
References _network_server, _networking, IConsoleError(), ClientNetworkGameSocketHandler::IsConnected(), and NetworkAvailable().
| DEF_CONSOLE_HOOK | ( | ConHookServerOnly | ) |
Check whether we are a server.
Definition at line 77 of file console_cmds.cpp.
References _network_server, IConsoleError(), and NetworkAvailable().
| DEF_CONSOLE_HOOK | ( | ConHookClientOnly | ) |
Check whether we are a client in a network game.
Definition at line 92 of file console_cmds.cpp.
References _network_server, IConsoleError(), and NetworkAvailable().
| DEF_CONSOLE_HOOK | ( | ConHookNoNetwork | ) |
Check whether we are in single player mode.
Definition at line 122 of file console_cmds.cpp.
References _networking, and IConsoleError().
| static const FiosItem* GetFiosItem | ( | const char * | file | ) | [static] |
Get savegame file informations.
| file | The savegame filename to return information about. Can be the actual name or a numbered entry into the filename list. |
Definition at line 325 of file console_cmds.cpp.
References IsInsideMM(), lastof, and seprintf().
| static void IConsoleHelp | ( | const char * | str | ) | [static] |
Show help for the console.
| str | String to print in the console. |
Definition at line 155 of file console_cmds.cpp.
References CC_WARNING, and IConsolePrintF().
Referenced by DEF_CONSOLE_CMD().
| static bool NetworkAvailable | ( | bool | echo | ) | [inline, static] |
Check network availability and inform in console about failure of detection.
Definition at line 64 of file console_cmds.cpp.
References _network_available, and IConsoleError().
Referenced by DEF_CONSOLE_HOOK().
| static void PrintLineByLine | ( | char * | buf | ) | [static] |
Print a text buffer line by line to the console.
Lines are seperated by '
'.
| buf | The buffer to print. |
Definition at line 1076 of file console_cmds.cpp.
References CC_DEFAULT, and IConsolePrintF().
| static ContentType StringToContentType | ( | const char * | str | ) | [static] |
Resolve a string to a content type.
Definition at line 1688 of file console_cmds.cpp.
References lengthof.
1.7.1