36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package memory
|
|
|
|
import (
|
|
"fmt"
|
|
"joylink.club/bj-rtsts-server/dto/request_proto"
|
|
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
|
|
"joylink.club/rtsssimulation/fi"
|
|
)
|
|
|
|
// 处理道岔操作
|
|
func HandlePsdOperation(simulation *VerifySimulation, req *request_proto.PsdOperationReq) error {
|
|
uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.ScreenDoor{})
|
|
switch req.Operation {
|
|
case request_proto.Psd_Km4:
|
|
return fi.SetInterlockKm4(simulation.World, uid)
|
|
case request_proto.Psd_CancelKm4:
|
|
return fi.CancelInterlockKm4(simulation.World, uid)
|
|
case request_proto.Psd_Km8:
|
|
return fi.SetInterlockKm8(simulation.World, uid)
|
|
case request_proto.Psd_CancelKm8:
|
|
return fi.CancelInterlockKm8(simulation.World, uid)
|
|
case request_proto.Psd_Gm:
|
|
return fi.SetInterlockGm(simulation.World, uid)
|
|
case request_proto.Psd_CancelGm:
|
|
return fi.CancelInterlockGm(simulation.World, uid)
|
|
case request_proto.Psd_ForceKm4:
|
|
|
|
case request_proto.Psd_ForceKm8:
|
|
|
|
case request_proto.Psd_ForceGm:
|
|
default:
|
|
panic(fmt.Sprintf("未知的道岔操作:%s", req.Operation))
|
|
}
|
|
return nil
|
|
}
|