Skip to content

Instantly share code, notes, and snippets.

@Siarkowy
Forked from Lillecarl/savespersec.cpp
Created April 4, 2014 11:50
Show Gist options
  • Save Siarkowy/9972954 to your computer and use it in GitHub Desktop.
Save Siarkowy/9972954 to your computer and use it in GitHub Desktop.
uint32 World::GetSaveInterval()
{
uint32 hardtime = sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE);
if (!sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE))
hardtime = ceil((float)(1.f / sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVEPERSEC) * sWorld.GetActiveSessionCount()*IN_MILLISECONDS));
if (hardtime < 2 * IN_MILLISECONDS)
hardtime = 2 * IN_MILLISECONDS;
return urand(hardtime / 2, hardtime * 3 / 2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment