From 534c22990dcc977098ae19b7f679122f2b6c309a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 29 Jul 2024 17:10:51 +0800 Subject: [PATCH] 1 --- server/gameserver/boxdrop.cc | 18 ++++++++++++++++++ server/gameserver/boxdrop.h | 15 +++++++++++++++ server/gameserver/room.cc | 16 ++++------------ server/gameserver/room.h | 7 +++---- 4 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 server/gameserver/boxdrop.cc create mode 100644 server/gameserver/boxdrop.h diff --git a/server/gameserver/boxdrop.cc b/server/gameserver/boxdrop.cc new file mode 100644 index 00000000..f1a03737 --- /dev/null +++ b/server/gameserver/boxdrop.cc @@ -0,0 +1,18 @@ +#include "precompile.h" + +#include "boxdrop.h" + +BoxDrop::BoxDrop(Room* room):room_(room) +{ + +} + +void BoxDrop::Init() +{ + +} + +void BoxDrop::UnInit() +{ + +} diff --git a/server/gameserver/boxdrop.h b/server/gameserver/boxdrop.h new file mode 100644 index 00000000..a0cc44e0 --- /dev/null +++ b/server/gameserver/boxdrop.h @@ -0,0 +1,15 @@ +#pragma once + +class Room; + +class BoxDrop : public std::enable_shared_from_this +{ + public: + + BoxDrop(Room* room); + void Init(); + void UnInit(); + + private: + Room* room_ = nullptr; +}; diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 08c527f1..d8498a37 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -52,6 +52,7 @@ #include "httpproxy.h" #include "netdata.h" #include "stats.h" +#include "boxdrop.h" #include "mt/Param.h" #include "mt/Hero.h" @@ -133,6 +134,7 @@ void Room::Init() incubator_->room = this; incubator_->Init(); sand_table_ = std::make_shared(this); + box_drop_ = std::make_shared(this); #ifdef MYDEBUG InitDebugInfo(); #endif @@ -226,6 +228,8 @@ void Room::UnInit() #ifdef MYDEBUG UnInitDebugInfo(); #endif + box_drop_->UnInit(); + box_drop_ = nullptr; incubator_ = nullptr; timer_attacher.ClearTimerList(); xtimer_attacher_.ClearTimerList(); @@ -4270,15 +4274,3 @@ void Room::MobaOver() OnGameOver(); } } - -int Room::GetMaxBoxNum() -{ - return max_box_num_; -} - -void Room::SetMaxBoxNum(int box_num) -{ - if (box_num > 0) { - max_box_num_ = box_num; - } -} diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 6dff8203..8467b067 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -51,6 +51,7 @@ class CustomMember; class RoomAgent; class RoomOb; class InGameVoice; +class BoxDrop; struct Plane { @@ -305,8 +306,7 @@ public: void CalcMvp(); long long GetMobaOvertimeRaceFrameNo () { return moba_overtime_race_frameno_; } void MobaOver(); - int GetMaxBoxNum(); - void SetMaxBoxNum(int box_num); + std::shared_ptr GetBoxDrop() { return box_drop_; } std::shared_ptr GetInGameVoice() { return ingame_voice_; } @@ -474,8 +474,7 @@ private: RoomAgent* room_agent_; std::shared_ptr ingame_voice_; - - int max_box_num_ = 0; + std::shared_ptr box_drop_; friend class Incubator; friend class Team;