1
0
Fork 0

Multiplayer Dialog fixes.

Change to use the ports defined in the property tree when connecting from the dialog.
Ensure properties for ports are set to a valid (non zero, not null) value on dialog initialisation.
Add ability to change receive port from dialog firstly to see what it is and secondly to allow multiple fg sessions
This commit is contained in:
Richard Harrison 2017-05-14 17:48:03 +02:00
parent ec496ed045
commit 52884c7f12

View file

@ -22,6 +22,12 @@
} }
} }
} }
if (getprop("/sim/multiplay/rxport") == nil or getprop("/sim/multiplay/rxport") == 0)
setprop("/sim/multiplay/rxport",5000);
if (getprop("/sim/multiplay/txport") == nil or getprop("/sim/multiplay/txport") == 0)
setprop("/sim/multiplay/txport",5000);
if (getprop("/sim/multiplay/protocol-version") == 2) if (getprop("/sim/multiplay/protocol-version") == 2)
setprop("/sim/gui/dialogs/multiplay/protocol-version", "Visible to only 2017+"); setprop("/sim/gui/dialogs/multiplay/protocol-version", "Visible to only 2017+");
else else
@ -229,7 +235,26 @@
<properties>/sim/gui/dialogs/multiplay/servers</properties> <properties>/sim/gui/dialogs/multiplay/servers</properties>
</combo> </combo>
<group>
<layout>hbox</layout>
<row>3</row>
<col>1</col>
<text>
<width>2</width>
<halign>right</halign>
<label>rxPort</label>
</text>
<input>
<pref-width>50</pref-width>
<halign>left</halign>
<property>/sim/multiplay/rxport</property>
<enable>
<not>
<property>/sim/multiplay/online</property>
</not>
</enable>
</input>
</group>
<!-- status area --> <!-- status area -->
<text> <text>
<visible> <visible>
@ -276,11 +301,11 @@
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
fgcommand("multiplayer-connect", props.Node.new({ fgcommand("multiplayer-connect", props.Node.new({
"servername": getprop("/sim/multiplay/selected-server"), "servername": getprop("/sim/multiplay/selected-server"),
"rxport": 5000, "rxport": getprop("/sim/multiplay/rxport"),
"txport": 5000 "txport": getprop("/sim/multiplay/txport")
})); }));
</script> </script>
</binding> </binding>
</button> </button>