X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=blobdiff_plain;f=Source%2Fmain.cpp;h=cacfabdc99b2a0632e8b759636a39b00d73151d9;hp=3e37f646a81462aa9666054f6c6e2cfadf2b18ea;hb=a8e0e96af3222c42663b3c60158caed20ac46829;hpb=b9a46d8e2b7e7e22c706e7dd3734f31015db4408 diff --git a/Source/main.cpp b/Source/main.cpp index 3e37f64..cacfabd 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2003, 2010 - Wolfire Games -Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file) +Copyright (C) 2010-2017 - Lugaru contributors (see AUTHORS file) This file is part of Lugaru. @@ -22,8 +22,9 @@ along with Lugaru. If not, see . #include "Audio/openal_wrapper.hpp" #include "Graphic/gamegl.hpp" -#include "MacCompatibility.hpp" +#include "Platform/Platform.hpp" #include "User/Settings.hpp" +#include "Version.hpp" #include #include @@ -31,14 +32,14 @@ along with Lugaru. If not, see . #include #include #include -#include using namespace Game; #ifdef WIN32 -#include "win-res/resource.hpp" #include #include +#else +#include #endif extern float multiplier; @@ -578,7 +579,10 @@ static inline void chdirToAppPath(const char* argv0) *ptr = '\0'; } #endif - chdir(dir); + errno = 0; + if (chdir(dir) != 0) { + printf("Error changing dir to '%s' (%s).\n", dir, strerror(errno)); + } free(dir); } } @@ -588,6 +592,7 @@ const option::Descriptor usage[] = { { UNKNOWN, 0, "", "", option::Arg::None, "USAGE: lugaru [options]\n\n" "Options:" }, + { VERSION, 0, "v", "version", option::Arg::None, " -v, --version Print version and exit." }, { HELP, 0, "h", "help", option::Arg::None, " -h, --help Print usage and exit." }, { FULLSCREEN, 1, "f", "fullscreen", option::Arg::None, " -f, --fullscreen Start the game in fullscreen mode." }, { FULLSCREEN, 0, "w", "windowed", option::Arg::None, " -w, --windowed Start the game in windowed mode (default)." }, @@ -620,6 +625,23 @@ int main(int argc, char** argv) return 1; } + // Always start by printing the version and info to the stdout + std::cout << "--------------------------------------------------------------------------\n" + << "Lugaru HD: The Rabbit's Foot, by Wolfire Games and the OSS Lugaru project.\n\n" + << "Licensed under the GPL 2.0+ and CC-BY-SA 3.0 and 4.0 licenses.\n" + << "More information, updates and bug reports at http://osslugaru.gitlab.io\n" + << std::endl; + + std::cout << "Version " + VERSION_STRING + " -- " + VERSION_BUILD_TYPE + " build\n" + << "--------------------------------------------------------------------------\n" + << std::endl; + + if (commandLineOptions[VERSION]) { + // That was enough, quit. + delete[] commandLineOptionsBuffer; + return 0; + } + if (commandLineOptions[HELP]) { option::printUsage(std::cout, usage); delete[] commandLineOptionsBuffer;