道岔信号机状态设置的参数添加默认值

This commit is contained in:
walker 2024-01-18 17:20:14 +08:00
parent 4980c14c0b
commit 8313dcd6e1

View File

@ -6,6 +6,7 @@ import (
"strings"
"time"
"joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/rtsssimulation/repository/model/proto"
@ -242,6 +243,8 @@ func handlerSignalState(w ecs.World, uid string) (*state_proto.SignalState, erro
}
if entry.HasComponent(appcomponent.SignalParamType) {
signalState.Param = appcomponent.SignalParamType.Get(entry)
} else {
signalState.Param = &request_proto.SignalParam{}
}
if entry.HasComponent(component.Signal2XH1ElectronicType) { // 2XH1信号机
signal2XH1 := component.Signal2XH1ElectronicType.Get(entry)
@ -391,6 +394,8 @@ func collectTurnoutStates(sim *memory.VerifySimulation, mapId int32) ([]*state_p
}
if entry.HasComponent(appcomponent.PointsParamType) {
s.Param = appcomponent.PointsParamType.Get(entry)
} else {
s.Param = &request_proto.PointsParam{}
}
// // 强制(联锁驱动无效)
// s.Force = entry.HasComponent(component.TurnoutFaultCiqdType)