修改应答器移位操作:必须在link边界或相邻应答器之间,越过或重叠时报错
This commit is contained in:
parent
91eeb6c89e
commit
b22202ac21
|
@ -17,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
// BalisePositionModify 应答器移位
|
||||
func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDto) error {
|
||||
func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDto) *sys_error.BusinessError {
|
||||
uid := QueryMapUidMapByType(req.MapId, &data_proto.Transponder{})[req.BaliseId].Uid
|
||||
transponder := simulation.Repo.FindTransponder(uid)
|
||||
if transponder == nil {
|
||||
|
@ -88,10 +88,8 @@ func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDt
|
|||
}
|
||||
//更新应答器公里标和Link位置
|
||||
entry, _ := entity.GetEntityByUid(simulation.World, uid)
|
||||
if km.Value < minKm.Value {
|
||||
km.Value = minKm.Value
|
||||
} else if km.Value > maxKm.Value {
|
||||
km.Value = maxKm.Value
|
||||
if km.Value <= minKm.Value || km.Value >= maxKm.Value {
|
||||
return sys_error.New(fmt.Sprintf("超出可设置范围(%d:%d)", minKm.Value, maxKm.Value))
|
||||
}
|
||||
component.KmType.Set(entry, km)
|
||||
offset := number.Abs(km.Value - akm.Value)
|
||||
|
|
Loading…
Reference in New Issue