Split server/client port setting to avoid port number clashes in mainmenu
This commit is contained in:
parent
150c8bb108
commit
d79c9afa5b
|
@ -421,6 +421,7 @@ function tabbuilder.handle_multiplayer_buttons(fields)
|
||||||
if fields["favourites"] ~= nil then
|
if fields["favourites"] ~= nil then
|
||||||
local event = explode_textlist_event(fields["favourites"])
|
local event = explode_textlist_event(fields["favourites"])
|
||||||
if event.typ == "DCL" then
|
if event.typ == "DCL" then
|
||||||
|
if event.index <= #menu.favorites then
|
||||||
gamedata.address = menu.favorites[event.index].address
|
gamedata.address = menu.favorites[event.index].address
|
||||||
gamedata.port = menu.favorites[event.index].port
|
gamedata.port = menu.favorites[event.index].port
|
||||||
gamedata.playername = fields["te_name"]
|
gamedata.playername = fields["te_name"]
|
||||||
|
@ -436,23 +437,27 @@ function tabbuilder.handle_multiplayer_buttons(fields)
|
||||||
|
|
||||||
if gamedata.address ~= nil and
|
if gamedata.address ~= nil and
|
||||||
gamedata.port ~= nil then
|
gamedata.port ~= nil then
|
||||||
|
engine.setting_set("address",gamedata.address)
|
||||||
|
engine.setting_set("remote_port",gamedata.port)
|
||||||
engine.start()
|
engine.start()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if event.typ == "CHG" then
|
if event.typ == "CHG" then
|
||||||
|
if event.index <= #menu.favorites then
|
||||||
local address = menu.favorites[event.index].address
|
local address = menu.favorites[event.index].address
|
||||||
local port = menu.favorites[event.index].port
|
local port = menu.favorites[event.index].port
|
||||||
|
|
||||||
if address ~= nil and
|
if address ~= nil and
|
||||||
port ~= nil then
|
port ~= nil then
|
||||||
engine.setting_set("address",address)
|
engine.setting_set("address",address)
|
||||||
engine.setting_set("port",port)
|
engine.setting_set("remote_port",port)
|
||||||
end
|
end
|
||||||
|
|
||||||
menu.fav_selected = event.index
|
menu.fav_selected = event.index
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -473,7 +478,7 @@ function tabbuilder.handle_multiplayer_buttons(fields)
|
||||||
if address ~= nil and
|
if address ~= nil and
|
||||||
port ~= nil then
|
port ~= nil then
|
||||||
engine.setting_set("address",address)
|
engine.setting_set("address",address)
|
||||||
engine.setting_set("port",port)
|
engine.setting_set("remote_port",port)
|
||||||
end
|
end
|
||||||
|
|
||||||
menu.fav_selected = fav_idx
|
menu.fav_selected = fav_idx
|
||||||
|
@ -499,13 +504,13 @@ function tabbuilder.handle_multiplayer_buttons(fields)
|
||||||
menu.fav_selected = nil
|
menu.fav_selected = nil
|
||||||
|
|
||||||
engine.setting_set("address","")
|
engine.setting_set("address","")
|
||||||
engine.setting_get("port","")
|
engine.setting_set("remote_port","30000")
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields["btn_mp_connect"] ~= nil or
|
if fields["btn_mp_connect"] ~= nil or
|
||||||
fields["key_enter"] then
|
fields["key_enter"] ~= nil then
|
||||||
|
|
||||||
gamedata.playername = fields["te_name"]
|
gamedata.playername = fields["te_name"]
|
||||||
gamedata.password = fields["te_pwd"]
|
gamedata.password = fields["te_pwd"]
|
||||||
|
@ -527,6 +532,9 @@ function tabbuilder.handle_multiplayer_buttons(fields)
|
||||||
|
|
||||||
gamedata.selected_world = 0
|
gamedata.selected_world = 0
|
||||||
|
|
||||||
|
engine.setting_set("address",fields["te_address"])
|
||||||
|
engine.setting_set("remote_port",fields["te_port"])
|
||||||
|
|
||||||
engine.start()
|
engine.start()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -574,6 +582,7 @@ function tabbuilder.handle_server_buttons(fields)
|
||||||
gamedata.address = ""
|
gamedata.address = ""
|
||||||
gamedata.selected_world = filterlist.get_raw_index(worldlist,selected)
|
gamedata.selected_world = filterlist.get_raw_index(worldlist,selected)
|
||||||
|
|
||||||
|
engine.setting_set("port",gamedata.port)
|
||||||
menu.update_last_game(gamedata.selected_world)
|
menu.update_last_game(gamedata.selected_world)
|
||||||
engine.start()
|
engine.start()
|
||||||
end
|
end
|
||||||
|
@ -820,7 +829,7 @@ function tabbuilder.tab_multiplayer()
|
||||||
"label[1,4.25;".. fgettext("Address/Port") .. "]"..
|
"label[1,4.25;".. fgettext("Address/Port") .. "]"..
|
||||||
"label[9,2.75;".. fgettext("Name/Password") .. "]" ..
|
"label[9,2.75;".. fgettext("Name/Password") .. "]" ..
|
||||||
"field[1.25,5.25;5.5,0.5;te_address;;" ..engine.setting_get("address") .."]" ..
|
"field[1.25,5.25;5.5,0.5;te_address;;" ..engine.setting_get("address") .."]" ..
|
||||||
"field[6.75,5.25;2.25,0.5;te_port;;" ..engine.setting_get("port") .."]" ..
|
"field[6.75,5.25;2.25,0.5;te_port;;" ..engine.setting_get("remote_port") .."]" ..
|
||||||
"checkbox[1,3.6;cb_public_serverlist;".. fgettext("Public Serverlist") .. ";" ..
|
"checkbox[1,3.6;cb_public_serverlist;".. fgettext("Public Serverlist") .. ";" ..
|
||||||
dump(engine.setting_getbool("public_serverlist")) .. "]"
|
dump(engine.setting_getbool("public_serverlist")) .. "]"
|
||||||
|
|
||||||
|
@ -886,7 +895,8 @@ function tabbuilder.tab_server()
|
||||||
"field[0.8,3.2;3,0.5;te_playername;".. fgettext("Name") .. ";" ..
|
"field[0.8,3.2;3,0.5;te_playername;".. fgettext("Name") .. ";" ..
|
||||||
engine.setting_get("name") .. "]" ..
|
engine.setting_get("name") .. "]" ..
|
||||||
"pwdfield[0.8,4.2;3,0.5;te_passwd;".. fgettext("Password") .. "]" ..
|
"pwdfield[0.8,4.2;3,0.5;te_passwd;".. fgettext("Password") .. "]" ..
|
||||||
"field[0.8,5.2;3,0.5;te_serverport;".. fgettext("Server Port") .. ";30000]" ..
|
"field[0.8,5.2;3,0.5;te_serverport;".. fgettext("Server Port") .. ";" ..
|
||||||
|
engine.setting_get("port") .."]" ..
|
||||||
"textlist[4,0.25;7.5,3.7;srv_worlds;" ..
|
"textlist[4,0.25;7.5,3.7;srv_worlds;" ..
|
||||||
menu.render_world_list() ..
|
menu.render_world_list() ..
|
||||||
";" .. index .. "]"
|
";" .. index .. "]"
|
||||||
|
|
Loading…
Reference in New Issue