Fix crash

This commit is contained in:
Diavolo 2022-01-31 13:53:57 +01:00
parent 7601985f32
commit 09e565e431
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
2 changed files with 5 additions and 4 deletions

View File

@ -252,15 +252,16 @@ namespace Components
Utils::IO::WriteFile(Utils::String::VA("raw/%s.ents", name.data()), asset.mapEnts->entityString, true); Utils::IO::WriteFile(Utils::String::VA("raw/%s.ents", name.data()), asset.mapEnts->entityString, true);
} }
static std::string mapEntities;
FileSystem::File ents(name + ".ents"); FileSystem::File ents(name + ".ents");
if (ents.exists()) if (ents.exists())
{ {
static auto mapEntities = ents.getBuffer(); mapEntities = ents.getBuffer();
asset.mapEnts->entityString = const_cast<char*>(mapEntities.data()); asset.mapEnts->entityString = mapEntities.data();
asset.mapEnts->numEntityChars = mapEntities.size() + 1; asset.mapEnts->numEntityChars = mapEntities.size() + 1;
} }
} }
// This is broken // This is broken
if ((type == Game::XAssetType::ASSET_TYPE_MENU || type == Game::XAssetType::ASSET_TYPE_MENULIST) && Zones::Version() >= 359) if ((type == Game::XAssetType::ASSET_TYPE_MENU || type == Game::XAssetType::ASSET_TYPE_MENULIST) && Zones::Version() >= 359)
{ {

View File

@ -1983,7 +1983,7 @@ namespace Game
struct __declspec(align(4)) MapEnts struct __declspec(align(4)) MapEnts
{ {
const char *name; const char *name;
char *entityString; const char *entityString;
int numEntityChars; int numEntityChars;
MapTriggers trigger; MapTriggers trigger;
Stage *stages; Stage *stages;