mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-20 05:28:22 +00:00
[Expeditions] Refactor expedition caching (#1315)
Add common expedition base class Use repository for zone and world expedition caching World now stores members and leader as Member objects instead of ids This improves readability of the caching methods and lets world cache expedition dzs and members like zone. World also now caches expeditions as unique_ptr which will be necessary for future dz callback lambdas that capture 'this' so addresses don't change on cache vector resizes.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#ifndef WORLD_EXPEDITION_STATE_H
|
||||
#define WORLD_EXPEDITION_STATE_H
|
||||
|
||||
#include "../common/repositories/expeditions_repository.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/timer.h"
|
||||
#include <cstdint>
|
||||
@@ -29,21 +30,22 @@
|
||||
extern class ExpeditionState expedition_state;
|
||||
|
||||
class Expedition;
|
||||
struct ExpeditionMember;
|
||||
|
||||
class ExpeditionState
|
||||
{
|
||||
public:
|
||||
void AddExpedition(uint32_t expedition_id);
|
||||
void CacheExpeditions(std::vector<ExpeditionsRepository::ExpeditionWithLeader>&& expedition_entries);
|
||||
void CacheFromDatabase(uint32_t expedition_id);
|
||||
void CacheAllFromDatabase();
|
||||
Expedition* GetExpedition(uint32_t expedition_id);
|
||||
Expedition* GetExpeditionByDynamicZoneID(uint32_t dz_id);
|
||||
void LoadActiveExpeditions();
|
||||
void MemberChange(uint32_t expedition_id, uint32_t character_id, bool remove);
|
||||
void MemberChange(uint32_t expedition_id, const ExpeditionMember& member, bool remove);
|
||||
void Process();
|
||||
void RemoveAllMembers(uint32_t expedition_id);
|
||||
void RemoveExpedition(uint32_t expedition_id);
|
||||
|
||||
private:
|
||||
std::vector<Expedition> m_expeditions;
|
||||
std::vector<std::unique_ptr<Expedition>> m_expeditions;
|
||||
Timer m_process_throttle_timer{static_cast<uint32_t>(RuleI(DynamicZone, WorldProcessRate))};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user