Commit 74add160 authored by nanahira's avatar nanahira

fix

parent 008e7d0f
Pipeline #43166 passed with stages
in 1 minute and 56 seconds
...@@ -32,7 +32,7 @@ import { OcgcoreWorkerOptions } from './ocgcore-worker-options'; ...@@ -32,7 +32,7 @@ import { OcgcoreWorkerOptions } from './ocgcore-worker-options';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { calculateDuelOptions } from '../utility/calculate-duel-options'; import { calculateDuelOptions } from '../utility/calculate-duel-options';
import initSqlJs from 'sql.js'; import initSqlJs from 'sql.js';
import { YGOProMessages, CardQuery, OcgcoreCommonConstants } from 'ygopro-msg-encode'; import { YGOProMessages, OcgcoreCommonConstants } from 'ygopro-msg-encode';
const { OcgcoreScriptConstants } = _OcgcoreConstants; const { OcgcoreScriptConstants } = _OcgcoreConstants;
...@@ -333,22 +333,11 @@ export class OcgcoreWorker { ...@@ -333,22 +333,11 @@ export class OcgcoreWorker {
})), })),
) )
async advance(): Promise<OcgcoreProcessResult[]> { async advance(): Promise<OcgcoreProcessResult[]> {
// Re-implement advance loop here (no advancor state), and use noParse process.
// Stop when:
// - status === 2 (need response / halted)
// - MSG_RETRY is emitted (also indicates need response)
const results: OcgcoreProcessResult[] = []; const results: OcgcoreProcessResult[] = [];
while (true) { while (true) {
const res = this.duel.process({ noParse: true }); const res = this.duel.process({ noParse: true });
results.push(res); results.push(res);
if (res.status > 0) {
const msgId = res.raw.length > 0 ? res.raw[0] : undefined;
if (res.status === 2 || msgId === OcgcoreCommonConstants.MSG_RETRY) {
break;
}
// status === 0 means no more messages for now
if (res.status === 0) {
break; break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment