This commit is contained in:
aozhiwei 2023-05-30 14:51:35 +08:00
parent ee268025da
commit bb8076222a

View File

@ -21,24 +21,22 @@ void BatchSync::AddGlobalObject(Creature* c)
if (global_object_hash_.find(c->GetUniId()) != global_object_hash_.end()) {
abort();
}
auto timer_wp = f8::Timer::Instance()->SetIntervalWpEx
(
1000,
[] (int event, const a8::Args* args)
{
},
&timer_attacher_);
SyncObject sync_obj;
auto tuple = std::make_shared<std::tuple<f8::TimerWp, SyncObject>>();
SyncObject& sync_obj = std::get<1>(*tuple);
sync_obj.obj_uniid = c->GetUniId();
sync_obj.c = c->GetWeakPtrRef();
sync_obj.pos = c->GetPos().ToGlmVec3();
sync_obj.dir = c->GetAttackDir();
sync_obj.last_sync_frameno = 0;
#if 0
global_object_hash_[c->GetUniId()] =
std::make_tuple(timer_wp, sync_obj);
#endif
global_object_hash_[c->GetUniId()] = tuple;
std::get<0>(*tuple) = f8::Timer::Instance()->SetIntervalWpEx
(
1000,
[tuple] (int event, const a8::Args* args)
{
},
&timer_attacher_);
}
void BatchSync::RemoveGlobalObject(int obj_uniid)