diff options
-rw-r--r-- | engines/scumm/he/moonbase/net_main.cpp | 27 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/net_main.h | 1 |
2 files changed, 23 insertions, 5 deletions
diff --git a/engines/scumm/he/moonbase/net_main.cpp b/engines/scumm/he/moonbase/net_main.cpp index 80e2f6f160..fe2fae1081 100644 --- a/engines/scumm/he/moonbase/net_main.cpp +++ b/engines/scumm/he/moonbase/net_main.cpp @@ -32,6 +32,8 @@ Net::Net(ScummEngine_v100he *vm) : _latencyTime(1), _fakeLatency(false), _vm(vm) _packbuffer = (byte *)malloc(MAX_PACKET_SIZE + 12); _tmpbuffer = (byte *)malloc(MAX_PACKET_SIZE); + + _myUserId = -1; } Net::~Net() { @@ -40,10 +42,21 @@ Net::~Net() { } int Net::hostGame(char *sessionName, char *userName) { - warning("STUB: op_net_host_tcpip_game(\"%s\", \"%s\")", sessionName, userName); // PN_HostTCPIPGame + if (createSession(sessionName)) { + if (addUser(userName, userName)) { + return 1; + } else { + _vm->displayMessage(0, "Error Adding User \"%s\" to Session \"%s\"", userName, sessionName); + endSession(); + closeProvider(); + } + } else { + _vm->displayMessage(0, "Error creating session \"%s\"", userName ); + + closeProvider(); + } - // FAKE successful game creation. FIXME - return 1; + return 0; } int Net::joinGame(char *IP, char *userName) { @@ -54,6 +67,8 @@ int Net::joinGame(char *IP, char *userName) { int Net::addUser(char *shortName, char *longName) { warning("STUB: Net::addUser(\"%s\", \"%s\")", shortName, longName); // PN_AddUser + _myUserId = _vm->_rnd.getRandomNumber(1000000); + // FAKE successful add. FIXME return 1; } @@ -70,12 +85,14 @@ int Net::whoSentThis() { int Net::whoAmI() { warning("STUB: Net::whoAmI()"); // PN_WhoAmI - return 0; + return _myUserId; } int Net::createSession(char *name) { warning("STUB: Net::createSession(\"%s\")", name); // PN_CreateSession - return 0; + + // FAKE session creation. FIXME + return 1; } int Net::joinSession(int sessionIndex) { diff --git a/engines/scumm/he/moonbase/net_main.h b/engines/scumm/he/moonbase/net_main.h index 7fbae3417c..00ec6cafe0 100644 --- a/engines/scumm/he/moonbase/net_main.h +++ b/engines/scumm/he/moonbase/net_main.h @@ -86,6 +86,7 @@ public: byte *_packbuffer; byte *_tmpbuffer; + int _myUserId; }; } // End of namespace Scumm |