1
0
forked from 0ad/0ad
0ad/binaries/data/mods/public/gui/common/network.js
Ykkrosh 31699e830d Handle disconnections better.
Remove local sessions (just use ENet for everything instead) because
they add far too much complexity.
Fix memory leaks.

This was SVN commit r7706.
2010-07-06 19:54:17 +00:00

20 lines
492 B
JavaScript

function getDisconnectReason(id)
{
// Must be kept in sync with source/network/NetHost.h
switch (id)
{
case 0: return "Unknown reason";
case 1: return "Unexpected shutdown";
case 2: return "Incorrect network protocol version";
case 3: return "Game has already started";
default: return "[Invalid value "+id+"]";
}
}
function reportDisconnect(reason)
{
messageBox(400, 200,
"Lost connection to the server.\n\nReason: " + getDisconnectReason(reason) + ".",
"Disconnected", 2);
}