This commit is contained in:
aozhiwei 2023-06-01 11:15:59 +08:00
parent f5654191cd
commit 5fcb89b87b
2 changed files with 25 additions and 3 deletions

View File

@ -5,6 +5,11 @@
#include "creature.h"
#include "team.h"
#include "human.h"
#include "room.h"
#include "player.h"
#include "cs_proto.pb.h"
#include "cs_msgid.pb.h"
BatchSync::BatchSync(Room* room)
{
@ -32,10 +37,17 @@ void BatchSync::AddGlobalObject(Creature* c)
std::get<0>(*tuple) = f8::Timer::Instance()->SetIntervalWpEx
(
1000,
[tuple] (int event, const a8::Args* args)
[this, tuple] (int event, const a8::Args* args)
{
if (event == a8::TIMER_EXEC_EVENT) {
cs::SMSyncPosition sync_msg;
std::get<1>(*tuple).FillSMSyncPosition(sync_msg);
room_->TraversePlayerList
(
[&sync_msg] (Player* hum) mutable
{
hum->SendNotifyMsg(sync_msg);
});
}
},
&timer_attacher_);

View File

@ -3310,6 +3310,9 @@ void Room::ForwardGasRing(int n)
const mt::Hero* hero_meta = mt::Hero::GetById(std::get<2>(*boss_tuple));
if (hero_meta) {
int boss_uniid = AllocUniid();
#ifdef DEBUG
boss_uniid = GetOneAlivePlayer()->GetUniId();
#endif
NotifyNewsTicker
(2,
{
@ -3322,12 +3325,19 @@ void Room::ForwardGasRing(int n)
});
xtimer.SetTimeoutEx
(SERVER_FRAME_RATE * std::get<1>(*boss_tuple),
[this, boss_tuple] (int event, const a8::Args* args)
[this, boss_tuple, hero_meta] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
#if 0
CreateHero(nullptr,
hero_meta,
std::get<0>(*boss_tuple),
);
#endif
}
},
&xtimer_attacher_);
batch_sync_->AddGlobalObject(GetOneAlivePlayer());
}
}
}