aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2019-11-05 00:21:24 +0100
committerEugene Sandulenko2019-11-05 00:31:46 +0100
commit77ee206cd7fc5cf98861a3aa1a579e40ad3c872d (patch)
tree8d7a1c3a8ccea255aebc79b66cc749889ecb93e5 /engines
parent5268e582bf68aef3089a23de88e793f4d3292144 (diff)
downloadscummvm-rg350-77ee206cd7fc5cf98861a3aa1a579e40ad3c872d.tar.gz
scummvm-rg350-77ee206cd7fc5cf98861a3aa1a579e40ad3c872d.tar.bz2
scummvm-rg350-77ee206cd7fc5cf98861a3aa1a579e40ad3c872d.zip
SCUMM HE: MBC: Implement Net::disableSessionJoining()
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/he/moonbase/net_main.cpp22
-rw-r--r--engines/scumm/he/moonbase/net_main.h3
2 files changed, 24 insertions, 1 deletions
diff --git a/engines/scumm/he/moonbase/net_main.cpp b/engines/scumm/he/moonbase/net_main.cpp
index f93f018ef8..4645f30c70 100644
--- a/engines/scumm/he/moonbase/net_main.cpp
+++ b/engines/scumm/he/moonbase/net_main.cpp
@@ -228,7 +228,27 @@ void Net::endSessionErrorCallback(Networking::ErrorResponse error) {
void Net::disableSessionJoining() {
- warning("STUB: Net::disableSessionJoining()"); // PN_DisableSessionPlayerJoin
+ debug(1, "Net::disableSessionJoining()"); // PN_DisableSessionPlayerJoin
+
+ Networking::PostRequest *rq = new Networking::PostRequest(_serverprefix + "/disablesession",
+ new Common::Callback<Net, Common::JSONValue *>(this, &Net::disableSessionJoiningCallback),
+ new Common::Callback<Net, Networking::ErrorResponse>(this, &Net::disableSessionJoiningErrorCallback));
+
+ char *buf = (char *)malloc(MAX_PACKET_SIZE);
+ snprintf(buf, MAX_PACKET_SIZE, "{\"sessionid\":%d}", _sessionid);
+ rq->setPostData((byte *)buf, strlen(buf));
+ rq->setContentType("application/json");
+
+ rq->start();
+
+ ConnMan.addRequest(rq);
+}
+
+void Net::disableSessionJoiningCallback(Common::JSONValue *response) {
+}
+
+void Net::disableSessionJoiningErrorCallback(Networking::ErrorResponse error) {
+ warning("Error in disableSessionJoining(): %ld %s", error.httpResponseCode, error.response.c_str());
}
void Net::enableSessionJoining() {
diff --git a/engines/scumm/he/moonbase/net_main.h b/engines/scumm/he/moonbase/net_main.h
index c23a0b0c0c..31dba6730f 100644
--- a/engines/scumm/he/moonbase/net_main.h
+++ b/engines/scumm/he/moonbase/net_main.h
@@ -78,6 +78,9 @@ private:
void addUserCallback(Common::JSONValue *response);
void addUserErrorCallback(Networking::ErrorResponse error);
+ void disableSessionJoiningCallback(Common::JSONValue *response);
+ void disableSessionJoiningErrorCallback(Networking::ErrorResponse error);
+
void endSessionCallback(Common::JSONValue *response);
void endSessionErrorCallback(Networking::ErrorResponse error);