diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index f1bd28e..b8ed29a 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1826,7 +1826,7 @@ void Human::_UpdateMove(int speed) void Human::ChangeToRace(RaceType_e race, int level) { - if (race != kHumanRace || + if (race != kHumanRace && race != kZombieRace) { abort(); } diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index bf0983a..e65484a 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -797,6 +797,19 @@ void Room::FillSMUiUpdate(cs::SMUiUpdate& msg) } } if (GetRoomMode() == kZombieMode) { + #if 1 + { + zombie_alive_count_ = 0; + human_alive_count_ = 0; + for (auto& pair : human_hash_) { + if (pair.second->GetRace() == kHumanRace) { + ++human_alive_count_; + } else if (pair.second->GetRace() == kZombieRace) { + ++zombie_alive_count_; + } + } + } + #endif msg.set_zombie_num(zombie_alive_count_); msg.set_human_num(human_alive_count_); } @@ -937,9 +950,9 @@ void Room::UpdateGasInactive() if (human_hash_.size() < GetRoomMaxPlayerNum()) { CreateAndroid(GetRoomMaxPlayerNum() - human_hash_.size()); } - NotifyUiUpdate(); CombineTeam(); NotifyGameStart(); + NotifyUiUpdate(); NotifyWxVoip(); if (room_type_ != RT_NewBrid) { InitAirDrop(); @@ -2649,7 +2662,7 @@ void Room::NewBieRoomStart() void Room::ZombieModeStart() { - if (GetRoomMode() != kZombieMode) { + if (GetRoomMode() == kZombieMode) { if (human_hash_.size() != GetRoomMaxPlayerNum()) { abort(); } diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 47ba895..3b6c57e 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -127,6 +127,15 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg) JoinErrorHandle(msg, 2, hdr.socket_handle); return; } + #if 1 + { + cs::CMJoin* mutable_msg = (cs::CMJoin*)&msg; + if (mutable_msg->room_mode() != kChiJiMode && + mutable_msg->room_mode() != kZombieMode) { + mutable_msg->set_room_mode(kChiJiMode); + } + } + #endif int game_times = 0; RoomType_e self_room_type = GetHumanRoomType(msg, game_times); time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id()); @@ -397,6 +406,7 @@ Room* RoomMgr::CreateRoom(const cs::CMJoin& msg, init_info.room_idx = room_idx; init_info.room_uuid = App::Instance()->NewUuid(); init_info.room_type = room_type; + init_info.room_mode = (RoomMode_e)msg.room_mode(); init_info.creator_game_times = game_times; init_info.creator_register_time = creator_register_time; init_info.force_entry_newbie_room = msg.force_entry_newbie_room();