Universalize a single call to srand() on map init (#1422)
This commit is contained in:
parent
5bc48b2ab3
commit
f9633a5f6f
@ -1174,7 +1174,6 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
|
||||
rootmenu->ConsolePrint(" -> %s", pPlugin->GetFilename());
|
||||
}
|
||||
}
|
||||
srand(static_cast<int>(time(NULL)));
|
||||
pExt->unload_code = (rand() % 877) + 123; //123 to 999
|
||||
rootmenu->ConsolePrint("[SM] To verify unloading %s, please use the following: ", pExt->GetFilename());
|
||||
rootmenu->ConsolePrint("[SM] sm exts unload %d %d", num, pExt->unload_code);
|
||||
|
@ -485,7 +485,6 @@ void CMenuHandler::OnMenuVoteResults(IBaseMenu *menu, const menu_vote_result_t *
|
||||
if (num_items > 1)
|
||||
{
|
||||
/* Yes, we do. */
|
||||
srand(time(NULL));
|
||||
winning_item = rand() % num_items;
|
||||
winning_item = results->item_list[winning_item].item;
|
||||
} else {
|
||||
|
@ -91,8 +91,6 @@ enum SortOrder
|
||||
|
||||
void sort_random(cell_t *array, cell_t size)
|
||||
{
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
for (int i = size-1; i > 0; i--)
|
||||
{
|
||||
int n = rand() % (i + 1);
|
||||
@ -442,8 +440,6 @@ void sort_adt_random(CellArray *cArray)
|
||||
{
|
||||
size_t arraysize = cArray->size();
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
for (int i = arraysize-1; i > 0; i--)
|
||||
{
|
||||
int n = rand() % (i + 1);
|
||||
|
@ -337,6 +337,9 @@ void SourceModBase::StartSourceMod(bool late)
|
||||
static bool g_LevelEndBarrier = false;
|
||||
bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background)
|
||||
{
|
||||
/* Seed rand() globally per map */
|
||||
srand(time(NULL));
|
||||
|
||||
g_Players.MaxPlayersChanged();
|
||||
|
||||
/* If we're not loaded... */
|
||||
|
Loading…
Reference in New Issue
Block a user