MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ConScript

Function ConScript

src/console_cmds.cpp:1264–1286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1262extern void ShowFramerateWindow();
1263
1264static bool ConScript(std::span<std::string_view> argv)
1265{
1266 extern std::optional<FileHandle> _iconsole_output_file;
1267
1268 if (argv.empty()) {
1269 IConsolePrint(CC_HELP, "Start or stop logging console output to a file. Usage: 'script <filename>'.");
1270 IConsolePrint(CC_HELP, "If filename is omitted, a running log is stopped if it is active.");
1271 return true;
1272 }
1273
1274 if (!CloseConsoleLogIfActive()) {
1275 if (argv.size() < 2) return false;
1276
1277 _iconsole_output_file = FileHandle::Open(argv[1], "ab");
1278 if (!_iconsole_output_file.has_value()) {
1279 IConsolePrint(CC_ERROR, "Could not open console log file '{}'.", argv[1]);
1280 } else {
1281 IConsolePrint(CC_INFO, "Console log output started to '{}'.", argv[1]);
1282 }
1283 }
1284
1285 return true;
1286}
1287
1288static bool ConEcho(std::span<std::string_view> argv)
1289{

Callers

nothing calls this directly

Calls 4

CloseConsoleLogIfActiveFunction · 0.85
IConsolePrintFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected