1
0
Fork 0

Nasal/multiplayer.nas: always enable multiplayer menu items when replaying.

This fixes bug 2731, where MP menu items were greyed out if we are not
connected to MP server, even if we are replaying a recording with MP aircraft.
This commit is contained in:
Julian Smith 2022-04-22 00:25:36 +01:00
parent e4f578a842
commit e0070501e6

View file

@ -625,10 +625,15 @@ var model = {
};
var mp_mode_changed = func(n) {
var is_online = n.getBoolValue();
foreach (var menuitem;["mp-chat","mp-chat-menu","mp-list","mp-carrier"])
var is_online = getprop("/sim/multiplay/online");
var is_replaying = getprop("/sim/replay/replay-state");
# Always activate multiplayer items if we are replaying, in case the
# recording contains MP info.
#
foreach (var menuitem; ["mp-chat","mp-chat-menu","mp-list","mp-carrier"])
{
gui.menuEnable(menuitem, is_online);
gui.menuEnable(menuitem, is_online or is_replaying);
}
if (is_online) {
@ -684,6 +689,8 @@ var mp_mode_changed = func(n) {
model.init();
setlistener("/sim/multiplay/online", mp_mode_changed, 1, 1);
setlistener("/sim/replay/replay-state", mp_mode_changed, 1, 1);
# Call-back to ensure we see our own messages.
setlistener("/sim/multiplay/chat", chat_listener);