Skip to content

Commit

Permalink
Minor improvment
Browse files Browse the repository at this point in the history
  • Loading branch information
obligaron committed Feb 11, 2024
1 parent 38e98fb commit 833b651
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4576,7 +4576,8 @@ void PutItemRecord(uint32_t nSeed, uint16_t wCI, int nIndex)
std::mt19937 BetterRng;
std::string DebugSpawnItem(std::string itemName)
{
if (ActiveItemCount >= MAXITEMS) return "No space to generate the item!";
if (ActiveItemCount >= MAXITEMS)
return "No space to generate the item!";

const int max_time = 3000;
const int max_iter = 1000000;
Expand All @@ -4588,7 +4589,8 @@ std::string DebugSpawnItem(std::string itemName)
uint32_t begin = SDL_GetTicks();
int i = 0;
for (;; i++) {
// using a better rng here to seed the item to prevent getting stuck repeating same values using old one
// using a better rng here to seed the item to prevent getting
// stuck repeating same values using old one
std::uniform_int_distribution<int32_t> dist(0, INT_MAX);
SetRndSeed(dist(BetterRng));
if (SDL_GetTicks() - begin > max_time)
Expand Down

0 comments on commit 833b651

Please sign in to comment.