Skip to content

Commit 9736244

Browse files
committed
Set random seed from command for debugging
1 parent f22b40c commit 9736244

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

BINARIES/LinuxChatScript64

64 Bytes
Binary file not shown.

SRC/mainSystem.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ bool server = true; // default is server on LINUX
9494
#endif
9595
#endif
9696
unsigned int port = 1024; // server port
97+
int random_seed = -1; // random seed -1 means random seed is not set
9798
bool commandLineCompile = false;
9899

99100
PrepareMode tmpPrepareMode = NO_MODE; // controls what processing is done in preparation NO_MODE, POS_MODE, PREPARE_MODE
@@ -659,6 +660,7 @@ static void ProcessArgument(char* arg)
659660
size_t len = strlen(hide);
660661
if (hide[len - 1] == '"') hide[len - 1] = 0;
661662
}
663+
else if (!strnicmp(arg, (char*)"seed=", 5)) random_seed = atoi(arg+5);
662664
#ifndef DISCARDSERVER
663665
else if (!stricmp(arg,(char*)"serverretry")) serverRetryOK = true;
664666
else if (!stricmp(arg,(char*)"local")) server = false; // local standalone
@@ -793,6 +795,10 @@ unsigned int InitSystem(int argcx, char * argvx[],char* unchangedPath, char* rea
793795

794796
int oldserverlog = serverLog;
795797
serverLog = true;
798+
if (random_seed != -1) {
799+
printf((char*)"Set random number %d\r\n", random_seed);
800+
srand(random_seed);
801+
}
796802

797803
#ifndef DISCARDSERVER
798804
if (server)

0 commit comments

Comments
 (0)