37
37
)
38
38
39
39
type NewSimConfiguration struct {
40
- sim.NewSimConfiguration
40
+ server.NewSimConfiguration
41
+
42
+ TRACON map [string ]* server.Configuration
43
+
44
+ DisplayError error
41
45
42
- // Local use only; not sent to the server when we create one.
43
46
lastRemoteSimsUpdate time.Time
44
47
updateRemoteSimsCall * util.PendingCall
45
48
@@ -57,7 +60,7 @@ func MakeNewSimConfiguration(mgr *server.ConnectionManager, defaultTRACON *strin
57
60
selectedServer : mgr .LocalServer ,
58
61
defaultTRACON : defaultTRACON ,
59
62
tfrCache : tfrCache ,
60
- NewSimConfiguration : sim .MakeNewSimConfiguration (),
63
+ NewSimConfiguration : server .MakeNewSimConfiguration (),
61
64
}
62
65
63
66
c .SetTRACON (* defaultTRACON )
@@ -110,7 +113,7 @@ func (c *NewSimConfiguration) SetTRACON(name string) {
110
113
111
114
func (c * NewSimConfiguration ) SetScenario (groupName , scenarioName string ) {
112
115
var ok bool
113
- var groupConfig * sim .Configuration
116
+ var groupConfig * server .Configuration
114
117
if groupConfig , ok = c .TRACON [groupName ]; ! ok {
115
118
c .lg .Errorf ("%s: group not found in TRACON %s" , groupName , c .TRACONName )
116
119
groupName = util .SortedMapKeys (c .TRACON )[0 ]
@@ -129,11 +132,11 @@ func (c *NewSimConfiguration) SetScenario(groupName, scenarioName string) {
129
132
}
130
133
131
134
func (c * NewSimConfiguration ) UIButtonText () string {
132
- return util .Select (c .NewSimType == sim .NewSimJoinRemote , "Join" , "Next" )
135
+ return util .Select (c .NewSimType == server .NewSimJoinRemote , "Join" , "Next" )
133
136
}
134
137
135
138
func (c * NewSimConfiguration ) ShowRatesWindow () bool {
136
- return c .NewSimType == sim .NewSimCreateLocal || c .NewSimType == sim .NewSimCreateRemote
139
+ return c .NewSimType == server .NewSimCreateLocal || c .NewSimType == server .NewSimCreateRemote
137
140
}
138
141
139
142
func (c * NewSimConfiguration ) DrawUI (p platform.Platform ) bool {
@@ -164,8 +167,8 @@ func (c *NewSimConfiguration) DrawUI(p platform.Platform) bool {
164
167
origType := c .NewSimType
165
168
166
169
imgui .TableNextColumn ()
167
- if imgui .RadioButtonInt ("Create single-controller" , & c .NewSimType , sim .NewSimCreateLocal ) &&
168
- origType != sim .NewSimCreateLocal {
170
+ if imgui .RadioButtonInt ("Create single-controller" , & c .NewSimType , server .NewSimCreateLocal ) &&
171
+ origType != server .NewSimCreateLocal {
169
172
c .selectedServer = c .mgr .LocalServer
170
173
c .SetTRACON (* c .defaultTRACON )
171
174
c .DisplayError = nil
@@ -174,8 +177,8 @@ func (c *NewSimConfiguration) DrawUI(p platform.Platform) bool {
174
177
imgui .TableNextRow ()
175
178
imgui .TableNextColumn ()
176
179
imgui .TableNextColumn ()
177
- if imgui .RadioButtonInt ("Create multi-controller" , & c .NewSimType , sim .NewSimCreateRemote ) &&
178
- origType != sim .NewSimCreateRemote {
180
+ if imgui .RadioButtonInt ("Create multi-controller" , & c .NewSimType , server .NewSimCreateRemote ) &&
181
+ origType != server .NewSimCreateRemote {
179
182
c .selectedServer = c .mgr .RemoteServer
180
183
c .SetTRACON (* c .defaultTRACON )
181
184
c .DisplayError = nil
@@ -186,8 +189,8 @@ func (c *NewSimConfiguration) DrawUI(p platform.Platform) bool {
186
189
imgui .TableNextColumn ()
187
190
188
191
uiStartDisable (len (c .mgr .RemoteServer .GetRunningSims ()) == 0 )
189
- if imgui .RadioButtonInt ("Join multi-controller" , & c .NewSimType , sim .NewSimJoinRemote ) &&
190
- origType != sim .NewSimJoinRemote {
192
+ if imgui .RadioButtonInt ("Join multi-controller" , & c .NewSimType , server .NewSimJoinRemote ) &&
193
+ origType != server .NewSimJoinRemote {
191
194
c .selectedServer = c .mgr .RemoteServer
192
195
c .DisplayError = nil
193
196
}
@@ -200,11 +203,11 @@ func (c *NewSimConfiguration) DrawUI(p platform.Platform) bool {
200
203
imgui .Text ("Unable to connect to the multi-controller vice server; " +
201
204
"only single-player scenarios are available." )
202
205
imgui .PopStyleColor ()
203
- c .NewSimType = sim .NewSimCreateLocal
206
+ c .NewSimType = server .NewSimCreateLocal
204
207
}
205
208
imgui .Separator ()
206
209
207
- if c .NewSimType == sim .NewSimCreateLocal || c .NewSimType == sim .NewSimCreateRemote {
210
+ if c .NewSimType == server .NewSimCreateLocal || c .NewSimType == server .NewSimCreateRemote {
208
211
flags := imgui .TableFlagsBordersV | imgui .TableFlagsBordersOuterH | imgui .TableFlagsRowBg |
209
212
imgui .TableFlagsSizingStretchProp
210
213
tableScale := util .Select (runtime .GOOS == "windows" , p .DPIScale (), float32 (1 ))
@@ -291,7 +294,7 @@ func (c *NewSimConfiguration) DrawUI(p platform.Platform) bool {
291
294
}
292
295
293
296
if imgui .BeginTableV ("scenario" , 2 , 0 , imgui.Vec2 {tableScale * 500 , 0 }, 0. ) {
294
- if c .NewSimType == sim .NewSimCreateRemote {
297
+ if c .NewSimType == server .NewSimCreateRemote {
295
298
imgui .TableNextRow ()
296
299
imgui .TableNextColumn ()
297
300
imgui .Text ("Name:" )
@@ -342,7 +345,7 @@ func (c *NewSimConfiguration) DrawUI(p platform.Platform) bool {
342
345
}
343
346
uiEndDisable (! validAirport )
344
347
345
- if c .NewSimType == sim .NewSimCreateRemote {
348
+ if c .NewSimType == server .NewSimCreateRemote {
346
349
imgui .Checkbox ("Require Password" , & c .RequirePassword )
347
350
if c .RequirePassword {
348
351
imgui .InputTextV ("Password" , & c .Password , 0 , nil )
@@ -585,7 +588,7 @@ func refreshWeather() {
585
588
}
586
589
587
590
func (c * NewSimConfiguration ) OkDisabled () bool {
588
- return c .NewSimType == sim .NewSimCreateRemote && (c .NewSimName == "" || (c .RequirePassword && c .Password == "" ))
591
+ return c .NewSimType == server .NewSimCreateRemote && (c .NewSimName == "" || (c .RequirePassword && c .Password == "" ))
589
592
}
590
593
591
594
func (c * NewSimConfiguration ) Start () error {
@@ -993,7 +996,7 @@ func (lc *LaunchControlWindow) Draw(eventStream *sim.EventStream, p platform.Pla
993
996
// imgui.SetCursorPos(imgui.Vec2{imgui.CursorPosX() + imgui.ContentRegionAvail().X - float32(3*width+10),
994
997
imgui .SetCursorPos (imgui.Vec2 {imgui .WindowWidth () - float32 (7 * width ), imgui .CursorPosY ()})
995
998
if lc .controlClient != nil && lc .controlClient .Connected () {
996
- if lc .controlClient .SimIsPaused {
999
+ if lc .controlClient .State . Paused {
997
1000
if imgui .Button (renderer .FontAwesomeIconPlayCircle ) {
998
1001
lc .controlClient .ToggleSimPause ()
999
1002
}
0 commit comments