aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he
diff options
context:
space:
mode:
authorEugene Sandulenko2019-10-25 09:43:58 +0200
committerEugene Sandulenko2019-10-25 12:30:26 +0100
commitccf6960aff98299aad72d43edb5bdc7cf9290859 (patch)
treed9dedf386aa52f979877a94e29e48af0a2f31063 /engines/scumm/he
parenta6273269f151b822c4bbeacd375682343e1f3013 (diff)
downloadscummvm-rg350-ccf6960aff98299aad72d43edb5bdc7cf9290859.tar.gz
scummvm-rg350-ccf6960aff98299aad72d43edb5bdc7cf9290859.tar.bz2
scummvm-rg350-ccf6960aff98299aad72d43edb5bdc7cf9290859.zip
SCUMM HE: Implement joinSession() for Moonbase Commander
Diffstat (limited to 'engines/scumm/he')
-rw-r--r--engines/scumm/he/moonbase/net_main.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/engines/scumm/he/moonbase/net_main.cpp b/engines/scumm/he/moonbase/net_main.cpp
index 96654c35cf..77d0e9c99a 100644
--- a/engines/scumm/he/moonbase/net_main.cpp
+++ b/engines/scumm/he/moonbase/net_main.cpp
@@ -166,9 +166,25 @@ void Net::createSessionErrorCallback(Networking::ErrorResponse error) {
}
int Net::joinSession(int sessionIndex) {
- warning("STUB: Net::joinSession(%d)", sessionIndex); // PN_JoinSession
+ debug(1, "Net::joinSession(%d)", sessionIndex); // PN_JoinSession
+
+ if (!_sessions) {
+ warning("Net::joinSession(): no sessions");
+ return 0;
+ }
+
+ if (sessionIndex >= _sessions->countChildren()) {
+ warning("Net::joinSession(): session number too big: %d >= %lu", sessionIndex, _sessions->countChildren());
+ return 0;
+ }
+
+ if (!_sessions->child(sessionIndex)->hasChild("sessionid")) {
+ warning("Net::joinSession(): no sessionid in session");
+ return 0;
+ }
+
+ _sessionid = _sessions->child(sessionIndex)->child("sessionid")->asIntegerNumber();
- // FAKE successful join. FIXME
return 1;
}
@@ -376,17 +392,17 @@ int Net::getSessionPlayerCount(int sessionNumber) {
debug(1, "Net::getSessionPlayerCount(%d)", sessionNumber); // case GET_SESSION_PLAYER_COUNT_KLUDGE:
if (!_sessions) {
- warning("Net::getSessionName(): no sessions");
+ warning("Net::getSessionPlayerCount(): no sessions");
return 0;
}
if (sessionNumber >= _sessions->countChildren()) {
- warning("Net::getSessionName(): session number too big: %d >= %lu", sessionNumber, _sessions->countChildren());
+ warning("Net::getSessionPlayerCount(): session number too big: %d >= %lu", sessionNumber, _sessions->countChildren());
return 0;
}
if (!_sessions->child(sessionNumber)->hasChild("players")) {
- warning("Net::getSessionName(): no players in session");
+ warning("Net::getSessionPlayerCount(): no players in session");
return 0;
}