@@ -88,7 +88,7 @@ static sqlite3_stmt *PrepareQuery(TDatabase *Database, const char *Text){
8888 if (Entry->Stmt != NULL && Entry->Hash == Hash){
8989 const char *EntryText = sqlite3_sql (Entry->Stmt );
9090 ASSERT (EntryText != NULL );
91- if (strcmp (EntryText, Text) == 0 ){
91+ if (strcmp (EntryText, Text) == 0 ){
9292 Stmt = Entry->Stmt ;
9393 Entry->LastUsed = g_MonotonicTimeMS;
9494 break ;
@@ -379,6 +379,7 @@ int DatabaseChanges(TDatabase *Database){
379379bool DatabaseCheckpoint (TDatabase *Database){
380380 // IMPORTANT(fusion): Since SQLite is a local database, we don't need to check
381381 // whether the connection is still valid or needs reconnecting.
382+ ASSERT (Database != NULL );
382383 return true ;
383384}
384385
@@ -610,8 +611,7 @@ bool AccountEmailExists(TDatabase *Database, const char *Email, bool *Result){
610611 return true ;
611612}
612613
613- bool CreateAccount (TDatabase *Database, int AccountID,
614- const char *Email, const uint8 *Auth, int AuthSize){
614+ bool CreateAccount (TDatabase *Database, int AccountID, const char *Email, const uint8 *Auth, int AuthSize){
615615 ASSERT (Database != NULL && Email != NULL
616616 && Auth != NULL && AuthSize > 0 );
617617 sqlite3_stmt *Stmt = PrepareQuery (Database,
@@ -756,8 +756,7 @@ bool ActivatePendingPremiumDays(TDatabase *Database, int AccountID){
756756 return true ;
757757}
758758
759- bool GetCharacterEndpoints (TDatabase *Database, int AccountID,
760- DynamicArray<TCharacterEndpoint> *Characters){
759+ bool GetCharacterEndpoints (TDatabase *Database, int AccountID, DynamicArray<TCharacterEndpoint> *Characters){
761760 ASSERT (Database != NULL && Characters != NULL );
762761 sqlite3_stmt *Stmt = PrepareQuery (Database,
763762 " SELECT C.Name, W.Name, W.Host, W.Port"
@@ -802,8 +801,7 @@ bool GetCharacterEndpoints(TDatabase *Database, int AccountID,
802801 return true ;
803802}
804803
805- bool GetCharacterSummaries (TDatabase *Database, int AccountID,
806- DynamicArray<TCharacterSummary> *Characters){
804+ bool GetCharacterSummaries (TDatabase *Database, int AccountID, DynamicArray<TCharacterSummary> *Characters){
807805 ASSERT (Database != NULL && Characters != NULL );
808806 sqlite3_stmt *Stmt = PrepareQuery (Database,
809807 " SELECT C.Name, W.Name, C.Level, C.Profession, C.IsOnline, C.Deleted"
@@ -865,8 +863,7 @@ bool CharacterNameExists(TDatabase *Database, const char *Name, bool *Result){
865863 return false ;
866864}
867865
868- bool CreateCharacter (TDatabase *Database, int WorldID,
869- int AccountID, const char *Name, int Sex){
866+ bool CreateCharacter (TDatabase *Database, int WorldID, int AccountID, const char *Name, int Sex){
870867 ASSERT (Database != NULL && Name != NULL );
871868 sqlite3_stmt *Stmt = PrepareQuery (Database,
872869 " INSERT INTO Characters (WorldID, AccountID, Name, Sex)"
@@ -895,8 +892,7 @@ bool CreateCharacter(TDatabase *Database, int WorldID,
895892 return (ErrCode == SQLITE_DONE);
896893}
897894
898- bool GetCharacterID (TDatabase *Database, int WorldID,
899- const char *CharacterName, int *CharacterID){
895+ bool GetCharacterID (TDatabase *Database, int WorldID, const char *CharacterName, int *CharacterID){
900896 ASSERT (Database != NULL && CharacterName != NULL && CharacterID != NULL );
901897 sqlite3_stmt *Stmt = PrepareQuery (Database,
902898 " SELECT CharacterID FROM Characters"
@@ -923,8 +919,7 @@ bool GetCharacterID(TDatabase *Database, int WorldID,
923919 return true ;
924920}
925921
926- bool GetCharacterLoginData (TDatabase *Database,
927- const char *CharacterName, TCharacterLoginData *Character){
922+ bool GetCharacterLoginData (TDatabase *Database, const char *CharacterName, TCharacterLoginData *Character){
928923 ASSERT (Database != NULL && CharacterName != NULL && Character != NULL );
929924 sqlite3_stmt *Stmt = PrepareQuery (Database,
930925 " SELECT WorldID, CharacterID, AccountID, Name,"
@@ -963,8 +958,7 @@ bool GetCharacterLoginData(TDatabase *Database,
963958 return true ;
964959}
965960
966- bool GetCharacterProfile (TDatabase *Database,
967- const char *CharacterName, TCharacterProfile *Character){
961+ bool GetCharacterProfile (TDatabase *Database, const char *CharacterName, TCharacterProfile *Character){
968962 ASSERT (Database != NULL && CharacterName != NULL && Character != NULL );
969963 sqlite3_stmt *Stmt = PrepareQuery (Database,
970964 " SELECT C.Name, W.Name, C.Sex, C.Guild, C.Rank, C.Title, C.Level,"
@@ -1014,8 +1008,7 @@ bool GetCharacterProfile(TDatabase *Database,
10141008 return true ;
10151009}
10161010
1017- bool GetCharacterRight (TDatabase *Database,
1018- int CharacterID, const char *Right, bool *Result){
1011+ bool GetCharacterRight (TDatabase *Database, int CharacterID, const char *Right, bool *Result){
10191012 ASSERT (Database != NULL && Right != NULL && Result != NULL );
10201013 sqlite3_stmt *Stmt = PrepareQuery (Database,
10211014 " SELECT 1 FROM CharacterRights"
@@ -1071,8 +1064,7 @@ bool GetCharacterRights(TDatabase *Database, int CharacterID, DynamicArray<TChar
10711064 return true ;
10721065}
10731066
1074- bool GetGuildLeaderStatus (TDatabase *Database,
1075- int WorldID, int CharacterID, bool *Result){
1067+ bool GetGuildLeaderStatus (TDatabase *Database, int WorldID, int CharacterID, bool *Result){
10761068 ASSERT (Database != NULL && Result != NULL );
10771069 // NOTE(fusion): Same as `DecrementIsOnline`.
10781070 sqlite3_stmt *Stmt = PrepareQuery (Database,
@@ -1188,8 +1180,7 @@ bool ClearIsOnline(TDatabase *Database, int WorldID, int *NumAffectedCharacters)
11881180}
11891181
11901182bool LogoutCharacter (TDatabase *Database, int WorldID, int CharacterID, int Level,
1191- const char *Profession, const char *Residence, int LastLoginTime,
1192- int TutorActivities){
1183+ const char *Profession, const char *Residence, int LastLoginTime, int TutorActivities){
11931184 ASSERT (Database != NULL && Profession != NULL && Residence != NULL );
11941185 sqlite3_stmt *Stmt = PrepareQuery (Database,
11951186 " UPDATE Characters"
0 commit comments