lightpreview: don't crash when vis is run more than once

This commit is contained in:
Eric Wasylishen 2023-12-24 17:22:01 -07:00
parent f47602050b
commit 8ab9960ca0
2 changed files with 32 additions and 1 deletions

View File

@ -297,5 +297,6 @@ public:
extern settings::vis_settings vis_options;
void vis_reset();
int vis_main(int argc, const char **argv);
int vis_main(const std::vector<std::string> &args);

View File

@ -677,9 +677,39 @@ static void LoadPortals(const fs::path &name, mbsp_t *bsp)
void vis_reset()
{
// FIXME: clear other data
numportals = 0;
portalleafs = 0;
portalleafs_real = 0;
portals.clear();
leafs.clear();
vismap.clear();
originalvismapsize = 0;
uncompressed.clear();
leafbytes = 0;
leaflongs = 0;
leafbytes_real = 0;
vis_options.reset();
portalfile = fs::path();
statefile = fs::path();
statetmpfile = fs::path();
portalIndex = 0;
starttime = time_point();
endtime = time_point();
statetime = time_point();
stateinterval = duration();
totalvis = 0;
compressed.clear();
}
int vis_main(int argc, const char **argv)