add creator_game_times
This commit is contained in:
parent
ede91ed45c
commit
23a948dff5
@ -45,6 +45,7 @@ void Room::InitData(RoomInitInfo& init_info)
|
|||||||
room_idx_ = init_info.room_idx;
|
room_idx_ = init_info.room_idx;
|
||||||
room_uuid_ = init_info.room_uuid;
|
room_uuid_ = init_info.room_uuid;
|
||||||
room_type_ = init_info.room_type;
|
room_type_ = init_info.room_type;
|
||||||
|
creator_game_times_ = init_info.creator_game_times;
|
||||||
|
|
||||||
map_tpl_name_ = init_info.map_tpl_name;
|
map_tpl_name_ = init_info.map_tpl_name;
|
||||||
grid_service = init_info.grid_service;
|
grid_service = init_info.grid_service;
|
||||||
@ -68,7 +69,7 @@ void Room::Init()
|
|||||||
CreateDropObjs();
|
CreateDropObjs();
|
||||||
InitObstacleDatas();
|
InitObstacleDatas();
|
||||||
ShuaAndroid();
|
ShuaAndroid();
|
||||||
if (room_type_ == RT_NewBrid) {
|
if (room_type_ == RT_NewBrid && creator_game_times_ <= 0) {
|
||||||
CreateLevel0RoomSpecThings();
|
CreateLevel0RoomSpecThings();
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -231,6 +231,7 @@ private:
|
|||||||
int level0room_born_point_uniid_ = 0;
|
int level0room_born_point_uniid_ = 0;
|
||||||
int level1room_born_point_uniid_ = 0;
|
int level1room_born_point_uniid_ = 0;
|
||||||
bool show_handed_ = false;
|
bool show_handed_ = false;
|
||||||
|
int creator_game_times_ = 0;
|
||||||
|
|
||||||
int current_teamid_ = 0;
|
int current_teamid_ = 0;
|
||||||
int current_uniid_ = FIXED_OBJECT_MAXID;
|
int current_uniid_ = FIXED_OBJECT_MAXID;
|
||||||
|
@ -22,15 +22,16 @@
|
|||||||
const int ROOM_NUM_UP_LIMIT = 1000;
|
const int ROOM_NUM_UP_LIMIT = 1000;
|
||||||
const int HUM_NUM_DOWN_LIMIT = 1500;
|
const int HUM_NUM_DOWN_LIMIT = 1500;
|
||||||
|
|
||||||
static RoomType_e GetHumanRoomType(const cs::CMJoin& msg)
|
static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times)
|
||||||
{
|
{
|
||||||
|
game_times = 0;
|
||||||
std::vector<std::string> tmp_strings;
|
std::vector<std::string> tmp_strings;
|
||||||
a8::Split(msg.pre_settlement_info(), tmp_strings, ',');
|
a8::Split(msg.pre_settlement_info(), tmp_strings, ',');
|
||||||
if (tmp_strings.size() < 3) {
|
if (tmp_strings.size() < 3) {
|
||||||
return RT_NewBrid;
|
return RT_NewBrid;
|
||||||
}
|
}
|
||||||
//游戏次数,吃鸡数,击杀数,段位
|
//游戏次数,吃鸡数,击杀数,段位
|
||||||
int game_times = a8::XValue(tmp_strings[0]);
|
game_times = a8::XValue(tmp_strings[0]);
|
||||||
int rank = tmp_strings.size() > 3 ? a8::XValue(tmp_strings[3]).GetInt() : 0;
|
int rank = tmp_strings.size() > 3 ? a8::XValue(tmp_strings[3]).GetInt() : 0;
|
||||||
#if 1
|
#if 1
|
||||||
#else
|
#else
|
||||||
@ -128,8 +129,9 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
JoinErrorHandle(msg, 2, hdr.socket_handle);
|
JoinErrorHandle(msg, 2, hdr.socket_handle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RoomType_e self_room_type = GetHumanRoomType(msg);
|
int game_times = 0;
|
||||||
Room* room = GetJoinableRoom(msg, self_room_type);
|
RoomType_e self_room_type = GetHumanRoomType(msg, game_times);
|
||||||
|
Room* room = GetJoinableRoom(msg, self_room_type, game_times);
|
||||||
if (!room) {
|
if (!room) {
|
||||||
JoinErrorHandle(msg, 3, hdr.socket_handle);
|
JoinErrorHandle(msg, 3, hdr.socket_handle);
|
||||||
return;
|
return;
|
||||||
@ -159,7 +161,7 @@ int RoomMgr::OverRoomNum()
|
|||||||
return over_room_hash_.size();
|
return over_room_hash_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type)
|
Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type, int game_times)
|
||||||
{
|
{
|
||||||
std::vector<std::vector<Room*>> group_rooms;
|
std::vector<std::vector<Room*>> group_rooms;
|
||||||
for (int i = 0; i < RT_Max; ++i) {
|
for (int i = 0; i < RT_Max; ++i) {
|
||||||
@ -179,17 +181,17 @@ 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) {
|
||||||
return CreateRoom(self_room_type);
|
return CreateRoom(self_room_type, game_times);
|
||||||
}
|
}
|
||||||
if (self_room_type == RT_MidBrid) {
|
if (self_room_type == RT_MidBrid) {
|
||||||
return CreateRoom(self_room_type);
|
return CreateRoom(self_room_type, game_times);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < RT_Max; ++i) {
|
for (int i = 0; i < RT_Max; ++i) {
|
||||||
for (Room* room : group_rooms[i]) {
|
for (Room* room : group_rooms[i]) {
|
||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CreateRoom(self_room_type);
|
return CreateRoom(self_room_type, game_times);
|
||||||
}
|
}
|
||||||
|
|
||||||
Room* RoomMgr::GetRoomByUuid(long long room_uuid)
|
Room* RoomMgr::GetRoomByUuid(long long room_uuid)
|
||||||
@ -362,7 +364,7 @@ int RoomMgr::AllocRoomIdx()
|
|||||||
return current_room_idx_;
|
return current_room_idx_;
|
||||||
}
|
}
|
||||||
|
|
||||||
Room* RoomMgr::CreateRoom(RoomType_e room_type)
|
Room* RoomMgr::CreateRoom(RoomType_e room_type, int game_times)
|
||||||
{
|
{
|
||||||
int room_idx = AllocRoomIdx();
|
int room_idx = AllocRoomIdx();
|
||||||
if (room_idx < 1) {
|
if (room_idx < 1) {
|
||||||
@ -373,6 +375,7 @@ Room* RoomMgr::CreateRoom(RoomType_e room_type)
|
|||||||
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.creator_game_times = game_times;
|
||||||
if (GetRoomByUuid(init_info.room_uuid)) {
|
if (GetRoomByUuid(init_info.room_uuid)) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,13 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
|||||||
private:
|
private:
|
||||||
void InstallReportStateTimer();
|
void InstallReportStateTimer();
|
||||||
Room* GetRoomByIdx(int room_idx);
|
Room* GetRoomByIdx(int room_idx);
|
||||||
Room* GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type);
|
Room* GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type, int game_times);
|
||||||
void ReportServerState(int instance_id, const std::string& host, int port);
|
void ReportServerState(int instance_id, const std::string& host, int port);
|
||||||
void FreeOverRoom(long long room_uuid);
|
void FreeOverRoom(long long room_uuid);
|
||||||
bool IsLimitJoin();
|
bool IsLimitJoin();
|
||||||
|
|
||||||
int AllocRoomIdx();
|
int AllocRoomIdx();
|
||||||
Room* CreateRoom(RoomType_e room_type);
|
Room* CreateRoom(RoomType_e room_type, int game_times);
|
||||||
void JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_handle);
|
void JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_handle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -153,6 +153,7 @@ struct RoomInitInfo
|
|||||||
int room_idx = 0;
|
int room_idx = 0;
|
||||||
long long room_uuid = 0;
|
long long room_uuid = 0;
|
||||||
RoomType_e room_type = RT_NewBrid;
|
RoomType_e room_type = RT_NewBrid;
|
||||||
|
int creator_game_times = 0;
|
||||||
|
|
||||||
const MetaData::Map* map_meta = nullptr;
|
const MetaData::Map* map_meta = nullptr;
|
||||||
std::string map_tpl_name;
|
std::string map_tpl_name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user