From bb8076222ac1dbd3ba309a600103ca7d4807f00b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 30 May 2023 14:51:35 +0800 Subject: [PATCH] 1 --- server/gameserver/batchsync.cc | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/server/gameserver/batchsync.cc b/server/gameserver/batchsync.cc index a2b99b45..9a1f0285 100644 --- a/server/gameserver/batchsync.cc +++ b/server/gameserver/batchsync.cc @@ -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>(); + 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)