This commit is contained in:
aozhiwei 2019-07-15 09:41:36 +08:00
parent 72314bbad6
commit fa73330d4d

View File

@ -1900,6 +1900,15 @@ void Human::ProcSkillPhase(MetaData::SkillPhase* phase)
} }
} }
}; };
auto explosion_check_func =
[] (const a8::XParams& param)
{
Obstacle* obstacle = (Obstacle*)param.sender.GetUserData();
if (!obstacle->dead) {
obstacle->dead = true;
obstacle->Explosion();
}
};
switch (phase->func_id) { switch (phase->func_id) {
case Skill_Jump: case Skill_Jump:
@ -1957,14 +1966,7 @@ void Human::ProcSkillPhase(MetaData::SkillPhase* phase)
room->xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 5, room->xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 5,
a8::XParams() a8::XParams()
.SetSender(obstacle), .SetSender(obstacle),
[] (const a8::XParams& param) explosion_check_func,
{
Obstacle* obstacle = (Obstacle*)param.sender.GetUserData();
if (!obstacle->dead) {
obstacle->dead = true;
obstacle->Explosion();
}
},
&obstacle->xtimer_attacher.timer_list_); &obstacle->xtimer_attacher.timer_list_);
} }
} }