Commit 22eceb68 authored by nanahira's avatar nanahira

fix deck encode

parent 3f310cb0
Pipeline #28806 passed with stages
in 26 minutes and 15 seconds
......@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeDeck = exports.encodeDeck = void 0;
const assert_1 = __importDefault(require("assert"));
function encodeDeck(deck) {
deck.main ??= [];
deck.side ??= [];
let pointer = 0;
const bufferSize = (2 + deck.main.length + deck.side.length) * 4;
const buffer = Buffer.allocUnsafe(bufferSize);
......
......@@ -6,6 +6,8 @@ export interface Deck {
}
export function encodeDeck(deck: Deck) {
deck.main ??= [];
deck.side ??= [];
let pointer = 0;
const bufferSize = (2 + deck.main.length + deck.side.length) * 4;
const buffer = Buffer.allocUnsafe(bufferSize);
......@@ -40,4 +42,4 @@ export function decodeDeck(buffer: Buffer): Deck {
pointer += 4;
}
return {main, side};
}
\ No newline at end of file
}
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