From 76cfc47a2f6da84c957ffb1174b3d9ee3bf8c9ea Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Mon, 7 Oct 2024 00:43:25 +0200 Subject: [PATCH] log invocation --- README.md | 4 ++-- src/Options.cpp | 12 +++++++++++- src/Startup.cpp | 1 - src/main.cpp | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9dd3dc4..4ade1be 100755 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ The launcher is the way we communitcate to outside the game, it does a few autom In the root directory of the project, 1. `cmake -DCMAKE_BUILD_TYPE=Release . -B bin -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static` 2. `cmake --build bin --parallel --config Release` - -Remember to change `C:/vcpkg` to wherever you have vcpkg installed. + +Remember to change `C:/vcpkg` to wherever you have vcpkg installed. ## How to build - Debug diff --git a/src/Options.cpp b/src/Options.cpp index 1c0cadf..1389570 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -10,6 +10,16 @@ void InitOptions(int argc, const char *argv[], Options &options) { options.argc = argc; options.argv = argv; + std::string AllOptions; + for (int i = 0; i < argc; ++i) { + AllOptions += std::string(argv[i]); + if (i + 1 < argc) { + AllOptions += " "; + } + } + debug("Launcher was invoked as: '" + AllOptions + "'"); + + if (argc > 2) { if (std::string(argv[1]) == "0" && std::string(argv[2]) == "0") { options.verbose = true; @@ -26,7 +36,7 @@ void InitOptions(int argc, const char *argv[], Options &options) { while (i < argc) { std::string argument(argv[i]); if (argument == "-p" || argument == "--port") { - if (argc > i) { + if (i + 1 >= argc) { std::string error_message = "No port specified, resorting to default ("; error_message += std::to_string(options.port); diff --git a/src/Startup.cpp b/src/Startup.cpp index 922b471..1224eb2 100644 --- a/src/Startup.cpp +++ b/src/Startup.cpp @@ -242,7 +242,6 @@ void InitLauncher() { #elif defined(__linux__) void InitLauncher() { - InitLog(); info("BeamMP Launcher v" + GetVer() + GetPatch()); CheckName(); CheckLocalKey(); diff --git a/src/main.cpp b/src/main.cpp index 7f77fba..cc4ef67 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,6 +54,7 @@ int main(int argc, const char** argv) try { } } + InitLog(); InitOptions(argc, argv, options); InitLauncher();