Use more precise seed for random map generation

Clicking generate map quickly would generate roughly the same map twice in a row because the seed was using second precision timing rather than millisecond.
This commit is contained in:
Ted John 2016-09-24 12:11:48 +01:00
parent 5c5e9095db
commit 60b8ef6c0b
1 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,9 @@
*****************************************************************************/ *****************************************************************************/
#pragma endregion #pragma endregion
#include <time.h> #include "../common.h"
#include <SDL.h>
#include "../object.h" #include "../object.h"
#include "../util/util.h" #include "../util/util.h"
#include "map.h" #include "map.h"
@ -122,7 +124,7 @@ void mapgen_generate(mapgen_settings *settings)
int x, y, mapSize, floorTexture, wallTexture, waterLevel; int x, y, mapSize, floorTexture, wallTexture, waterLevel;
rct_map_element *mapElement; rct_map_element *mapElement;
util_srand((unsigned int)time(NULL)); util_srand((int)SDL_GetTicks());
mapSize = settings->mapSize; mapSize = settings->mapSize;
floorTexture = settings->floor; floorTexture = settings->floor;