VirtualRoomSet Rework#869
Conversation
Guantol-Lemat
commented
Jun 1, 2026
- Simplify adding rooms by introducing a single "RoomHolder" that guarantees pointer stability for all added rooms. VirtualRoomSets are now simple vectors of room pointers.
- Fix issues caused by room ID collisions when restoring a GameState on continue.
- Prepare the manager for support of CustomRoomSets.
- Simplified room holder - Prepared support for custom room sets. - Fixed restore issues caused by ID collisions.
- Add a separate set of RestoreRoomDB for remote and local game states. - Fix StageID and Mode not being properly applied to newly added rooms. - Fix DbGameStateRoom being marked as VirtualGameStateRoom. - Fix InitDB not reusing repeated room indexes. - Fix Lua/C++ index handling in AddLuaRooms.
|
|
||
| namespace { | ||
| static constexpr size_t CHUNK_SIZE = 64 * 1024 / sizeof(RoomConfig_Room); // 64 KB | ||
| using RoomChunk = std::array<RoomConfig_Room, CHUNK_SIZE>; |
There was a problem hiding this comment.
Why are we splitting up the rooms into chunks? Is this just for memory allocation optimization? (ie, vector resizing)
There was a problem hiding this comment.
This is primarily a memory locality optimization, with the added benefit of reducing reallocations in the main vector. The goal is to have fast room iteration while filtering, while also keeping the implementation of add_room relatively simple.
| OutAddStbRooms out; | ||
|
|
||
| LogUtility::LogContext logContext; | ||
| //logContext.emplace_back(REPENTOGON::StringFormat("[LUA] Add Rooms from `.../content/rooms/%s` to set (%u, %i): ", filename.c_str(), stageId, mode)); |
There was a problem hiding this comment.
Were these commented-out lines intended to be removed?
There was a problem hiding this comment.
I forgot to add them back in.
| int numRooms = 0; | ||
| file->Read(&numRooms, 4, 1); | ||
|
|
||
| //logContext.emplace_back(REPENTOGON::StringFormat("Reading %d Rooms from `%s`...", numRooms, filepath.c_str())); |
There was a problem hiding this comment.
Was keeping this comment intended?
There was a problem hiding this comment.
I also forgot to add this one back in.