add support for a unique game identifier
A 37 character field for holding a unique identifier is added to the save file, as well as to an ancestor field in bones files. Since it requires installation of libuuid package on Linux, it requires an exlicit WANT_NHUUID=1 on the Make command line there. Without the libuuid support, the saved nhuuid is empty, which should be harmless. This also moves the save and restore of gm.moves higher up so that it already has a value the first time it is used against a relative saved timestamp. Invalidates savefiles and bones files due to new fields. I need to get this committed before I can test out the macOS portion, so there may be some build issues there briefly (hopefully), and follow-up commits to resolve them. Increments EDITLEVEL.
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <rpc.h>
|
||||
#include <VersionHelpers.h>
|
||||
#include <UserEnv.h>
|
||||
|
||||
@@ -530,6 +531,36 @@ nethack_exit(int code)
|
||||
exit(code);
|
||||
}
|
||||
|
||||
void
|
||||
get_nhuuid(void)
|
||||
{
|
||||
UUID binuuid;
|
||||
unsigned char *stmp;
|
||||
RPC_STATUS rpcstatus;
|
||||
|
||||
if (svn.nhuuid[0])
|
||||
return;
|
||||
|
||||
rpcstatus = UuidCreate(&binuuid);
|
||||
if (rpcstatus == RPC_S_OK) {
|
||||
rpcstatus = UuidToStringA(&binuuid, &stmp);
|
||||
if (rpcstatus == RPC_S_OK) {
|
||||
Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", (char *) stmp);
|
||||
RpcStringFree(&stmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
free_nhuuid(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SIZE(svn.nhuuid); i++) {
|
||||
svn.nhuuid[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIN32CON
|
||||
#undef kbhit
|
||||
#include <conio.h>
|
||||
|
||||
Reference in New Issue
Block a user