fix a use-after-move

This commit is contained in:
Jonathan 2024-03-13 01:35:12 -04:00
parent d006ac730a
commit 0cdd932ef7
1 changed files with 6 additions and 6 deletions

View File

@ -1073,11 +1073,16 @@ void SaveLightmapSurfaces(bspdata_t *bspdata, const fs::path &source)
logging::print("Lighting Completed.\n\n");
if (light_options.write_litfile == lightfile::lit2) {
WriteLitFile(bsp, faces_sup, source, 2, lit_filebase, lux_filebase);
return; // run away before any files are written
}
// Transfer greyscale lightmap (or color lightmap for Q2/HL) to the bsp and update lightdatasize
// NOTE: bsp.lightdatasize is already valid in the -litonly case
if (!light_options.litonly.value()) {
if (bsp->loadversion->game->has_rgb_lightmap) {
bsp->dlightdata = std::move(lit_filebase);
bsp->dlightdata = lit_filebase; // not moved, because it's used below too
} else {
bsp->dlightdata = std::move(filebase);
}
@ -1086,11 +1091,6 @@ void SaveLightmapSurfaces(bspdata_t *bspdata, const fs::path &source)
bspdata->bspx.entries.erase("RGBLIGHTING");
bspdata->bspx.entries.erase("LIGHTINGDIR");
if (light_options.write_litfile == lightfile::lit2) {
WriteLitFile(bsp, faces_sup, source, 2, lit_filebase, lux_filebase);
return; // run away before any files are written
}
/*fixme: add a new per-surface offset+lmscale lump for compat/versitility?*/
if (light_options.write_litfile & lightfile::external) {
WriteLitFile(bsp, faces_sup, source, LIT_VERSION, lit_filebase, lux_filebase);