X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ffiles.c;h=8e51f5ad801cd1edd8bfe89bb42de8bc8d71dbcd;hb=224535bfe9ef9bfae63168c8ed99c2b70d2f44b1;hp=f838f666f7ceedb9bf5ed7a54023cfcf09f8bbb0;hpb=ddba816bc1541cb40836345fbd547c73da422225;p=rocksndiamonds.git diff --git a/src/files.c b/src/files.c index f838f666..8e51f5ad 100644 --- a/src/files.c +++ b/src/files.c @@ -3160,7 +3160,7 @@ static int LoadLevel_MicroChunk(File *file, struct LevelFileConfigInfo *conf, value = getMappedElement(value); if (data_type == TYPE_BOOLEAN) - *(boolean *)(conf[i].value) = value; + *(boolean *)(conf[i].value) = (value ? TRUE : FALSE); else *(int *) (conf[i].value) = value; @@ -9509,6 +9509,14 @@ static struct TokenInfo global_setup_tokens[] = TYPE_STRING, &setup.player_name, "player_name" }, + { + TYPE_STRING, + &setup.player_uuid, "player_uuid" + }, + { + TYPE_STRING, + &setup.system_uuid, "system_uuid" + }, { TYPE_SWITCH, &setup.multiple_users, "multiple_users" @@ -10321,6 +10329,9 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->player_name = getStringCopy(getDefaultUserName(user.nr)); + si->player_uuid = NULL; // (will be set later) + si->system_uuid = NULL; // (will be set later) + si->multiple_users = TRUE; si->sound = TRUE; @@ -10866,6 +10877,20 @@ static void LoadSetup_SpecialPostProcessing(void) // make sure that scroll delay value stays inside valid range setup.scroll_delay_value = MIN(MAX(MIN_SCROLL_DELAY, setup.scroll_delay_value), MAX_SCROLL_DELAY); + + if (setup.player_uuid == NULL || + setup.system_uuid == NULL) + { + if (setup.player_uuid == NULL) + setup.player_uuid = getStringCopy(GetPlayerUUID()); + + if (setup.system_uuid == NULL) + setup.system_uuid = getStringCopy(GetSystemUUID()); + + SaveSetup(); + } + + SetSystemUUID(setup.system_uuid); } void LoadSetup(void) @@ -10998,7 +11023,8 @@ void SaveSetup(void) for (i = 0; i < ARRAY_SIZE(global_setup_tokens); i++) { // just to make things nicer :) - if (global_setup_tokens[i].value == &setup.multiple_users || + if (global_setup_tokens[i].value == &setup.player_uuid || + global_setup_tokens[i].value == &setup.multiple_users || global_setup_tokens[i].value == &setup.sound || global_setup_tokens[i].value == &setup.graphics_set || global_setup_tokens[i].value == &setup.volume_simple ||