Skip to content

Commit

Permalink
Some more MasterDir cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ioan-chera committed Nov 4, 2023
1 parent 6423860 commit 40a9e0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/m_files.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ bool Instance::M_TryOpenMostRecent()
else
loaded.levelName.clear();

this->wad.master.edit_wad = wad;
this->wad.master.ReplaceEditWad(wad);

return true;
}
Expand Down
15 changes: 7 additions & 8 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1121,21 +1121,20 @@ int main(int argc, char *argv[])
M_ValidateGivenFiles();

// TODO: main instance
gInstance.wad.master.edit_wad = Wad_file::Open(global::Pwad_list[0], WadOpenMode::append);
if (!gInstance.wad.master.edit_wad)
std::shared_ptr<Wad_file> editWad = Wad_file::Open(global::Pwad_list[0], WadOpenMode::append);
if(!editWad)
{
ThrowException("Cannot load pwad: %s\n", global::Pwad_list[0].u8string().c_str());

}

// Note: the Main_LoadResources() call will ensure this gets
// placed at the correct spot (at the end)
gInstance.wad.master.MasterDir_Add(gInstance.wad.master.edit_wad);
gInstance.wad.master.ReplaceEditWad(editWad);
}
// don't auto-load when --iwad or --warp was used on the command line
else if (config::auto_load_recent && ! (!gInstance.loaded.iwadName.empty() || !gInstance.loaded.levelName.empty()))
{
if (gInstance.M_TryOpenMostRecent())
{
gInstance.wad.master.MasterDir_Add(gInstance.wad.master.edit_wad);
}
gInstance.M_TryOpenMostRecent();
}


Expand Down

0 comments on commit 40a9e0f

Please sign in to comment.