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