1
This commit is contained in:
parent
faa6633869
commit
f810b71997
@ -325,7 +325,7 @@ void Buff::ProcSputteringFunc(Bullet* bullet)
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
VirtualBullet* p = new VirtualBullet();
|
||||
std::shared_ptr<VirtualBullet> p = std::make_shared<VirtualBullet>();
|
||||
p->bullet_uniid = bullet_uniid;
|
||||
p->weapon_uniid = bullet->weapon_uniid;
|
||||
p->skill_meta = bullet->skill_meta;
|
||||
@ -339,7 +339,12 @@ void Buff::ProcSputteringFunc(Bullet* bullet)
|
||||
p->born_pos = bullet_born_pos;
|
||||
p->born_dir = bullet_dir;
|
||||
p->Init();
|
||||
owner->room->AddTask(bullet_uniid, p);
|
||||
owner->room->AddTask(bullet_uniid, std::make_shared<a8::CommonCbProcEx>
|
||||
(
|
||||
[p] (const a8::Args* args)
|
||||
{
|
||||
p->Update(50);
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -162,6 +162,7 @@ void Room::UnInit()
|
||||
delete pair.second;
|
||||
}
|
||||
discard_team_hash_.clear();
|
||||
task_hash_.clear();
|
||||
A8_SAFE_DELETE(frame_event_data);
|
||||
PerfMonitor::Instance()->alive_count -= alive_count_;
|
||||
}
|
||||
@ -194,9 +195,7 @@ void Room::Update(int delta_time)
|
||||
pair.second->Update(50);
|
||||
}
|
||||
for (auto& pair : task_hash_) {
|
||||
if (!pair.second->IsDone()) {
|
||||
pair.second->Update(50);
|
||||
}
|
||||
(*pair.second)(nullptr);
|
||||
}
|
||||
#ifdef DEBUG1
|
||||
end_tick = a8::XGetTickCount();
|
||||
@ -3488,12 +3487,12 @@ bool Room::IsAllRealDead()
|
||||
return is_all_dead;
|
||||
}
|
||||
|
||||
void Room::AddTask(int task_uniid, ITask* task)
|
||||
void Room::AddTask(int task_uniid, std::shared_ptr<a8::CommonCbProcEx> cb)
|
||||
{
|
||||
if (task_hash_.find(task_uniid) != task_hash_.end()) {
|
||||
abort();
|
||||
}
|
||||
task_hash_[task_uniid] = task;
|
||||
task_hash_[task_uniid] = cb;
|
||||
}
|
||||
|
||||
void Room::RemoveTask(int task_uniid)
|
||||
|
@ -223,7 +223,7 @@ public:
|
||||
bool IsInfiniteBulletMode() { return infinite_bullet_mode_; };
|
||||
void AddToPostBattleAutoFreeList(a8::XTimerWp timer);
|
||||
bool CanAddObstacle(const glm::vec3& pos, int obstacle_id);
|
||||
void AddTask(int task_uniid, ITask* task);
|
||||
void AddTask(int task_uniid, std::shared_ptr<a8::CommonCbProcEx> cb);
|
||||
void RemoveTask(int task_uniid);
|
||||
const mt::AirLine* GetAirLine() { return airline_; }
|
||||
int GetPolyExtFlag(int poly_idx);
|
||||
@ -373,7 +373,7 @@ private:
|
||||
std::map<int, Human*> alive_player_hash_;
|
||||
std::map<int, Human*> last_human_hash_;
|
||||
std::map<int, std::shared_ptr<BornPoint>> born_point_hash_;
|
||||
std::map<int, ITask*> task_hash_;
|
||||
std::map<int, std::shared_ptr<a8::CommonCbProcEx>> task_hash_;
|
||||
|
||||
std::map<int, CarObject> car_hash_;
|
||||
std::map<int, Human*> removed_robot_hash_;
|
||||
|
@ -37,13 +37,6 @@ struct BulletCheckResult
|
||||
std::set<Entity*> objects;
|
||||
};
|
||||
|
||||
class ITask
|
||||
{
|
||||
public:
|
||||
virtual void Update(int delta_time) = 0;
|
||||
virtual bool IsDone() = 0;
|
||||
};
|
||||
|
||||
class DelayAddBuffHandle
|
||||
{
|
||||
public:
|
||||
|
@ -4,7 +4,7 @@ struct GridCell;
|
||||
class Entity;
|
||||
class Room;
|
||||
class Obstacle;
|
||||
class VirtualBullet : public IBullet, public ITask
|
||||
class VirtualBullet : public IBullet
|
||||
{
|
||||
public:
|
||||
int bullet_uniid = 0;
|
||||
@ -35,8 +35,8 @@ class VirtualBullet : public IBullet, public ITask
|
||||
virtual float GetHitRadius() override;
|
||||
virtual void ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int target_uniid, const glm::vec3& pos) override;
|
||||
|
||||
virtual void Update(int delta_time) override;
|
||||
virtual bool IsDone() override;
|
||||
virtual void Update(int delta_time);
|
||||
virtual bool IsDone();
|
||||
|
||||
void Init();
|
||||
void SetPos(Position pos) { pos_ = pos; };
|
||||
|
2
third_party/a8
vendored
2
third_party/a8
vendored
@ -1 +1 @@
|
||||
Subproject commit 54fe50edf11dda774dcd6fc480134c9e4ce449cd
|
||||
Subproject commit 140a61cc7f6c23602d05963ab868fe9f5d36cc44
|
Loading…
x
Reference in New Issue
Block a user