widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #13683
[Merge] lp:~widelands-dev/widelands/bug-1776008-boost-deleted-uuid-function into lp:widelands
Notabilis has proposed merging lp:~widelands-dev/widelands/bug-1776008-boost-deleted-uuid-function into lp:widelands.
Commit message:
Removing explicit assignment when creating random UUID generator.
Requested reviews:
kaputtnik (franku)
Related bugs:
Bug #1776008 in widelands: "compiling: error: use of deleted function"
https://bugs.launchpad.net/widelands/+bug/1776008
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1776008-boost-deleted-uuid-function/+merge/347773
Removing explicit assignment when creating random generator. This fixes a problem with the current version of the boost library which no longer permits assignments.
I can't confirm the linked bug since I am using an older version of boost, so I need someone to compile this with the new version (1.67). On my system the changed code still compiles and works as expected with the old boost version.
For a quick test, open ~/.widelands/config and look at the line which is similar to:
uuid="8440371b-db4f-41aa-b742-611b3b90841f"
when removing the line "last_start=..." it should generate a new UUID in the file on start of widelands. The new UUID should be something similar long with this branch and with trunk.
The change in wlapplication.cc is a bug I encountered while testing: When removing only the "uuid=..." line it crashes when trying to join the metaserver lobby as an unregistered user. The change fixes that by making sure the configuration value is initialized.
--
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1776008-boost-deleted-uuid-function.
=== modified file 'src/random/random.cc'
--- src/random/random.cc 2018-04-07 16:59:00 +0000
+++ src/random/random.cc 2018-06-11 18:36:01 +0000
@@ -105,6 +105,6 @@
}
std::string generate_random_uuid() {
- static boost::uuids::random_generator gen = boost::uuids::random_generator();
+ static boost::uuids::random_generator gen;
return boost::uuids::to_string(gen());
}
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2018-06-01 15:42:03 +0000
+++ src/wlapplication.cc 2018-06-11 18:36:01 +0000
@@ -782,7 +782,7 @@
// KLUDGE!
long int last_start = s.get_int("last_start", 0);
- if (last_start + 12 * 60 * 60 < time(nullptr)) {
+ if (last_start + 12 * 60 * 60 < time(nullptr) || !s.get_string("uuid")) {
// First start of the game or not started for 12 hours. Create a (new) UUID.
// For the use of the UUID, see network/internet_gaming_protocol.h
s.set_string("uuid", generate_random_uuid());
Follow ups