This commit is contained in:
azw 2023-11-07 02:45:17 +00:00
parent 97c500ed87
commit 2257b8fdcb

View File

@ -998,18 +998,23 @@ void CallFuncBuff::RangeHoldBuff()
);
auto on_enter =
[this, context] (Human* hum)
[this, context] (Creature* hum)
{
if (context->in_human_infos.find(hum->GetUniId()) != context->in_human_infos.end()) {
abort();
}
InnerObject o;
o.c = hum->GetWeakPtrRef();
context->in_human_infos[hum->GetUniId()] = o;
context->in_human_infos[hum->GetUniId()].OnEnter();
};
auto on_stay =
[this, context] (Human* hum)
[this, context] (Creature* hum)
{
};
auto on_leave =
[this, context] (Human* hum)
[this, context] (Creature* hum)
{
auto itr = context->in_human_infos.find(hum->GetUniId());
if (itr == context->in_human_infos.end()) {
@ -1042,6 +1047,18 @@ void CallFuncBuff::RangeHoldBuff()
leave_humans.push_back(pair.second.c.Get()->AsHuman());
}
}
for (Human* hum : leave_humans) {
context->in_human_infos.erase(hum->GetUniId());
}
for (Creature* hum : hit_humans) {
if (context->in_human_infos.find(hum->GetUniId()) ==
context->in_human_infos.end()) {
on_enter(hum);
on_stay(hum);
} else {
on_stay(hum);
}
}
};
owner->room->xtimer.SetIntervalWpEx
(