Skip to content

Commit

Permalink
Don't filter out empty rooms early 🫗.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarty committed Apr 26, 2024
1 parent 60ae977 commit 072f3af
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/components/RoomsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ const RoomsList = ({ rooms, currentId }) => {
return (
<>
<ColumnListHeader>Rooms</ColumnListHeader>
{rooms.map(({ metadata }) => {
{rooms.map(({ metadata, header }) => {
if (!header) {
// Some rooms are empty.
return null;
}

const selected = metadata.id === currentId;
const path = `/rooms/${metadata.id}`;
const label = `Room ${metadata.id}`;
Expand Down
4 changes: 4 additions & 0 deletions src/containers/RoomsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const RoomsContainer = ({ rooms, roomgfx }) => {
setSelectedObjects(newSelectedObjects);
};

if (room && !room.header) {
return null;
}

return (
<>
<PrimaryColumn>
Expand Down
4 changes: 0 additions & 4 deletions src/lib/parseRom.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ const parseRom = (arrayBuffer, res) => {
for (let i = 0; i < res?.rooms?.length; i++) {
const [offset, length] = res.rooms[i];

if (length === 0) {
continue;
}

const buffer = arrayBuffer.slice(offset, offset + length);
const item = parseRooms(buffer, i, offset, res.characters);
item.buffer = buffer;
Expand Down
4 changes: 4 additions & 0 deletions src/lib/parseRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const parseRooms = (arrayBuffer, i = 0, offset = 0, characters = {}) => {
size: arrayBuffer.byteLength,
};

if (arrayBuffer.byteLength === 0) {
return { metadata };
}

const chunkSize = parser.getUint16(); // Room res size

assert(
Expand Down

0 comments on commit 072f3af

Please sign in to comment.