This commit is contained in:
aozhiwei 2020-07-24 09:58:38 +08:00
parent 66665de562
commit 418ef3ca06
2 changed files with 40 additions and 14 deletions

View File

@ -908,7 +908,7 @@ void Room::UpdateGas()
UpdateGasMoving(); UpdateGasMoving();
break; break;
} }
if (gas_data_.gas_mode != GasInactive) { if (gas_data_.gas_mode != GasInactive && GetRoomMode() == kChiJiMode) {
if (!IsGameOver() && alive_count_ <= MAX_TEAM_NUM && GetAliveTeamNum() <= 1) { if (!IsGameOver() && alive_count_ <= MAX_TEAM_NUM && GetAliveTeamNum() <= 1) {
game_over_ = true; game_over_ = true;
game_over_frameno_ = GetFrameNo(); game_over_frameno_ = GetFrameNo();
@ -1563,6 +1563,13 @@ void Room::NotifyWxVoip()
&xtimer_attacher_.timer_list_); &xtimer_attacher_.timer_list_);
} }
void Room::BattleReport()
{
game_over_ = true;
game_over_frameno_ = frameno_;
RoomMgr::Instance()->AddOverRoom(room_uuid_);
}
BornPoint* Room::AllocBornPoint(Human* hum) BornPoint* Room::AllocBornPoint(Human* hum)
{ {
BornPoint* born_point = nullptr; BornPoint* born_point = nullptr;
@ -2683,7 +2690,9 @@ void Room::NewBieRoomStart()
void Room::ZombieModeStart() void Room::ZombieModeStart()
{ {
if (GetRoomMode() == kZombieMode) { if (GetRoomMode() != kZombieMode) {
abort();
}
if (human_hash_.size() != GetRoomMaxPlayerNum()) { if (human_hash_.size() != GetRoomMaxPlayerNum()) {
abort(); abort();
} }
@ -2696,7 +2705,22 @@ void Room::ZombieModeStart()
Human* hum = human_list[i]; Human* hum = human_list[i];
hum->ChangeToRace(kZombieRace, 1); hum->ChangeToRace(kZombieRace, 1);
} }
battle_report_timer_ = xtimer.AddDeadLineTimerAndAttach
(SERVER_FRAME_RATE * MetaMgr::Instance()->zbmode_game_duration,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
Room* room = (Room*)param.sender.GetUserData();
room->BattleReport();
},
&xtimer_attacher_.timer_list_,
[] (const a8::XParams& param)
{
Room* room = (Room*)param.sender.GetUserData();
room->battle_report_timer_ = nullptr;
} }
);
} }
Human* Room::GetOneCanEnableAndroid() Human* Room::GetOneCanEnableAndroid()

View File

@ -153,6 +153,7 @@ private:
void OnGameOver(); void OnGameOver();
void RandRemoveAndroid(); void RandRemoveAndroid();
void NotifyWxVoip(); void NotifyWxVoip();
void BattleReport();
BornPoint* AllocBornPoint(Human* hum); BornPoint* AllocBornPoint(Human* hum);
BornPoint* GetBornPoint(int point_uniid); BornPoint* GetBornPoint(int point_uniid);
void CreateSpawnPoints(); void CreateSpawnPoints();
@ -247,6 +248,7 @@ private:
int creator_game_times_ = 0; int creator_game_times_ = 0;
int creator_register_time_ = 0; int creator_register_time_ = 0;
bool force_entry_newbie_room_ = false; bool force_entry_newbie_room_ = false;
xtimer_list* battle_report_timer_ = nullptr;
int current_teamid_ = 0; int current_teamid_ = 0;
int current_uniid_ = FIXED_OBJECT_MAXID; int current_uniid_ = FIXED_OBJECT_MAXID;