File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ namespace Random {
66
77 // FUNCTION: STRONGHOLDCRUSADER 0x00471810
88 RNG* RNG::Constructor_RNG ()
9-
109 {
1110 MACRO_CALL_MEMBER (RNG_Func::setTimeBasedSeed, this )();
1211 MACRO_CALL_MEMBER (RNG_Func::populateRNG1040, this )();
Original file line number Diff line number Diff line change @@ -8,11 +8,10 @@ namespace Random {
88 void RNG::nextRandomNumber1 ()
99 {
1010 this ->currentNumber1 = this ->randomNumbers [this ->index1 ];
11- this ->index1 = this -> index1 + 1 ;
12- if (20000 <= this ->index1 ) {
11+ this ->index1 += 1 ;
12+ if (sizeof ( this -> randomNumbers ) / sizeof ( this -> randomNumbers [ 0 ]) <= this ->index1 ) {
1313 this ->index1 = 0 ;
1414 }
15- return ;
1615 }
1716}
1817
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ namespace Random {
99 {
1010 this ->currentNumber2 = this ->randomNumbers [this ->index2 ];
1111 this ->index2 = this ->index2 + 1 ;
12- if (20000 <= this ->index2 ) {
12+ if (sizeof ( this -> randomNumbers ) / sizeof ( this -> randomNumbers [ 0 ]) <= this ->index2 ) {
1313 this ->index2 = 0 ;
1414 }
1515 return ;
Original file line number Diff line number Diff line change @@ -14,14 +14,9 @@ namespace Random {
1414 MACRO_CALL (OpenSHC::Global_Func::SetRNGSeed)(this ->seed );
1515 this ->index2 = 0 ;
1616 this ->index1 = 0 ;
17- short * _pRandomNumber = &this ->randomNumbers [0 ];
18- int n = 20000 ;
19- do {
20- int random = MACRO_CALL (OpenSHC::OS_Func::_rand)();
21- *_pRandomNumber = (short )random;
22- _pRandomNumber += 1 ;
23- n -= 1 ;
24- } while (n != 0 );
17+ for (int i = 0 ; i < sizeof (this ->randomNumbers ) / sizeof (this ->randomNumbers [0 ]); i++) {
18+ this ->randomNumbers [i] = MACRO_CALL (OpenSHC::OS_Func::_rand)();
19+ }
2520
2621 this ->currentNumber2 = this ->randomNumbers [this ->index2 ];
2722 this ->index2 += 1 ;
You can’t perform that action at this time.
0 commit comments