Skip to content

Commit

Permalink
bugfix for devilutionx
Browse files Browse the repository at this point in the history
- use time(NULL) instead of SDL_GetTicks to initialize the rnd-seed for new players
  1. time(NULL): time since epoch (1970.01.01)
  2. SDL_GetTicks: time since the application(SDL) was started
  • Loading branch information
pionere committed Sep 16, 2024
1 parent 83703fc commit ea1dd6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
#include "all.h"
#include "plrctrls.h"
#include <time.h>

DEVILUTION_BEGIN_NAMESPACE

Expand Down Expand Up @@ -629,7 +630,7 @@ void CreatePlayer(const _uiheroinfo& heroinfo)
int i, pnum = 0;

memset(&plr, 0, sizeof(PlayerStruct));
SetRndSeed(SDL_GetTicks()); // used by CreatePlrItems / CreateBaseItem
SetRndSeed(time(NULL)); // used by CreatePlrItems / CreateBaseItem

plr._pLevel = heroinfo.hiLevel;
plr._pClass = heroinfo.hiClass;
Expand Down

0 comments on commit ea1dd6f

Please sign in to comment.