Fix RNG seed for web

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 3 years ago
parent 102d20e946
commit 6e36707eda
  1. 9
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness
  3. BIN
      Seasons_of_Loneliness.wasm

@ -425,7 +425,7 @@ public:
int PLAYER_HP=PLAYER_MAXHP; int PLAYER_HP=PLAYER_MAXHP;
int BATTLE_CURRENT_TURN_ENTITY=-1; int BATTLE_CURRENT_TURN_ENTITY=-1;
int CURRENT_ENCOUNTER_IND=-1; int CURRENT_ENCOUNTER_IND=-1;
int RAND_CALLS=0; unsigned int RAND_CALLS=0;
std::vector<DisplayNumber*> BATTLE_DISPLAY_NUMBERS; std::vector<DisplayNumber*> BATTLE_DISPLAY_NUMBERS;
bool PLAYER_TURN_COMPLETE=false; bool PLAYER_TURN_COMPLETE=false;
int FOOD_REGEN_TURNS=0; int FOOD_REGEN_TURNS=0;
@ -705,6 +705,7 @@ public:
while (elapsedTime>TARGET_RATE) { while (elapsedTime>TARGET_RATE) {
elapsedTime-=TARGET_RATE; elapsedTime-=TARGET_RATE;
updateGame(); updateGame();
rand();
} }
if (GetKey(F1).bPressed) { if (GetKey(F1).bPressed) {
ConsoleShow(F1,false); ConsoleShow(F1,false);
@ -2060,8 +2061,10 @@ public:
} }
int rand() { int rand() {
srand(time(NULL)+RAND_CALLS++); srand(time(NULL)+RAND_CALLS);
return std::rand(); int randNumb = std::rand();
RAND_CALLS=randNumb;
return randNumb;
} }
void performCropUpdate(int chanceToRegrow) { void performCropUpdate(int chanceToRegrow) {

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save