Skip to content

Commit

Permalink
Allow creating an empty PNAMES directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
fragglet committed Aug 3, 2024
1 parent 8c40811 commit 6198260
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/help/pnames_editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ All [standard controls](common.md) are also supported.
line. If none are tagged, the file will contain the entire list.
* To import such a file into the texture directory, select the file in the
[opposite pane](dir_view.md) and use **Import config (F5)**.

## Creating a new PNAMES directory

To create a new PNAMES directory, simply create an empty lump named PNAMES and
open it; a pop-up notice will confirm that a new PNAMES directory has been
created.
10 changes: 9 additions & 1 deletion src/textures/pnames_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,15 @@ static bool PnamesDirLoad(void *_dir, struct directory *wad_dir,
struct directory_entry *ent)
{
struct pnames_dir *dir = _dir;
VFILE *in = VFS_OpenByEntry(wad_dir, ent);
VFILE *in;
if (ent->size == 0) {
UI_ShowNotice("Creating a new, empty PNAMES directory.");
dir->dir.b.txs = NULL;
PNAMES(dir) = TX_NewPnamesList(0);
++PNAMES(dir)->modified_count;
return true;
}
in = VFS_OpenByEntry(wad_dir, ent);
return TX_BundleLoadPnames(&dir->dir.b, in);
}

Expand Down

0 comments on commit 6198260

Please sign in to comment.