idz: Add field "c" to story cell tuple

This commit is contained in:
BemaniWitch
2021-02-03 23:43:41 +00:00
committed by Tau
parent dcb4f12a99
commit 1154414885
6 changed files with 48 additions and 4 deletions
+2 -1
View File
@@ -19,7 +19,8 @@ export function saveProfile2(buf: Buffer): SaveProfileRequest {
for (let j = 0; j < 9; j++) {
const a = buf.readUInt32LE(rowOffset + 0x04 + j * 4);
const b = buf.readUInt16LE(rowOffset + 0x28 + j * 2);
const cell = { a, b };
const c = 0; // Added in idz2
const cell = { a, b, c };
cells.set(j, cell);
}
+2 -1
View File
@@ -21,7 +21,8 @@ export function saveProfile3(buf: Buffer): SaveProfileRequest {
for (let j = 0; j < 9; j++) {
const a = buf.readUInt8(rowOffset + 0x00 + j);
const b = buf.readUInt8(rowOffset + 0x09 + j);
const cell = { a, b };
const c = 0; // Added in idz2
const cell = { a, b, c };
cells.set(j, cell);
}
+1
View File
@@ -1,6 +1,7 @@
export interface StoryCell {
a: number;
b: number;
c: number;
}
export interface StoryRow {
+5 -2
View File
@@ -18,7 +18,7 @@ function cellChanged(
return true;
}
return lhs.a !== rhs.a || lhs.b !== rhs.b;
return lhs.a !== rhs.a || lhs.b !== rhs.b || lhs.c !== rhs.c;
}
export class SqlStoryRepository implements FacetRepository<Story> {
@@ -63,6 +63,7 @@ export class SqlStoryRepository implements FacetRepository<Story> {
gridRow.cells.set(colNo, {
a: 0,
b: 0,
c: 0,
});
}
@@ -70,6 +71,7 @@ export class SqlStoryRepository implements FacetRepository<Story> {
cell.a = parseInt(row.a!);
cell.b = parseInt(row.b!);
cell.c = parseInt(row.c!);
}
return result;
@@ -109,9 +111,10 @@ export class SqlStoryRepository implements FacetRepository<Story> {
col_no: j,
a: cell.a,
b: cell.b,
c: cell.c,
})
.onConflict("profile_id", "row_no", "col_no")
.doUpdate(["a", "b"]);
.doUpdate(["a", "b", "c"]);
await this._txn.modify(cellSql);
}