Skip to content

Commit

Permalink
fix(glue): reset resources on network kill
Browse files Browse the repository at this point in the history
this change ensures resources unload on network kill, such scenarios include switching to story mode
  • Loading branch information
jakub-cfx committed Jan 16, 2024
1 parent c18c321 commit bea458e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/components/glue/src/BindNetLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <CoreConsole.h>
#include <se/Security.h>

#include <ResourceManager.h>

static InitFunction initFunction([] ()
{
seGetCurrentContext()->AddAccessControlEntry(se::Principal{ "system.internal" }, se::Object{ "builtin" }, se::AccessType::Allow);
Expand Down Expand Up @@ -91,6 +93,9 @@ static InitFunction initFunction([] ()

Instance<ICoreGameInit>::Get()->ClearVariable("storyMode");
Instance<ICoreGameInit>::Get()->ClearVariable("localMode");

fwRefContainer<fx::ResourceManager> resman = Instance<fx::ResourceManager>::Get();
resman->ResetResources();
});

static std::vector<std::string> convarsCreatedByServer;
Expand Down

0 comments on commit bea458e

Please sign in to comment.