fix multiplayer crash #77

This commit is contained in:
d07riv
2019-08-18 02:45:44 +03:00
parent 91e26bd4fe
commit d922765878
4 changed files with 20 additions and 15 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "diabloweb", "name": "diabloweb",
"version": "1.0.33", "version": "1.0.34",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "diabloweb", "name": "diabloweb",
"version": "1.0.33", "version": "1.0.34",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@babel/core": "7.4.3", "@babel/core": "7.4.3",

View File

@@ -19,7 +19,7 @@ if (process.env.NODE_ENV === 'production') {
} }
function reportLink(e, retail) { function reportLink(e, retail) {
const message = e.stack || e.message || "Unknown error"; const message = (e.message || "Unknown error") + (e.stack ? "\n" + e.stack : "");
const url = new URL("https://github.com/d07RiV/diabloweb/issues/new"); const url = new URL("https://github.com/d07RiV/diabloweb/issues/new");
url.searchParams.set("body", url.searchParams.set("body",
`**Description:** `**Description:**

View File

@@ -287,9 +287,12 @@ function try_api(func) {
function call_api(func, ...params) { function call_api(func, ...params) {
try_api(() => { try_api(() => {
audioBatch = []; const nested = (audioBatch != null);
audioTransfer = []; if (!nested) {
packetBatch = []; audioBatch = [];
audioTransfer = [];
packetBatch = [];
}
if (func !== "text") { if (func !== "text") {
wasm["_" + func](...params); wasm["_" + func](...params);
} else { } else {
@@ -303,16 +306,18 @@ function call_api(func, ...params) {
heap[ptr + length] = 0; heap[ptr + length] = 0;
wasm._DApi_SyncText(params[1]); wasm._DApi_SyncText(params[1]);
} }
if (audioBatch.length) { if (!nested) {
maxSoundId = maxBatchId; if (audioBatch.length) {
worker.postMessage({action: "audioBatch", batch: audioBatch}, audioTransfer); maxSoundId = maxBatchId;
worker.postMessage({action: "audioBatch", batch: audioBatch}, audioTransfer);
}
if (packetBatch.length) {
worker.postMessage({action: "packetBatch", batch: packetBatch}, packetBatch);
}
audioBatch = null;
audioTransfer = null;
packetBatch = null;
} }
if (packetBatch.length) {
worker.postMessage({action: "packetBatch", batch: packetBatch}, packetBatch);
}
audioBatch = null;
audioTransfer = null;
packetBatch = null;
}); });
} }