优化roommgr
This commit is contained in:
parent
51f901dfa1
commit
ac3b59e2ce
@ -18,8 +18,7 @@
|
|||||||
#include "framework/cpp/httpclientpool.h"
|
#include "framework/cpp/httpclientpool.h"
|
||||||
#include "framework/cpp/utils.h"
|
#include "framework/cpp/utils.h"
|
||||||
|
|
||||||
const int ROOM_NUM_DOWN_LIMIT = 15;
|
const int ROOM_NUM_UP_LIMIT = 900;
|
||||||
const int ROOM_NUM_UP_LIMIT = 40;
|
|
||||||
const int HUM_NUM_DOWN_LIMIT = 1000;
|
const int HUM_NUM_DOWN_LIMIT = 1000;
|
||||||
|
|
||||||
static RoomType_e GetHumanRoomType(const cs::CMJoin& msg)
|
static RoomType_e GetHumanRoomType(const cs::CMJoin& msg)
|
||||||
@ -143,26 +142,14 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room
|
|||||||
return group_rooms[self_room_type][rand() % group_rooms[self_room_type].size()];
|
return group_rooms[self_room_type][rand() % group_rooms[self_room_type].size()];
|
||||||
}
|
}
|
||||||
if (self_room_type == RT_NewBrid) {
|
if (self_room_type == RT_NewBrid) {
|
||||||
if (RoomNum() < ROOM_NUM_DOWN_LIMIT - 5) {
|
return CreateRoom(self_room_type);
|
||||||
return CreateRoom(self_room_type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (self_room_type == RT_MidBrid) {
|
if (self_room_type == RT_MidBrid) {
|
||||||
if (RoomNum() < ROOM_NUM_DOWN_LIMIT - 5) {
|
return CreateRoom(self_room_type);
|
||||||
return CreateRoom(self_room_type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (int i = 0; i < RT_Max; ++i) {
|
for (int i = 0; i < RT_Max; ++i) {
|
||||||
if (RoomNum() > ROOM_NUM_DOWN_LIMIT - 5) {
|
for (Room* room : group_rooms[i]) {
|
||||||
for (Room* room : group_rooms[i]) {
|
return room;
|
||||||
return room;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (i != self_room_type) {
|
|
||||||
for (Room* room : group_rooms[i]) {
|
|
||||||
return room;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CreateRoom(self_room_type);
|
return CreateRoom(self_room_type);
|
||||||
@ -322,8 +309,7 @@ bool RoomMgr::IsLimitJoin()
|
|||||||
{
|
{
|
||||||
return RoomNum() >= ROOM_NUM_UP_LIMIT ||
|
return RoomNum() >= ROOM_NUM_UP_LIMIT ||
|
||||||
(
|
(
|
||||||
RoomNum() >= ROOM_NUM_DOWN_LIMIT &&
|
App::Instance()->perf.real_alive_count >= HUM_NUM_DOWN_LIMIT
|
||||||
App::Instance()->perf.alive_count >= HUM_NUM_DOWN_LIMIT
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user