1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:53:50 +00:00

[General] Ignore carriage returns in resources/version file

This commit is contained in:
David Cernat 2019-12-03 13:21:10 +02:00
parent 3aaf64a984
commit 21c8821d05
2 changed files with 6 additions and 1 deletions

View file

@ -222,6 +222,8 @@ int main(int argc, char *argv[])
stringstream sstr;
sstr << TES3MP_VERSION;
sstr << TES3MP_PROTO_VERSION;
// Remove carriage returns added to version file on Windows
version.mCommitHash.erase(std::remove(version.mCommitHash.begin(), version.mCommitHash.end(), '\r'), version.mCommitHash.end());
sstr << version.mCommitHash;
peer->SetIncomingPassword(sstr.str().c_str(), (int) sstr.str().size());

View file

@ -279,7 +279,10 @@ void Networking::connect(const std::string &ip, unsigned short port, std::vector
stringstream sstr;
sstr << TES3MP_VERSION;
sstr << TES3MP_PROTO_VERSION;
sstr << Version::getOpenmwVersion(Main::getResDir()).mCommitHash;
std::string commitHashString = Version::getOpenmwVersion(Main::getResDir()).mCommitHash;
// Remove carriage returns added to version file on Windows
commitHashString.erase(std::remove(commitHashString.begin(), commitHashString.end(), '\r'), commitHashString.end());
sstr << commitHashString;
if (peer->Connect(master.ToString(false), master.GetPort(), sstr.str().c_str(), (int) sstr.str().size(), 0, 0, 3, 500, 0) != RakNet::CONNECTION_ATTEMPT_STARTED)
errmsg = "Connection attempt failed.\n";