mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
Add garbage collection for non-existent players
This commit is contained in:
parent
34f2aef248
commit
4454faffc3
@ -501,8 +501,16 @@ Player Database::DbToPlayer(DbPlayer player) {
|
||||
|
||||
Database::DbPlayer Database::getDbPlayerById(int id) {
|
||||
auto player = db.get_all<DbPlayer>(where(c(&DbPlayer::PlayerID) == id));
|
||||
if (player.size() < 1)
|
||||
if (player.size() < 1) {
|
||||
// garbage collection
|
||||
db.remove_all<Inventory>(where(c(&Inventory::playerId) == id));
|
||||
db.remove_all<Nano>(where(c(&Nano::playerId) == id));
|
||||
db.remove_all<DbQuest>(where(c(&DbQuest::PlayerId) == id));
|
||||
db.remove_all<Buddyship>(where(c(&Buddyship::PlayerAId) == id || c(&Buddyship::PlayerBId) == id));
|
||||
db.remove_all<EmailData>(where(c(&EmailData::PlayerId) == id));
|
||||
db.remove_all<EmailItem>(where(c(&EmailItem::PlayerId) == id));
|
||||
return DbPlayer{ -1 };
|
||||
}
|
||||
return player.front();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user