chore: cleanup zoneIM (#1985)

This commit is contained in:
David Markowitz
2026-06-08 20:57:33 -07:00
committed by GitHub
parent ca0da9d3bf
commit 045e097b13
2 changed files with 18 additions and 42 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <functional>
#include <map>
#include <vector>
#include <string>
@@ -14,25 +15,20 @@ class dServer;
\brief A class for handling zone transfers and zone-related functions
*/
//! The zone request
struct ZoneTransferRequest {
uint64_t requestID;
std::function<void(bool, uint32_t, uint32_t, uint32_t, std::string, uint16_t)> callback;
};
//! The zone manager
class ZoneInstanceManager {
private:
static ZoneInstanceManager* m_Address; //!< The singleton instance
std::vector<ZoneTransferRequest*> requests; //!< The zone transfer requests
using TransferCallback = std::function<void(bool, uint32_t, uint32_t, uint32_t, std::string, uint16_t)>;
std::map<uint64_t, TransferCallback> requests; //!< The zone transfer requests
uint64_t currentRequestID; //!< The current request ID
public:
//! The singleton method
static ZoneInstanceManager* Instance() {
if (m_Address == 0) {
if (m_Address == nullptr) {
m_Address = new ZoneInstanceManager;
m_Address->currentRequestID = 0;
}
@@ -47,7 +43,7 @@ public:
\param mythranShift Whether or not this is a mythran shift
\param callback The callback function
*/
void RequestZoneTransfer(dServer* server, uint32_t zoneID, uint32_t zoneClone, bool mythranShift, std::function<void(bool, uint32_t, uint32_t, uint32_t, std::string, uint16_t)> callback);
void RequestZoneTransfer(dServer* server, uint32_t zoneID, uint32_t zoneClone, bool mythranShift, TransferCallback callback);
//! Handles a zone transfer response
/*!
@@ -58,6 +54,5 @@ public:
void CreatePrivateZone(dServer* server, uint32_t zoneID, uint32_t zoneClone, const std::string& password);
void RequestPrivateZone(dServer* server, bool mythranShift, const std::string& password, std::function<void(bool, uint32_t, uint32_t, uint32_t, std::string, uint16_t)> callback);
void RequestPrivateZone(dServer* server, bool mythranShift, const std::string& password, TransferCallback callback);
};