Rename world expedition cache to state

This commit is contained in:
hg 2020-10-17 22:28:49 -04:00
parent 579c300cbc
commit 022f82291a
5 changed files with 25 additions and 25 deletions

View File

@ -10,9 +10,9 @@ SET(world_sources
eql_config.cpp
eqemu_api_world_data_service.cpp
expedition.cpp
expedition_cache.cpp
expedition_database.cpp
expedition_message.cpp
expedition_state.cpp
launcher_link.cpp
launcher_list.cpp
lfplist.cpp
@ -44,9 +44,9 @@ SET(world_headers
eql_config.h
eqemu_api_world_data_service.h
expedition.h
expedition_cache.h
expedition_database.h
expedition_message.h
expedition_state.h
launcher_link.h
launcher_list.h
lfplist.h

View File

@ -19,7 +19,7 @@
*/
#include "expedition_message.h"
#include "expedition_cache.h"
#include "expedition_state.h"
#include "cliententry.h"
#include "clientlist.h"
#include "zonelist.h"
@ -37,29 +37,29 @@ void ExpeditionMessage::HandleZoneMessage(ServerPacket* pack)
case ServerOP_ExpeditionCreate:
{
auto buf = reinterpret_cast<ServerExpeditionID_Struct*>(pack->pBuffer);
expedition_cache.AddExpedition(buf->expedition_id);
expedition_state.AddExpedition(buf->expedition_id);
zoneserver_list.SendPacket(pack);
break;
}
case ServerOP_ExpeditionMemberChange:
{
auto buf = reinterpret_cast<ServerExpeditionMemberChange_Struct*>(pack->pBuffer);
expedition_cache.MemberChange(buf->expedition_id, buf->char_id, buf->removed);
expedition_state.MemberChange(buf->expedition_id, buf->char_id, buf->removed);
zoneserver_list.SendPacket(pack);
break;
}
case ServerOP_ExpeditionMemberSwap:
{
auto buf = reinterpret_cast<ServerExpeditionMemberSwap_Struct*>(pack->pBuffer);
expedition_cache.MemberChange(buf->expedition_id, buf->remove_char_id, true);
expedition_cache.MemberChange(buf->expedition_id, buf->add_char_id, false);
expedition_state.MemberChange(buf->expedition_id, buf->remove_char_id, true);
expedition_state.MemberChange(buf->expedition_id, buf->add_char_id, false);
zoneserver_list.SendPacket(pack);
break;
}
case ServerOP_ExpeditionMembersRemoved:
{
auto buf = reinterpret_cast<ServerExpeditionID_Struct*>(pack->pBuffer);
expedition_cache.RemoveAllMembers(buf->expedition_id);
expedition_state.RemoveAllMembers(buf->expedition_id);
zoneserver_list.SendPacket(pack);
break;
}
@ -101,7 +101,7 @@ void ExpeditionMessage::HandleZoneMessage(ServerPacket* pack)
case ServerOP_ExpeditionSecondsRemaining:
{
auto buf = reinterpret_cast<ServerExpeditionUpdateDuration_Struct*>(pack->pBuffer);
expedition_cache.SetSecondsRemaining(buf->expedition_id, buf->new_duration_seconds);
expedition_state.SetSecondsRemaining(buf->expedition_id, buf->new_duration_seconds);
break;
}
}

View File

@ -18,7 +18,7 @@
*
*/
#include "expedition_cache.h"
#include "expedition_state.h"
#include "expedition.h"
#include "expedition_database.h"
#include "zonelist.h"
@ -28,9 +28,9 @@
extern ZSList zoneserver_list;
ExpeditionCache expedition_cache;
ExpeditionState expedition_state;
void ExpeditionCache::LoadActiveExpeditions()
void ExpeditionState::LoadActiveExpeditions()
{
BenchTimer benchmark;
@ -40,7 +40,7 @@ void ExpeditionCache::LoadActiveExpeditions()
LogExpeditions("World caching [{}] expeditions took [{}s]", m_expeditions.size(), elapsed);
}
void ExpeditionCache::AddExpedition(uint32_t expedition_id)
void ExpeditionState::AddExpedition(uint32_t expedition_id)
{
if (expedition_id == 0)
{
@ -62,7 +62,7 @@ void ExpeditionCache::AddExpedition(uint32_t expedition_id)
}
}
void ExpeditionCache::RemoveExpedition(uint32_t expedition_id)
void ExpeditionState::RemoveExpedition(uint32_t expedition_id)
{
m_expeditions.erase(std::remove_if(m_expeditions.begin(), m_expeditions.end(),
[&](const Expedition& expedition) {
@ -71,7 +71,7 @@ void ExpeditionCache::RemoveExpedition(uint32_t expedition_id)
), m_expeditions.end());
}
void ExpeditionCache::MemberChange(uint32_t expedition_id, uint32_t character_id, bool remove)
void ExpeditionState::MemberChange(uint32_t expedition_id, uint32_t character_id, bool remove)
{
auto it = std::find_if(m_expeditions.begin(), m_expeditions.end(), [&](const Expedition& expedition) {
return expedition.GetID() == expedition_id;
@ -87,7 +87,7 @@ void ExpeditionCache::MemberChange(uint32_t expedition_id, uint32_t character_id
}
}
void ExpeditionCache::RemoveAllMembers(uint32_t expedition_id)
void ExpeditionState::RemoveAllMembers(uint32_t expedition_id)
{
auto it = std::find_if(m_expeditions.begin(), m_expeditions.end(), [&](const Expedition& expedition) {
return expedition.GetID() == expedition_id;
@ -99,7 +99,7 @@ void ExpeditionCache::RemoveAllMembers(uint32_t expedition_id)
}
}
void ExpeditionCache::SetSecondsRemaining(uint32_t expedition_id, uint32_t seconds_remaining)
void ExpeditionState::SetSecondsRemaining(uint32_t expedition_id, uint32_t seconds_remaining)
{
auto it = std::find_if(m_expeditions.begin(), m_expeditions.end(), [&](const Expedition& expedition) {
return expedition.GetID() == expedition_id;
@ -111,7 +111,7 @@ void ExpeditionCache::SetSecondsRemaining(uint32_t expedition_id, uint32_t secon
}
}
void ExpeditionCache::Process()
void ExpeditionState::Process()
{
if (!m_process_throttle_timer.Check())
{

View File

@ -18,19 +18,19 @@
*
*/
#ifndef WORLD_EXPEDITION_CACHE_H
#define WORLD_EXPEDITION_CACHE_H
#ifndef WORLD_EXPEDITION_STATE_H
#define WORLD_EXPEDITION_STATE_H
#include "../common/rulesys.h"
#include "../common/timer.h"
#include <cstdint>
#include <vector>
extern class ExpeditionCache expedition_cache;
extern class ExpeditionState expedition_state;
class Expedition;
class ExpeditionCache
class ExpeditionState
{
public:
void AddExpedition(uint32_t expedition_id);

View File

@ -88,8 +88,8 @@ union semun {
#include "queryserv.h"
#include "web_interface.h"
#include "console.h"
#include "expedition_cache.h"
#include "expedition_database.h"
#include "expedition_state.h"
#include "../common/net/servertalk_server.h"
#include "../zone/data_bucket.h"
@ -436,7 +436,7 @@ int main(int argc, char** argv) {
ExpeditionDatabase::PurgeExpiredCharacterLockouts();
LogInfo("Loading active expeditions");
expedition_cache.LoadActiveExpeditions();
expedition_state.LoadActiveExpeditions();
LogInfo("Loading char create info");
content_db.LoadCharacterCreateAllocations();
@ -624,7 +624,7 @@ int main(int argc, char** argv) {
launcher_list.Process();
LFPGroupList.Process();
adventure_manager.Process();
expedition_cache.Process();
expedition_state.Process();
if (InterserverTimer.Check()) {
InterserverTimer.Start();