bindings: SaveGame keeps its graphics.dat #451

Closed
opened 2026-10-31 09:31:33 +01:00 by jqueuniet · 1 comment
Owner

SaveGame's constructor takes a GraphicsArchive only to check the byte-exact rebuild, then drops it. So inventory, container, createItem, previewItem, putInContainer, takeFromContainer and toBytes take it again, and fromJson takes the dungeon alone.

Nothing checks the archive passed later: a DOS EN save takes the Mac US graphics.dat in inventory and toBytes without error. Output is identical for that pair, but not guaranteed for a beta or another language build.

Proposal

SaveGame keeps the DungeonFile and GraphicsArchive it was built with (shared handles); the methods drop their graphics parameter; fromJson(json, dungeon, graphics) takes both.

Acceptance

  • No SaveGame method takes a GraphicsArchive after construction.
  • A save cannot be read or encoded against a different archive than its own.

Breaking: before the next release.

`SaveGame`'s constructor takes a `GraphicsArchive` only to check the byte-exact rebuild, then drops it. So `inventory`, `container`, `createItem`, `previewItem`, `putInContainer`, `takeFromContainer` and `toBytes` take it again, and `fromJson` takes the dungeon alone. Nothing checks the archive passed later: a DOS EN save takes the Mac US `graphics.dat` in `inventory` and `toBytes` without error. Output is identical for that pair, but not guaranteed for a beta or another language build. ## Proposal `SaveGame` keeps the `DungeonFile` and `GraphicsArchive` it was built with (shared handles); the methods drop their `graphics` parameter; `fromJson(json, dungeon, graphics)` takes both. ## Acceptance - No `SaveGame` method takes a `GraphicsArchive` after construction. - A save cannot be read or encoded against a different archive than its own. Breaking: before the next release.
Author
Owner

Deviation in #457: SaveGame keeps the GraphicsArchive (shared), but not the DungeonFile. Only the dungeon's map info is used after construction, so that is all it keeps.

https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7

Deviation in #457: `SaveGame` keeps the `GraphicsArchive` (shared), but not the `DungeonFile`. Only the dungeon's map info is used after construction, so that is all it keeps. https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jqueuniet/dm2-tools#451
No description provided.