From 2fdb27e872ec5930cb631eebb9e1d379d867045b Mon Sep 17 00:00:00 2001 From: fed <58637860+fedddddd@users.noreply.github.com> Date: Tue, 20 Sep 2022 19:26:23 +0200 Subject: [PATCH] Small change --- src/client/component/mapents.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/client/component/mapents.cpp b/src/client/component/mapents.cpp index 098895bc..caba7b26 100644 --- a/src/client/component/mapents.cpp +++ b/src/client/component/mapents.cpp @@ -380,21 +380,20 @@ namespace mapents return; } - static const auto mapname = game::Dvar_FindVar("mapname"); - const auto name = utils::string::va("maps/%s.d3dbsp", mapname->current.string); - const auto mapents = game::DB_FindXAssetHeader(game::ASSET_TYPE_MAP_ENTS, - name, false).mapents; - if (mapents == nullptr) + fastfiles::enum_assets(game::ASSET_TYPE_MAP_ENTS, [](game::XAssetHeader header) { - console::info("Failed to dump mapents\n"); - return; - } + if (header.mapents == nullptr) + { + console::info("Failed to dump mapents\n"); + return; + } - const auto dest = utils::string::va("dumps/%s.ents", name); - const auto str = std::string(mapents->entityString, mapents->numEntityChars); - const auto data = replace_mapents_keys(str); - utils::io::write_file(dest, data, false); - console::info("Mapents dumped to %s\n", dest); + const auto dest = utils::string::va("dumps/%s.ents", header.mapents->name); + const auto str = std::string(header.mapents->entityString, header.mapents->numEntityChars); + const auto data = replace_mapents_keys(str); + utils::io::write_file(dest, data, false); + console::info("Mapents dumped to %s\n", dest); + }, true); }); utils::hook::call(0x14058BDD3, db_find_xasset_header_stub);