添加微信渠道特殊处理
This commit is contained in:
parent
04253a7d11
commit
e2d0e4e430
@ -322,6 +322,11 @@ enum ColliderTag_e
|
||||
kHalfWallTag = 1
|
||||
};
|
||||
|
||||
enum GameChannel_e
|
||||
{
|
||||
kWxChannelId = 6001
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "room.h"
|
||||
#include "mapinstance.h"
|
||||
#include "metamgr.h"
|
||||
#include "cs_proto.pb.h"
|
||||
|
||||
void MapMgr::Init()
|
||||
{
|
||||
@ -40,7 +41,12 @@ void MapMgr::AttachRoom(Room* room, RoomInitInfo& init_info)
|
||||
{
|
||||
MapInstance* map_instance = GetMapInstance(2001);
|
||||
if (init_info.room_mode == kZombieMode) {
|
||||
map_instance = GetMapInstance(3001);
|
||||
if (init_info.creator_channel == kWxChannelId &&
|
||||
init_info.creator_proto_version == cs::ProtoVersion) {
|
||||
map_instance = GetMapInstance(4001);
|
||||
} else {
|
||||
map_instance = GetMapInstance(3001);
|
||||
}
|
||||
}
|
||||
if (!map_instance) {
|
||||
abort();
|
||||
|
@ -52,6 +52,8 @@ void Room::InitData(RoomInitInfo& init_info)
|
||||
room_type_ = init_info.room_type;
|
||||
creator_game_times_ = init_info.creator_game_times;
|
||||
creator_register_time_ = init_info.creator_register_time;
|
||||
creator_proto_version_ = init_info.creator_proto_version;
|
||||
creator_channel_ = init_info.creator_channel;
|
||||
force_entry_newbie_room_ = init_info.force_entry_newbie_room;
|
||||
|
||||
map_tpl_name_ = init_info.map_tpl_name;
|
||||
@ -736,8 +738,20 @@ int Room::GetAliveTeamNum()
|
||||
|
||||
bool Room::CanJoin(const std::string& accountid,
|
||||
RoomType_e self_room_type,
|
||||
RoomMode_e self_room_mode)
|
||||
RoomMode_e self_room_mode,
|
||||
int self_proto_version,
|
||||
int self_channel)
|
||||
{
|
||||
#if 1
|
||||
if (creator_channel_ == kWxChannelId) {
|
||||
if (self_channel != creator_channel_) {
|
||||
return false;
|
||||
}
|
||||
if (self_proto_version != creator_proto_version_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (self_room_mode < kChiJiMode) {
|
||||
self_room_mode = kChiJiMode;
|
||||
}
|
||||
|
@ -111,7 +111,9 @@ public:
|
||||
std::set<Human*>* GetAliveTeam();
|
||||
bool CanJoin(const std::string& accountid,
|
||||
RoomType_e self_roomm_type,
|
||||
RoomMode_e self_room_mode);
|
||||
RoomMode_e self_room_mode,
|
||||
int self_proto_version,
|
||||
int self_channel);
|
||||
void OnPlayerOffline(Player* hum);
|
||||
Entity* FindFirstCollisonEntity(const a8::Vec2& aabb_pos, AabbCollider& aabb_box);
|
||||
void FindLocationWithAabb(Entity* target, const a8::Vec2& aabb_pos, AabbCollider* aabb_box,
|
||||
@ -266,6 +268,8 @@ private:
|
||||
bool show_handed_ = false;
|
||||
int creator_game_times_ = 0;
|
||||
int creator_register_time_ = 0;
|
||||
int creator_proto_version_ = 0;
|
||||
int creator_channel_ = 0;
|
||||
bool force_entry_newbie_room_ = false;
|
||||
xtimer_list* battle_report_timer_ = nullptr;
|
||||
bool sent_terminator_airdrop = false;
|
||||
|
@ -139,10 +139,14 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
int game_times = 0;
|
||||
RoomType_e self_room_type = GetHumanRoomType(msg, game_times);
|
||||
time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id());
|
||||
int proto_version = msg.proto_version();
|
||||
int channel = f8::ExtractChannelIdFromAccountId(msg.account_id());
|
||||
Room* room = GetJoinableRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
register_time
|
||||
register_time,
|
||||
proto_version,
|
||||
channel
|
||||
);
|
||||
if (!room) {
|
||||
JoinErrorHandle(msg, 3, hdr.socket_handle);
|
||||
@ -220,7 +224,9 @@ int RoomMgr::OverRoomNum()
|
||||
Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
|
||||
const RoomType_e self_room_type,
|
||||
int game_times,
|
||||
int creator_register_time
|
||||
int creator_register_time,
|
||||
int proto_version,
|
||||
int channel
|
||||
)
|
||||
{
|
||||
std::vector<std::vector<Room*>> group_rooms;
|
||||
@ -229,7 +235,11 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
|
||||
}
|
||||
for (auto& pair : inactive_room_hash_) {
|
||||
Room* room = pair.second;
|
||||
if (room->CanJoin(msg.account_id(), self_room_type, (RoomMode_e)msg.room_mode())) {
|
||||
if (room->CanJoin(msg.account_id(),
|
||||
self_room_type,
|
||||
(RoomMode_e)msg.room_mode(),
|
||||
proto_version,
|
||||
channel)) {
|
||||
if (!msg.team_uuid().empty() && room->HaveMyTeam(msg.team_uuid())) {
|
||||
return room;
|
||||
}
|
||||
@ -244,13 +254,17 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
|
||||
return CreateRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
creator_register_time);
|
||||
creator_register_time,
|
||||
proto_version,
|
||||
channel);
|
||||
}
|
||||
if (self_room_type == RT_MidBrid) {
|
||||
return CreateRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
creator_register_time);
|
||||
creator_register_time,
|
||||
proto_version,
|
||||
channel);
|
||||
}
|
||||
for (int i = 0; i < RT_Max; ++i) {
|
||||
for (Room* room : group_rooms[i]) {
|
||||
@ -262,7 +276,9 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
|
||||
return CreateRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
creator_register_time);
|
||||
creator_register_time,
|
||||
proto_version,
|
||||
channel);
|
||||
}
|
||||
|
||||
Room* RoomMgr::GetRoomByUuid(long long room_uuid)
|
||||
@ -439,7 +455,9 @@ int RoomMgr::AllocRoomIdx()
|
||||
Room* RoomMgr::CreateRoom(const cs::CMJoin& msg,
|
||||
RoomType_e room_type,
|
||||
int game_times,
|
||||
int creator_register_time)
|
||||
int creator_register_time,
|
||||
int creator_proto_version,
|
||||
int creator_channel)
|
||||
{
|
||||
int room_idx = AllocRoomIdx();
|
||||
if (room_idx < 1) {
|
||||
@ -453,6 +471,8 @@ Room* RoomMgr::CreateRoom(const cs::CMJoin& msg,
|
||||
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.creator_proto_version = creator_proto_version;
|
||||
init_info.creator_channel = creator_channel;
|
||||
init_info.force_entry_newbie_room = msg.force_entry_newbie_room();
|
||||
if (GetRoomByUuid(init_info.room_uuid)) {
|
||||
abort();
|
||||
|
@ -38,7 +38,9 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
Room* GetJoinableRoom(const cs::CMJoin& msg,
|
||||
const RoomType_e self_room_type,
|
||||
int game_times,
|
||||
int creator_register_time);
|
||||
int creator_register_time,
|
||||
int proto_version,
|
||||
int channel);
|
||||
void ReportServerState(int instance_id, const std::string& host, int port);
|
||||
void FreeOverRoom(long long room_uuid);
|
||||
bool IsLimitJoin();
|
||||
@ -47,7 +49,9 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
Room* CreateRoom(const cs::CMJoin& msg,
|
||||
RoomType_e room_type,
|
||||
int game_times,
|
||||
int creator_register_time);
|
||||
int creator_register_time,
|
||||
int creator_proto_version,
|
||||
int creator_channel);
|
||||
void JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_handle);
|
||||
|
||||
private:
|
||||
|
@ -160,6 +160,8 @@ struct RoomInitInfo
|
||||
RoomType_e room_type = RT_NewBrid;
|
||||
int creator_game_times = 0;
|
||||
int creator_register_time = 0;
|
||||
int creator_proto_version = 0;
|
||||
int creator_channel = 0;
|
||||
bool force_entry_newbie_room = false;
|
||||
|
||||
const MetaData::Map* map_meta = nullptr;
|
||||
|
@ -50,7 +50,7 @@ package cs;
|
||||
//常量
|
||||
enum Constant_e
|
||||
{
|
||||
ProtoVersion = 2019071501; //系统版本
|
||||
ProtoVersion = 2020081401; //系统版本
|
||||
}
|
||||
|
||||
//心跳
|
||||
|
Loading…
x
Reference in New Issue
Block a user