profile_manager: Make use of designated initializers
More compact code.
This commit is contained in:
parent
05781ce8c4
commit
3fcaf937d2
|
@ -101,13 +101,14 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& usern
|
||||||
[&uuid](const ProfileInfo& profile) { return uuid == profile.user_uuid; })) {
|
[&uuid](const ProfileInfo& profile) { return uuid == profile.user_uuid; })) {
|
||||||
return ERROR_USER_ALREADY_EXISTS;
|
return ERROR_USER_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
ProfileInfo profile;
|
|
||||||
profile.user_uuid = uuid;
|
return AddUser({
|
||||||
profile.username = username;
|
.user_uuid = uuid,
|
||||||
profile.data = {};
|
.username = username,
|
||||||
profile.creation_time = 0x0;
|
.creation_time = 0,
|
||||||
profile.is_open = false;
|
.data = {},
|
||||||
return AddUser(profile);
|
.is_open = false,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new user on the system. This function allows a much simpler method of registration
|
/// Creates a new user on the system. This function allows a much simpler method of registration
|
||||||
|
@ -339,7 +340,13 @@ void ProfileManager::ParseUserSaveFile() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddUser({user.uuid, user.username, user.timestamp, user.extra_data, false});
|
AddUser({
|
||||||
|
.user_uuid = user.uuid,
|
||||||
|
.username = user.username,
|
||||||
|
.creation_time = user.timestamp,
|
||||||
|
.data = user.extra_data,
|
||||||
|
.is_open = false,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stable_partition(profiles.begin(), profiles.end(),
|
std::stable_partition(profiles.begin(), profiles.end(),
|
||||||
|
@ -350,11 +357,13 @@ void ProfileManager::WriteUserSaveFile() {
|
||||||
ProfileDataRaw raw{};
|
ProfileDataRaw raw{};
|
||||||
|
|
||||||
for (std::size_t i = 0; i < MAX_USERS; ++i) {
|
for (std::size_t i = 0; i < MAX_USERS; ++i) {
|
||||||
raw.users[i].username = profiles[i].username;
|
raw.users[i] = {
|
||||||
raw.users[i].uuid2 = profiles[i].user_uuid;
|
.uuid = profiles[i].user_uuid,
|
||||||
raw.users[i].uuid = profiles[i].user_uuid;
|
.uuid2 = profiles[i].user_uuid,
|
||||||
raw.users[i].timestamp = profiles[i].creation_time;
|
.timestamp = profiles[i].creation_time,
|
||||||
raw.users[i].extra_data = profiles[i].data;
|
.username = profiles[i].username,
|
||||||
|
.extra_data = profiles[i].data,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto raw_path =
|
const auto raw_path =
|
||||||
|
|
Reference in New Issue