1
This commit is contained in:
parent
1ad123d4c1
commit
6197a080af
@ -18,5 +18,21 @@ void RoomMgr::UnInit()
|
|||||||
void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||||
{
|
{
|
||||||
cs::SMJoinedNotify notifymsg;
|
cs::SMJoinedNotify notifymsg;
|
||||||
|
Room* room = GetJoinableRoom(msg.account_id());
|
||||||
|
if (room) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
GGListener::Instance()->SendToClient(hdr.socket_handle, hdr.seqid, notifymsg);
|
GGListener::Instance()->SendToClient(hdr.socket_handle, hdr.seqid, notifymsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Room* RoomMgr::GetJoinableRoom(const std::string& account_id)
|
||||||
|
{
|
||||||
|
for (auto& pair : inactive_room_hash_) {
|
||||||
|
if (!pair.second->IsFull() && !pair.second->GetPlayerByAccountId(account_id)) {
|
||||||
|
return pair.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
@ -22,6 +22,9 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
|||||||
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<long, long, Room*> inactive_room_hash_;
|
Room* GetJoinableRoom(const std::string& account_id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::map<long long, Room*> inactive_room_hash_;
|
||||||
std::map<long long, Room*> room_hash_;
|
std::map<long long, Room*> room_hash_;
|
||||||
};
|
};
|
||||||
|
@ -70,9 +70,10 @@ message MFVector2D
|
|||||||
message MFPlace
|
message MFPlace
|
||||||
{
|
{
|
||||||
optional string name = 1; //名字
|
optional string name = 1; //名字
|
||||||
|
optional MFVector2D pos = 2; //位置
|
||||||
}
|
}
|
||||||
|
|
||||||
message MFObject
|
message MFMapObject
|
||||||
{
|
{
|
||||||
//type
|
//type
|
||||||
optional MFVector2D pos = 1; //位置
|
optional MFVector2D pos = 1; //位置
|
||||||
@ -536,7 +537,6 @@ message CMVoice
|
|||||||
optional string msg = 2; //语音内容
|
optional string msg = 2; //语音内容
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//endcmmsg
|
//endcmmsg
|
||||||
|
|
||||||
//加入成功
|
//加入成功
|
||||||
@ -553,11 +553,12 @@ message SMJoinedNotify
|
|||||||
//地图信息
|
//地图信息
|
||||||
message SMMapInfo
|
message SMMapInfo
|
||||||
{
|
{
|
||||||
optional int32 width = 1; //地图宽度
|
optional int32 map_id = 1; //地图id
|
||||||
optional int32 height = 2; //地图高度
|
optional int32 width = 2; //地图宽度
|
||||||
optional int32 speed = 3; //地图移动速度
|
optional int32 height = 3; //地图高度
|
||||||
repeated MFPlace places = 4; //建筑物
|
optional int32 seed = 4; //zzz
|
||||||
repeated MFObject objects = 5; //地图对象
|
repeated MFPlace places = 5; //zzz
|
||||||
|
repeated MFMapObject objects = 6; //地图对象
|
||||||
}
|
}
|
||||||
|
|
||||||
//玩家信息
|
//玩家信息
|
||||||
|
Loading…
x
Reference in New Issue
Block a user