moved name checks to name save and name change packets

added a TODO

Formatting + sizeof in login server
This commit is contained in:
Gent S
2020-11-25 18:39:41 -05:00
parent d85d9d4b12
commit ea5b7104be
3 changed files with 78 additions and 59 deletions

View File

@@ -198,15 +198,13 @@ bool Database::validateCharacter(int characterID, int userID) {
.size() > 0;
}
bool Database::isNameFree(sP_CL2LS_REQ_CHECK_CHAR_NAME* nameCheck) {
bool Database::isNameFree(std::string firstName, std::string lastName) {
std::lock_guard<std::mutex> lock(dbCrit);
std::string First = U16toU8(nameCheck->szFirstName);
std::string Last = U16toU8(nameCheck->szLastName);
return
(db.get_all<DbPlayer>
(where((c(&DbPlayer::FirstName) == First)
and (c(&DbPlayer::LastName) == Last)))
(where((c(&DbPlayer::FirstName) == firstName)
and (c(&DbPlayer::LastName) == lastName)))
.empty());
}