1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-04 19:19:40 +00:00

[General] Turn Utils::printVersion() into Utils::getVersionInfo()

This commit is contained in:
David Cernat 2021-02-10 02:54:37 +02:00
parent e1259fdc41
commit a379d12529
4 changed files with 12 additions and 9 deletions

View file

@ -200,7 +200,8 @@ int main(int argc, char *argv[])
vector<string> plugins(Utils::split(mgr.getString("plugins", "Plugins"), ',')); vector<string> plugins(Utils::split(mgr.getString("plugins", "Plugins"), ','));
Utils::printVersion("TES3MP dedicated server", TES3MP_VERSION, version.mCommitHash, TES3MP_PROTO_VERSION); std::string versionInfo = Utils::getVersionInfo("TES3MP dedicated server", TES3MP_VERSION, version.mCommitHash, TES3MP_PROTO_VERSION);
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "%s", versionInfo.c_str());
Script::SetModDir(dataDirectory); Script::SetModDir(dataDirectory);

View file

@ -195,7 +195,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
Print the multiplayer version first Print the multiplayer version first
*/ */
Utils::printVersion("TES3MP client", TES3MP_VERSION, v.mCommitHash, TES3MP_PROTO_VERSION); Log(Debug::Info) << Utils::getVersionInfo("TES3MP client", TES3MP_VERSION, v.mCommitHash, TES3MP_PROTO_VERSION);
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

View file

@ -207,14 +207,16 @@ std::string Utils::getArchitectureType()
#endif #endif
} }
void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol) std::string Utils::getVersionInfo(std::string appName, std::string version, std::string commitHash, int protocol)
{ {
cout << appName << " " << version; std::stringstream stream;
cout << " (" << getOperatingSystemType() << " " << getArchitectureType() << ")" << endl;
cout << "Protocol version: " << protocol << endl;
cout << "Oldest compatible commit hash: " << commitHash.substr(0, 10) << endl;
cout << "------------------------------------------------------------" << endl; stream << appName << " " << version << " (" << getOperatingSystemType() << " " << getArchitectureType() << ")" << endl;
stream << "Protocol version: " << protocol << endl;
stream << "Oldest compatible commit hash: " << commitHash.substr(0, 10) << endl;
stream << "------------------------------------------------------------" << endl;
return stream.str();
} }
void Utils::printWithWidth(ostringstream &sstr, string str, size_t width) void Utils::printWithWidth(ostringstream &sstr, string str, size_t width)

View file

@ -59,7 +59,7 @@ namespace Utils
std::string getOperatingSystemType(); std::string getOperatingSystemType();
std::string getArchitectureType(); std::string getArchitectureType();
void printVersion(std::string appName, std::string version, std::string commitHash, int protocol); std::string getVersionInfo(std::string appName, std::string version, std::string commitHash, int protocol);
void printWithWidth(std::ostringstream &sstr, std::string str, size_t width); void printWithWidth(std::ostringstream &sstr, std::string str, size_t width);