The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: TransshipmentEnvoy on July 01, 2022, 12:07:28 PM

Title: [master][5a0f5768] Strange map generation results
Post by: TransshipmentEnvoy on July 01, 2022, 12:07:28 PM
I get strange map generation results. The map and its generation settings are provided in the attachment.

The game is compiled on latest commit (5a0f5768) on master branch on a Linux machine.
Title: Re: [master][5a0f5768] Strange map generation results
Post by: TransshipmentEnvoy on July 10, 2022, 04:37:15 AM
The issue only appears on `cmake` builds.

It is related to option `SIMUTRANS_ENABLE_RANDOMNESS`. If set `-DSIMUTRANS_ENABLE_RANDOMNESS=ON` in cmake configuration, the map generation results are normal.

The option adds compile definition `DISABLE_RANDOMNESS` which affects random number generation in `simrandom.cc`.
Title: Re: [master][5a0f5768] Strange map generation results
Post by: TransshipmentEnvoy on July 10, 2022, 04:50:24 AM
The random number generator returns constant value if the range (`max`) is fixed.

```
#ifdef DISABLE_RANDOMNESS
   return max / 2;
```
Title: Re: [master][5a0f5768] Strange map generation results
Post by: jamespetts on August 07, 2022, 11:58:43 AM
That is interesting - it looks as though there is a problem with the default setting for the CMAKE build, in that the disable randomness preprocessor definition is only intended to be used for debugging, and randomness should be on by default.
Title: Re: [master][5a0f5768] Strange map generation results
Post by: Roboron on August 26, 2022, 11:41:47 AM
Easy solution then, let's the randomness reign by default!

=> https://github.com/jamespetts/simutrans-extended/pull/566
Title: Re: [master][5a0f5768] Strange map generation results
Post by: jamespetts on August 26, 2022, 06:49:30 PM
Thank you - now incorporated.