Skip to content

Commit

Permalink
Add a new override to reload "-3" for cache only.
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrorblade committed Jan 12, 2024
1 parent 25c0e88 commit 989cc40
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions PlayerHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ bool Eluna::OnCommand(Player* player, const char* text)
const std::string reload_command = "reload eluna";
if (reload.find(reload_command) == 0)
{
const int mapid_reload_cache_only = -3;
const int mapid_reload_all = -2; // reserved for reloading all states (default if no args)
const int mapid_reload_global = -1; // reserved for reloading global state
// otherwise reload the state of the specific mapid
Expand All @@ -95,17 +96,20 @@ bool Eluna::OnCommand(Player* player, const char* text)
mapId = strtol(args.c_str(), nullptr, 10);

sElunaLoader->LoadScripts();
if (mapId == mapid_reload_global || mapId == mapid_reload_all)
sWorld->GetEluna()->ReloadEluna();
sMapMgr->DoForAllMaps([&](Map* map)
{
if (mapId == mapid_reload_all || mapId == static_cast<int>(map->GetId()))
if (mapid_reload_cache_only != mapId)
{
if (mapId == mapid_reload_global || mapId == mapid_reload_all)
sWorld->GetEluna()->ReloadEluna();
sMapMgr->DoForAllMaps([&](Map* map)
{
if (map->GetEluna())
map->GetEluna()->ReloadEluna();
if (mapId == mapid_reload_all || mapId == static_cast<int>(map->GetId()))
{
if (map->GetEluna())
map->GetEluna()->ReloadEluna();
}
}
}
);
);
}
return false;
}
}
Expand Down

0 comments on commit 989cc40

Please sign in to comment.