mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-11 09:58:05 +00:00
use reference instead of pointer for cdclient data
This commit is contained in:
@@ -28,7 +28,8 @@ void CDPetComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
}
|
||||
|
||||
CDPetComponent* CDPetComponentTable::GetByID(unsigned int componentID) {
|
||||
CDPetComponent& CDPetComponentTable::GetByID(unsigned int componentID) {
|
||||
auto itr = m_entries.find(componentID);
|
||||
return itr != m_entries.end() ? &itr->second : nullptr;
|
||||
if (itr == m_entries.end()) throw std::exception(); // TODO: Use a default set of values instead?
|
||||
return itr->second;
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
static const std::string GetTableName() { return "PetComponent"; };
|
||||
CDPetComponent* GetByID(unsigned int componentID);
|
||||
CDPetComponent& GetByID(unsigned int componentID);
|
||||
|
||||
private:
|
||||
std::map<unsigned int, CDPetComponent> m_entries;
|
||||
|
Reference in New Issue
Block a user