1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2024-11-14 21:15:58 +00:00

Net: Fix off-by-one in number of players allowed to connect (was 3, now 2; Godot does not include the 'server'.)

This commit is contained in:
John 2021-12-06 12:57:06 -06:00
parent dbd7e0392c
commit d8c5d0548f

View File

@ -62,8 +62,8 @@ func send(id, mail, mail_type = REPLY):
# Host
# start_host: Host the game
# port: TCP port
# max_players: Largest number of players allowed to connect at a time
func start_host(port = DEFAULT_PORT, max_players = 2):
# max_players: Largest number of players allowed to connect at a time (the host does not count)
func start_host(port = DEFAULT_PORT, max_players = 1):
get_hostname()
peer_info[1] = local_info
# Notify that peer list has updated
@ -150,16 +150,10 @@ func _ready():
func _peer_connected(id):
# Send peer info to remote peer
rpc_id(id, "register_peer", local_info)
if hosting and peer_info.size() >= 2:
pass
pass
func _peer_disconnected(id):
# Unregister the peer locally
unregister_peer(id)
if hosting and peer_info.size() < 2:
pass
pass
func _host_connected():