diff --git a/apps/openmw-mp/main.cpp b/apps/openmw-mp/main.cpp index 342c77eda..97f7e352f 100644 --- a/apps/openmw-mp/main.cpp +++ b/apps/openmw-mp/main.cpp @@ -29,41 +29,6 @@ using namespace std; using namespace mwmp; -void printVersion(string version, Version::Version ver, int protocol) -{ - cout << "TES3:MP dedicated server " << version; - cout << " ("; -#if defined(_WIN32) - cout << "Windows"; -#elif defined(__linux) - cout << "Linux"; -#elif defined(__APPLE__) - cout << "OS X"; -#else - cout << "Unknown OS"; -#endif - cout << " "; -#ifdef __x86_64__ - cout << "64-bit"; -#elif defined(__i386__) || defined(_M_I86) - cout << "32-bit"; -#elif defined(__ARM_ARCH) - cout << "ARMv" << __ARM_ARCH << " "; - #ifdef __aarch64__ - cout << "64-bit"; - #else - cout << "32-bit"; - #endif -#else - cout << "Unknown architecture"; -#endif - cout << ")" << endl; - cout << "Protocol version: " << protocol << endl; - cout << "Commit hash: " << ver.mCommitHash.substr(0, 10) << endl; - - cout << "------------------------------------------------------------" << endl; -} - #ifdef ENABLE_BREAKPAD google_breakpad::ExceptionHandler *pHandler = 0; #if defined(_WIN32) @@ -230,9 +195,7 @@ int main(int argc, char *argv[]) vector plugins (Utils::split(mgr.getString("plugins", "Plugins"), ',')); - - printVersion(TES3MP_VERSION, version, TES3MP_PROTO_VERSION); - + Utils::printVersion("TES3MP dedicated server", TES3MP_VERSION, version.mCommitHash, TES3MP_PROTO_VERSION); setenv("AMXFILE", moddir.c_str(), 1); setenv("MOD_DIR", moddir.c_str(), 1); // hack for lua diff --git a/components/openmw-mp/Utils.cpp b/components/openmw-mp/Utils.cpp index 14a194268..ea5161b0a 100644 --- a/components/openmw-mp/Utils.cpp +++ b/components/openmw-mp/Utils.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -149,6 +150,41 @@ unsigned int ::Utils::crc32Checksum(const std::string &file) return crc32.checksum(); } +void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol) +{ + cout << appName << " " << version; + cout << " ("; +#if defined(_WIN32) + cout << "Windows"; +#elif defined(__linux) + cout << "Linux"; +#elif defined(__APPLE__) + cout << "OS X"; +#else + cout << "Unknown OS"; +#endif + cout << " "; +#ifdef __x86_64__ + cout << "64-bit"; +#elif defined(__i386__) || defined(_M_I86) + cout << "32-bit"; +#elif defined(__ARM_ARCH) + cout << "ARMv" << __ARM_ARCH << " "; +#ifdef __aarch64__ + cout << "64-bit"; +#else + cout << "32-bit"; +#endif +#else + cout << "Unknown architecture"; +#endif + cout << ")" << endl; + cout << "Protocol version: " << protocol << endl; + cout << "Commit hash: " << commitHash.substr(0, 10) << endl; + + cout << "------------------------------------------------------------" << endl; +} + void Utils::printWithWidth(ostringstream &sstr, string str, size_t width) { sstr << left << setw(width) << setfill(' ') << str; diff --git a/components/openmw-mp/Utils.hpp b/components/openmw-mp/Utils.hpp index 00cbd8cab..448cb13d7 100644 --- a/components/openmw-mp/Utils.hpp +++ b/components/openmw-mp/Utils.hpp @@ -36,6 +36,7 @@ namespace Utils unsigned int crc32Checksum(const std::string &file); + void printVersion(std::string appName, std::string version, std::string commitHash, int protocol); void printWithWidth(std::ostringstream &sstr, std::string str, size_t width); std::string intToHexStr(unsigned val);