fix: 修复空提交问题
This commit is contained in:
@@ -3,6 +3,7 @@ package space
|
||||
import (
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/common/utils"
|
||||
"sync/atomic"
|
||||
|
||||
"blazing/logic/service/common"
|
||||
"blazing/logic/service/fight/info"
|
||||
@@ -22,19 +23,18 @@ type Space struct {
|
||||
Name string //地图名称
|
||||
ARENA info.S2C_ARENA_GET_INFO
|
||||
ARENA_Player common.PlayerI
|
||||
// DefaultPos model.Pos //默认位置DefaultPos
|
||||
|
||||
//Positions map[uint32]model.Pos //从上一个地图跳转后默认位置 无任何写操作
|
||||
}
|
||||
|
||||
func (s *Space) Can_ARENA(c common.PlayerI) common.PlayerI {
|
||||
func (s *Space) Can_ARENA(tt func(c common.PlayerI) common.PlayerI) {
|
||||
|
||||
//原子操作,修改擂台状态
|
||||
if atomic.CompareAndSwapUint32(&s.ARENA.Flag, 1, 2) {
|
||||
r := tt(s.ARENA_Player)
|
||||
if r != nil {
|
||||
atomic.SwapUint32(&s.ARENA.ChallengerID, r.GetInfo().UserID) //传回的指针赋值给ID
|
||||
}
|
||||
|
||||
if s.ARENA.Flag == 1 {
|
||||
s.ARENA.Flag = 2
|
||||
s.ARENA.ChallengerID = c.GetInfo().UserID
|
||||
return s.ARENA_Player
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user