Fix bug causing logins to be lost when The Game is closed.
This commit is contained in:
parent
203db57e57
commit
b20e1c5e13
@ -127,6 +127,7 @@ void save_presets(int do_update)
|
||||
cJSON_AddStringToObject(root, "Powder Toy Preferences", "Don't modify this file unless you know what you're doing. P.S: editing the admin/mod fields in your user info doesn't give you magical powers");
|
||||
|
||||
//User Info
|
||||
if(svf_login){
|
||||
cJSON_AddItemToObject(root, "user", userobj=cJSON_CreateObject());
|
||||
cJSON_AddStringToObject(userobj, "name", svf_user);
|
||||
cJSON_AddStringToObject(userobj, "id", svf_user_id);
|
||||
@ -141,6 +142,7 @@ void save_presets(int do_update)
|
||||
cJSON_AddFalseToObject(userobj, "admin");
|
||||
cJSON_AddFalseToObject(userobj, "mod");
|
||||
}
|
||||
}
|
||||
|
||||
//Version Info
|
||||
cJSON_AddItemToObject(root, "version", versionobj=cJSON_CreateObject());
|
||||
@ -219,6 +221,7 @@ void load_presets(void)
|
||||
//Read user data
|
||||
userobj = cJSON_GetObjectItem(root, "user");
|
||||
if(userobj){
|
||||
svf_login = 1;
|
||||
if((tmpobj = cJSON_GetObjectItem(userobj, "name")) && tmpobj->type == cJSON_String) strncpy(svf_user, tmpobj->valuestring, 63); else svf_user[0] = 0;
|
||||
if((tmpobj = cJSON_GetObjectItem(userobj, "id")) && tmpobj->type == cJSON_String) strncpy(svf_user_id, tmpobj->valuestring, 63); else svf_user_id[0] = 0;
|
||||
if((tmpobj = cJSON_GetObjectItem(userobj, "session_id")) && tmpobj->type == cJSON_String) strncpy(svf_session_id, tmpobj->valuestring, 63); else svf_session_id[0] = 0;
|
||||
@ -233,6 +236,7 @@ void load_presets(void)
|
||||
svf_mod = 0;
|
||||
}
|
||||
} else {
|
||||
svf_login = 0;
|
||||
svf_user[0] = 0;
|
||||
svf_user_id[0] = 0;
|
||||
svf_session_id[0] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user