42 lines
903 B
C++
42 lines
903 B
C++
#pragma once
|
|
|
|
#include <f8/timer.h>
|
|
|
|
namespace cs
|
|
{
|
|
class SMSyncPosition;
|
|
};
|
|
|
|
struct SyncObject
|
|
{
|
|
int obj_uniid = 0;
|
|
CreatureWeakPtr c;
|
|
glm::vec3 pos = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
glm::vec3 dir = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
long long last_sync_frameno = 0;
|
|
|
|
void FillSMSyncPosition(cs::SMSyncPosition& sync_msg);
|
|
};
|
|
|
|
class Creature;
|
|
class Team;
|
|
class BatchSync
|
|
{
|
|
public:
|
|
|
|
BatchSync(Room* room);
|
|
virtual ~BatchSync();
|
|
|
|
void AddGlobalObject(Creature* c);
|
|
void RemoveGlobalObject(int obj_uniid);
|
|
void AddTeam(Team* team);
|
|
void UpdateTeam(Team* team);
|
|
void RemoveTeam(Team* team);
|
|
|
|
private:
|
|
Room* room_ = nullptr;
|
|
f8::Attacher timer_attacher_;
|
|
std::map<int, std::shared_ptr<std::tuple<f8::TimerWp, SyncObject>>> global_object_hash_;
|
|
std::map<Team*, std::shared_ptr<std::tuple<f8::TimerWp, std::vector<SyncObject>>>> team_hash_;
|
|
};
|