修复匹配问题

This commit is contained in:
aozhiwei 2020-04-20 19:13:08 +08:00
parent 6c679ad4de
commit ff0e9a9e0c
2 changed files with 10 additions and 34 deletions

View File

@ -70,10 +70,8 @@ enum ActionType_e
enum RoomType_e
{
RT_FirstBrid = 0,
RT_NewBrid = 2,
RT_MidBrid = 3,
RT_OldBrid = 4,
RT_NewBrid = 0,
RT_OldBrid = 1,
RT_Max
};

View File

@ -19,30 +19,16 @@
const int ROOM_NUM_DOWN_LIMIT = 20;
const int ROOM_NUM_UP_LIMIT = 40;
const int HUM_NUM_DOWN_LIMIT = 500;
const int HUM_NUM_DOWN_LIMIT = 1000;
static RoomType_e GetHumanRoomType(const cs::CMJoin& msg)
{
std::vector<std::string> tmp_strings;
a8::Split(msg.pre_settlement_info(), tmp_strings, ',');
if (tmp_strings.size() < 3) {
return RT_FirstBrid;
}
//游戏次数,吃鸡数,击杀数
int game_times = a8::XValue(tmp_strings[0]);
int win_times = a8::XValue(tmp_strings[1]);
int kill_times = a8::XValue(tmp_strings[2]);
if (game_times <= 0) {
return RT_FirstBrid;
}
if (game_times <= MetaMgr::Instance()->newbie_game_times) {
return RT_NewBrid;
}
if (win_times <= MetaMgr::Instance()->niube_win_times) {
return RT_MidBrid;
} else {
return RT_OldBrid;
}
return RT_OldBrid;
}
void RoomMgr::Init()
@ -149,7 +135,7 @@ int RoomMgr::OverRoomNum()
Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type)
{
#if 1
#if 0
for (auto& pair : inactive_room_hash_) {
if (pair.second->CanJoin(msg.account_id())) {
return pair.second;
@ -174,23 +160,15 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room
if (!group_rooms[self_room_type].empty()) {
return group_rooms[self_room_type][rand() % group_rooms[self_room_type].size()];
}
if (self_room_type == RT_FirstBrid) {
return nullptr;
if (self_room_type == RT_NewBrid) {
if (RoomNum() < ROOM_NUM_DOWN_LIMIT - 3) {
return nullptr;
}
}
for (int i = 0; i < RT_Max; ++i) {
if (i != self_room_type) {
for (Room* room : group_rooms[i]) {
if (i <= RT_NewBrid) {
if (a8::XGetTickCount() - room->last_add_player_tick >
MetaMgr::Instance()->newbie_fill_interval) {
return room;
}
} else {
if (a8::XGetTickCount() - room->last_add_player_tick >
MetaMgr::Instance()->other_fill_interval) {
return room;
}
}
return room;
}
}
}