aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorEugene Sandulenko2019-11-05 14:19:13 +0100
committerEugene Sandulenko2019-11-05 16:38:25 +0100
commit11a72ca928e1294c2dd23bd0ed0a675094f0fd8d (patch)
tree6a27a7471ad8a56d26172f26f02c6dd5a9ee7457 /engines/scumm
parent4810a5d8d35c5caa79f9a3a1e93d882de32b2d87 (diff)
downloadscummvm-rg350-11a72ca928e1294c2dd23bd0ed0a675094f0fd8d.tar.gz
scummvm-rg350-11a72ca928e1294c2dd23bd0ed0a675094f0fd8d.tar.bz2
scummvm-rg350-11a72ca928e1294c2dd23bd0ed0a675094f0fd8d.zip
SCUMM HE: MBC: Implement Net::destroyPlayer()
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/he/moonbase/net_main.cpp25
-rw-r--r--engines/scumm/he/moonbase/net_main.h3
2 files changed, 26 insertions, 2 deletions
diff --git a/engines/scumm/he/moonbase/net_main.cpp b/engines/scumm/he/moonbase/net_main.cpp
index c46746a580..0412b0bd95 100644
--- a/engines/scumm/he/moonbase/net_main.cpp
+++ b/engines/scumm/he/moonbase/net_main.cpp
@@ -284,8 +284,29 @@ void Net::setFakeLatency(int time) {
bool Net::destroyPlayer(int32 playerDPID) {
// bool PNETWIN_destroyplayer(DPID idPlayer)
- warning("STUB: Net::destroyPlayer(%d)", playerDPID);
- return false;
+ debug(1, "Net::destroyPlayer(%d)", playerDPID);
+
+ Networking::PostRequest *rq = new Networking::PostRequest(_serverprefix + "/removeuser",
+ new Common::Callback<Net, Common::JSONValue *>(this, &Net::destroyPlayerCallback),
+ new Common::Callback<Net, Networking::ErrorResponse>(this, &Net::destroyPlayerErrorCallback));
+
+ char *buf = (char *)malloc(MAX_PACKET_SIZE);
+ snprintf(buf, MAX_PACKET_SIZE, "{\"sessionid\":%d, \"userid\":%d}", _sessionid, playerDPID);
+ rq->setPostData((byte *)buf, strlen(buf));
+ rq->setContentType("application/json");
+
+ rq->start();
+
+ ConnMan.addRequest(rq);
+
+ return true;
+}
+
+void Net::destroyPlayerCallback(Common::JSONValue *response) {
+}
+
+void Net::destroyPlayerErrorCallback(Networking::ErrorResponse error) {
+ warning("Error in destroyPlayer(): %ld %s", error.httpResponseCode, error.response.c_str());
}
int32 Net::startQuerySessions() {
diff --git a/engines/scumm/he/moonbase/net_main.h b/engines/scumm/he/moonbase/net_main.h
index 31dba6730f..093cd0fdbf 100644
--- a/engines/scumm/he/moonbase/net_main.h
+++ b/engines/scumm/he/moonbase/net_main.h
@@ -84,6 +84,9 @@ private:
void endSessionCallback(Common::JSONValue *response);
void endSessionErrorCallback(Networking::ErrorResponse error);
+ void destroyPlayerCallback(Common::JSONValue *response);
+ void destroyPlayerErrorCallback(Networking::ErrorResponse error);
+
void remoteSendDataCallback(Common::JSONValue *response);
void remoteSendDataErrorCallback(Networking::ErrorResponse error);