Skip to content

Commit 5d12ea3

Browse files
author
sourcehold
committed
improve style
1 parent 8b9bb9e commit 5d12ea3

4 files changed

Lines changed: 6 additions & 13 deletions

File tree

src/OpenSHC/Random/RNG/Constructor_RNG.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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)();

src/OpenSHC/Random/RNG/nextRandomNumber1.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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

src/OpenSHC/Random/RNG/nextRandomNumber2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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;

src/OpenSHC/Random/RNG/populateRNG1040.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)