diff --git a/examples/rtss-cg/main.go b/examples/rtss-cg/main.go index 0a46a0b..06d096a 100644 --- a/examples/rtss-cg/main.go +++ b/examples/rtss-cg/main.go @@ -58,9 +58,9 @@ func operateSwitch(world ecs.World, dcId string) { // 初始化memory func initMemoryModel(world ecs.World) { memoryEntry := world.Create(simulation.ComSimMemory) - simulation.ComSimMemory.SetValue(memoryEntry, *simulation.NewSimMemory()) - // - simMemory := simulation.ComSimMemory.Get(memoryEntry) + //simulation.ComSimMemory.SetValue(memoryEntry, *simulation.NewSimMemory()) + simMemory := simulation.NewSimMemory() + simulation.ComSimMemory.Set(memoryEntry, simMemory) createModelsRelation(simMemory) } @@ -70,7 +70,7 @@ func initSwitchState(world ecs.World) { for _, switchModel := range simMemory.Switchs { dc1 := &state.SwitchState{Id: switchModel.GetId(), Normal: true, Reverse: false} dc1Entry := world.Create(simulation.ComSwitchState, simulation.ComSwitchOperating) - simulation.ComSwitchState.SetValue(dc1Entry, *dc1) + simulation.ComSwitchState.Set(dc1Entry, dc1) } } @@ -80,7 +80,7 @@ func initLinkState(world ecs.World) { for _, linkModel := range simMemory.Links { linkState := &state.LinkState{Id: linkModel.GetId(), Occupied: false} linkEntry := world.Create(simulation.ComLinkState) - simulation.ComLinkState.SetValue(linkEntry, *linkState) + simulation.ComLinkState.Set(linkEntry, linkState) } } @@ -88,7 +88,7 @@ func initLinkState(world ecs.World) { func initTrainState(world ecs.World, trainId string, linkLocation iwayside.LinkLocation, up bool) { train := &state.TrainState{Id: trainId, LinkId: linkLocation.LinkId, LinkOffset: linkLocation.LinkOffset, Up: up} trainEntry := world.Create(simulation.ComTrainState) - simulation.ComTrainState.SetValue(trainEntry, *train) + simulation.ComTrainState.Set(trainEntry, train) } // 构建模型关系