This commit is contained in:
aozhiwei 2023-11-04 10:03:48 +08:00
parent a9b5a74600
commit 8c8f3ff397
2 changed files with 7 additions and 8 deletions

View File

@ -121,7 +121,7 @@ void Room::Init()
xtimer_attacher_.SetOwner(&xtimer); xtimer_attacher_.SetOwner(&xtimer);
frame_event.room = this; frame_event.room = this;
frame_event_data = new FrameEventData(); frame_event_data = std::make_shared<FrameEventData>();
air_drop_ = std::make_shared<AirDrop>(this); air_drop_ = std::make_shared<AirDrop>(this);
air_raid_ = std::make_shared<AirRaid>(this); air_raid_ = std::make_shared<AirRaid>(this);
@ -134,7 +134,7 @@ void Room::Init()
CreateSpawnPoints(); CreateSpawnPoints();
CreateWorldObjects(); CreateWorldObjects();
ShuaAndroid(); ShuaAndroid();
incubator_ = new Incubator(); incubator_ = std::make_shared(Incubator>();
incubator_->room = this; incubator_->room = this;
incubator_->Init(); incubator_->Init();
sand_table_ = std::make_shared<SandTable>(this); sand_table_ = std::make_shared<SandTable>(this);
@ -166,8 +166,7 @@ void Room::UnInit()
#ifdef DEBUG #ifdef DEBUG
UnInitDebugInfo(); UnInitDebugInfo();
#endif #endif
incubator_->UnInit(); incubator_ = nullptr;
A8_SAFE_DELETE(incubator_);
timer_attacher.ClearTimerList(); timer_attacher.ClearTimerList();
xtimer_attacher_.ClearTimerList(); xtimer_attacher_.ClearTimerList();
grid_service->ClearRoomData(this); grid_service->ClearRoomData(this);
@ -192,7 +191,7 @@ void Room::UnInit()
f8::BtMgr::Instance()->BtDestory(room_agent_); f8::BtMgr::Instance()->BtDestory(room_agent_);
room_agent_ = nullptr; room_agent_ = nullptr;
team_hash_.clear(); team_hash_.clear();
A8_SAFE_DELETE(frame_event_data); frame_event_data = nullptr;
PerfMonitor::Instance()->alive_count -= alive_count_; PerfMonitor::Instance()->alive_count -= alive_count_;
} }

View File

@ -74,7 +74,7 @@ class Room
{ {
public: public:
FrameEvent frame_event; FrameEvent frame_event;
FrameEventData* frame_event_data = nullptr; std::shared_ptr<FrameEventData> frame_event_data;
FrameMaker frame_maker; FrameMaker frame_maker;
a8::XTimer xtimer; a8::XTimer xtimer;
Plane plane; Plane plane;
@ -235,7 +235,7 @@ public:
RoomObstacle* CreateObstacle(int id, float x, float y, float z, RoomObstacle* CreateObstacle(int id, float x, float y, float z,
std::shared_ptr<a8::Args> init_args = nullptr); std::shared_ptr<a8::Args> init_args = nullptr);
int AllocUniid(); int AllocUniid();
Incubator* GetIncubator() { return incubator_;}; std::shared_ptr<Incubator>& GetIncubator() { return incubator_;};
void GetPartObjectWatchList(Entity* entity, std::vector<Human*>& watch_list); void GetPartObjectWatchList(Entity* entity, std::vector<Human*>& watch_list);
void SetInfiniteBulletMode(); void SetInfiniteBulletMode();
bool IsInfiniteBulletMode() { return infinite_bullet_mode_; }; bool IsInfiniteBulletMode() { return infinite_bullet_mode_; };
@ -410,7 +410,7 @@ private:
a8::XTimerWp auto_jump_timer_; a8::XTimerWp auto_jump_timer_;
Incubator* incubator_ = nullptr; std::shared_ptr<Incubator> incubator_;
std::shared_ptr<SandTable> sand_table_; std::shared_ptr<SandTable> sand_table_;
std::shared_ptr<CustomBattle> custom_battle_; std::shared_ptr<CustomBattle> custom_battle_;