mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-25 15:03:34 +00:00
28 lines
677 B
C++
28 lines
677 B
C++
#include "ObjectIDManager.h"
|
|
|
|
// Custom Classes
|
|
#include "Database.h"
|
|
#include "dLogger.h"
|
|
|
|
// Static Variables
|
|
ObjectIDManager* ObjectIDManager::m_Address = nullptr;
|
|
|
|
//! Initializes the manager
|
|
void ObjectIDManager::Initialize(dLogger* logger) {
|
|
this->mLogger = logger;
|
|
this->currentPersistentID = Database::Connection->GetObjectIDTracker();
|
|
}
|
|
|
|
//! Generates a new persistent ID
|
|
uint32_t ObjectIDManager::GeneratePersistentID(void) {
|
|
uint32_t toReturn = ++this->currentPersistentID;
|
|
|
|
Database::Connection->SetObjectIDTracker(toReturn);
|
|
|
|
return toReturn;
|
|
}
|
|
|
|
void ObjectIDManager::SaveToDatabase() {
|
|
Database::Connection->SetObjectIDTracker(this->currentPersistentID);
|
|
}
|