From 08ce7453fe4f0fd3cfee9521e8afa1087dd060b7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Jun 2021 10:28:56 +0800 Subject: [PATCH] 1 --- server/gameserver/obstacle.cc | 10 ++++++++++ server/gameserver/obstacle.h | 4 ++-- server/gameserver/roomobstacle.cc | 18 +++++++++--------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/server/gameserver/obstacle.cc b/server/gameserver/obstacle.cc index d16e356..21b1371 100644 --- a/server/gameserver/obstacle.cc +++ b/server/gameserver/obstacle.cc @@ -566,3 +566,13 @@ void Obstacle::OnBulletHit(Bullet* bullet) #endif } } + +bool Obstacle::CanThroughable(Creature* c) +{ + return false; +} + +bool Obstacle::CanThroughable(Bullet* bullet) +{ + return false; +} diff --git a/server/gameserver/obstacle.h b/server/gameserver/obstacle.h index f570b22..1738033 100644 --- a/server/gameserver/obstacle.h +++ b/server/gameserver/obstacle.h @@ -42,8 +42,8 @@ class Obstacle : public Entity virtual void OnPreCollision(Room* room) override; virtual void OnBulletHit(Bullet* bullet) override; virtual bool IsTerminatorAirDropBox(Room* room) { return false; } - virtual bool CanThroughable(Creature* c) { return false; } - virtual bool CanThroughable(Bullet* bullet) { return false; } + virtual bool CanThroughable(Creature* c); + virtual bool CanThroughable(Bullet* bullet); void Explosion(Bullet* bullet); void SetDoorInfo(Building* building, int door_id_x); bool IsDoor(); diff --git a/server/gameserver/roomobstacle.cc b/server/gameserver/roomobstacle.cc index 6b06704..e57e331 100644 --- a/server/gameserver/roomobstacle.cc +++ b/server/gameserver/roomobstacle.cc @@ -92,15 +92,6 @@ void RoomObstacle::RecalcSelfCollider() } } -bool RoomObstacle::CanThroughable(Creature* c) -{ - if (master.Get()) { - return master.Get()->team_id == c->team_id && temp_through_; - } else { - return temp_through_; - } -} - void RoomObstacle::ActiveTimerFunc() { if (!master.Get()) { @@ -473,3 +464,12 @@ void RoomObstacle::Die(Room* room) DetachFromMaster(); } } + +bool RoomObstacle::CanThroughable(Creature* c) +{ + if (master.Get()) { + return master.Get()->team_id == c->team_id && temp_through_; + } else { + return temp_through_; + } +}