mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-12 18:38:10 +00:00
move to std optional
This commit is contained in:
@@ -53,13 +53,8 @@ void CDZoneTableTable::LoadValuesFromDatabase() {
|
||||
}
|
||||
|
||||
//! Queries the table with a zoneID to find.
|
||||
const CDZoneTable* CDZoneTableTable::Query(unsigned int zoneID) {
|
||||
const std::optional<CDZoneTable> CDZoneTableTable::Query(unsigned int zoneID) {
|
||||
const auto& iter = m_Entries.find(zoneID);
|
||||
|
||||
if (iter != m_Entries.end()) {
|
||||
return &iter->second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return iter != m_Entries.end() ? std::make_optional(iter->second) : std::nullopt;
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
struct CDZoneTable {
|
||||
unsigned int zoneID; //!< The Zone ID of the object
|
||||
unsigned int locStatus; //!< The Locale Status(?)
|
||||
@@ -41,5 +42,5 @@ public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
// Queries the table with a zoneID to find.
|
||||
const CDZoneTable* Query(unsigned int zoneID);
|
||||
const std::optional<CDZoneTable> Query(unsigned int zoneID);
|
||||
};
|
||||
|
Reference in New Issue
Block a user