This commit is contained in:
aozhiwei 2020-07-23 15:56:31 +08:00
parent f55179f4b2
commit c84825747d
3 changed files with 26 additions and 3 deletions

View File

@ -1826,7 +1826,7 @@ void Human::_UpdateMove(int speed)
void Human::ChangeToRace(RaceType_e race, int level) void Human::ChangeToRace(RaceType_e race, int level)
{ {
if (race != kHumanRace || if (race != kHumanRace &&
race != kZombieRace) { race != kZombieRace) {
abort(); abort();
} }

View File

@ -797,6 +797,19 @@ void Room::FillSMUiUpdate(cs::SMUiUpdate& msg)
} }
} }
if (GetRoomMode() == kZombieMode) { 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_zombie_num(zombie_alive_count_);
msg.set_human_num(human_alive_count_); msg.set_human_num(human_alive_count_);
} }
@ -937,9 +950,9 @@ void Room::UpdateGasInactive()
if (human_hash_.size() < GetRoomMaxPlayerNum()) { if (human_hash_.size() < GetRoomMaxPlayerNum()) {
CreateAndroid(GetRoomMaxPlayerNum() - human_hash_.size()); CreateAndroid(GetRoomMaxPlayerNum() - human_hash_.size());
} }
NotifyUiUpdate();
CombineTeam(); CombineTeam();
NotifyGameStart(); NotifyGameStart();
NotifyUiUpdate();
NotifyWxVoip(); NotifyWxVoip();
if (room_type_ != RT_NewBrid) { if (room_type_ != RT_NewBrid) {
InitAirDrop(); InitAirDrop();
@ -2649,7 +2662,7 @@ void Room::NewBieRoomStart()
void Room::ZombieModeStart() void Room::ZombieModeStart()
{ {
if (GetRoomMode() != kZombieMode) { if (GetRoomMode() == kZombieMode) {
if (human_hash_.size() != GetRoomMaxPlayerNum()) { if (human_hash_.size() != GetRoomMaxPlayerNum()) {
abort(); abort();
} }

View File

@ -127,6 +127,15 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
JoinErrorHandle(msg, 2, hdr.socket_handle); JoinErrorHandle(msg, 2, hdr.socket_handle);
return; 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; int game_times = 0;
RoomType_e self_room_type = GetHumanRoomType(msg, game_times); RoomType_e self_room_type = GetHumanRoomType(msg, game_times);
time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id()); 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_idx = room_idx;
init_info.room_uuid = App::Instance()->NewUuid(); init_info.room_uuid = App::Instance()->NewUuid();
init_info.room_type = room_type; 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_game_times = game_times;
init_info.creator_register_time = creator_register_time; init_info.creator_register_time = creator_register_time;
init_info.force_entry_newbie_room = msg.force_entry_newbie_room(); init_info.force_entry_newbie_room = msg.force_entry_newbie_room();