1
This commit is contained in:
parent
0c61ae146a
commit
85286a2443
@ -225,7 +225,8 @@ message CMDisbandRoom
|
|||||||
|
|
||||||
message SMDisbandRoom
|
message SMDisbandRoom
|
||||||
{
|
{
|
||||||
|
optional int32 errcode = 1; //错误码 0:成功 1:权限不足
|
||||||
|
optional string errmsg = 2; //错误描述
|
||||||
}
|
}
|
||||||
|
|
||||||
//退出房间
|
//退出房间
|
||||||
|
@ -141,6 +141,12 @@ func (this *room) OnPlayerOffline(hum common.Player) {
|
|||||||
func (this *room) CMDisbandRoom(hdr *f5.MsgHdr, msg *cs.CMDisbandRoom) {
|
func (this *room) CMDisbandRoom(hdr *f5.MsgHdr, msg *cs.CMDisbandRoom) {
|
||||||
hum := hdr.Context.(common.Player)
|
hum := hdr.Context.(common.Player)
|
||||||
rspMsg := &cs.SMDisbandRoom{}
|
rspMsg := &cs.SMDisbandRoom{}
|
||||||
|
if !this.isOwner(hum) {
|
||||||
|
rspMsg.Errcode = proto.Int32(1)
|
||||||
|
rspMsg.Errmsg = proto.String("insufficient permissions")
|
||||||
|
hum.SendMsg(rspMsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
if this.roomState == ROOM_INIT_STATE {
|
if this.roomState == ROOM_INIT_STATE {
|
||||||
this.doDisband(1)
|
this.doDisband(1)
|
||||||
}
|
}
|
||||||
@ -311,3 +317,7 @@ func (this *room) canStart() bool {
|
|||||||
}
|
}
|
||||||
return alreadyNum >- ROOM_MIN_START_TEAM_NUM
|
return alreadyNum >- ROOM_MIN_START_TEAM_NUM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *room) isOwner(hum common.Player) bool {
|
||||||
|
return this.owner.hum.GetAccountId() == hum.GetAccountId()
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user