diff --git a/server/hallserver/proto/cs_proto.proto b/server/hallserver/proto/cs_proto.proto index c9e06ef8..a4c1921e 100644 --- a/server/hallserver/proto/cs_proto.proto +++ b/server/hallserver/proto/cs_proto.proto @@ -190,6 +190,7 @@ message SMCreateRoom { optional int32 errcode = 1; //错误码 0:成功 1:重连失败 optional string errmsg = 2; //错误描述 + optional string room_id = 3; //房间号 } //获取房间列表 diff --git a/server/hallserver/room/roommgr.go b/server/hallserver/room/roommgr.go index 79e361e5..f6776df8 100644 --- a/server/hallserver/room/roommgr.go +++ b/server/hallserver/room/roommgr.go @@ -39,6 +39,7 @@ func (this *roomMgr) ProcessCMMsg(handler *cs.CsNetMsgHandler, hdr *f5.MsgHdr) { case constant.ROOM_MGR_HANDLER_ID: hum := GetPlayerMgr().GetPlayerBySocket(hdr.GetSocket()) if hum != nil { + hdr.Context = hum cs.DispatchMsg(handler, hdr, this) } case constant.ROOM_HANDLER_ID: @@ -63,6 +64,7 @@ func (this *roomMgr) CMCreateRoom(hdr *f5.MsgHdr, msg *cs.CMCreateRoom) { m.init(q5.ToString(this.genRoomId()), this.genRoomIdx(), msg.GetMapId(), hum, msg.GetPasswd()) this.idHash[m.roomId] = m + rspMsg.RoomId = proto.String(m.roomId) hum.SendMsg(rspMsg) } @@ -119,11 +121,11 @@ func (this *roomMgr) CMSearchRoom(hdr *f5.MsgHdr, msg *cs.CMSearchRoom) { hum.SendMsg(&rspMsg) } -func (this *roomMgr) genRoomId() int32 { +func (this *roomMgr) genRoomId() int32 { this.currRoomId++ return this.currRoomId } -func (this *roomMgr) genRoomIdx() int64 { +func (this *roomMgr) genRoomIdx() int64 { return f5.GetApp().NewUuid() }