MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / ReloadPlugin

Method ReloadPlugin

core/logic/PluginSys.cpp:2070–2099  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2068}
2069
2070bool CPluginManager::ReloadPlugin(CPlugin *pl, bool print)
2071{
2072 PluginState state = pl->State();
2073 if (state == PluginState::WaitingToUnloadAndReload)
2074 return false;
2075
2076 std::string filename(pl->GetFilename());
2077 PluginType ptype = pl->GetType();
2078
2079 int id = 1;
2080 for (PluginIter iter(m_plugins); !iter.done(); iter.next(), id++) {
2081 if ((*iter) == pl)
2082 break;
2083 }
2084
2085 if (!UnloadPlugin(pl))
2086 {
2087 if (pl->State() == PluginState::WaitingToUnload)
2088 {
2089 pl->SetWaitingToUnload(true);
2090 ScheduleTaskForNextFrame([this, id, filename, ptype, print]() -> void {
2091 ReloadPluginImpl(id, filename.c_str(), ptype, print);
2092 });
2093 }
2094 return false;
2095 }
2096
2097 ReloadPluginImpl(id, filename.c_str(), ptype, false);
2098 return true;
2099}
2100
2101void CPluginManager::ReloadPluginImpl(int id, const char filename[], PluginType ptype, bool print)
2102{

Callers

nothing calls this directly

Calls 7

StateMethod · 0.80
GetTypeMethod · 0.80
doneMethod · 0.80
nextMethod · 0.80
SetWaitingToUnloadMethod · 0.80
GetFilenameMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected