Skip to content
Snippets Groups Projects
Commit d3b4c85c authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fixed: Monsters did not move on 64-bit systems

The game is much easier to play when the monsters don't move. :-)

A clock_t is bigger than an int on 64-bit Linux systems, so there
was some weirdness with the tick offset that caused monsters to
never move.
parent c57eaa0f
No related branches found
No related tags found
No related merge requests found
......@@ -32,8 +32,8 @@ unsigned _stklen=20000;
char redraw_screen;
long record_number;
int create_log,chfile,rmfile,weapon_ready,invisible,strong,
tpic,lasthit,clock_tick,clock_tick2,ateof;
int chfile,rmfile,weapon_ready,invisible,strong,tpic,lasthit,ateof;
clock_t clock_tick,clock_tick2;
uchar map[LEVELS][SQUARE][SQUARE];
void exitfunc(void)
......@@ -53,7 +53,7 @@ void exitfunc(void)
int main(int argc, char **argv)
{
FILE *fp;
char str[256],chbuf[8],*buf,*p,name[26];
char str[256],*buf,*p,name[26];
int file,x,r1,r2,ch,times_played=0,lev,maint_only=0;
long lastrun,length,l,exp;
uchar uch;
......@@ -308,7 +308,7 @@ void movement(int sx,int sy,int sz,int sgx,int sgy)
long timeleftmin;
time_t strength_timer,invis_timer,now,timeout,health_timer;
node_t node;
int tick_offset=0;
clock_t tick_offset=0;
clock_tick=invisible=strong=0; clock_tick2=40;
printfile("tbd.mnu"); game_commands(0,-1);
......@@ -336,9 +336,9 @@ void movement(int sx,int sy,int sz,int sgx,int sgy)
object[rmobj[(gy*11)+gx].item].name); } }
timeout=time(NULL); /* Set timer on entry point */
tick_offset=(int)(msclock()/(MSCLOCKS_PER_SEC/18.2))%19;
tick_offset=(clock_t)(msclock()/(MSCLOCKS_PER_SEC/18.2))%19;
do {
clock_tick=(int)(msclock()/(MSCLOCKS_PER_SEC/18.2))%19-tick_offset;
clock_tick=(clock_t)(msclock()/(MSCLOCKS_PER_SEC/18.2))%19-tick_offset;
if(clock_tick<0)
clock_tick+=19;
++clock_tick2;
......
......@@ -122,7 +122,7 @@ extern long cost_per_min,times_per_day,total_cost;
extern char redraw_screen;
extern long record_number;
extern int create_log,chfile,rmfile,weapon_ready,invisible,strong,
tpic,lasthit,clock_tick,clock_tick2,ateof;
extern int chfile,rmfile,weapon_ready,invisible,strong,tpic,lasthit,ateof;
extern clock_t clock_tick;
extern uchar map[LEVELS][SQUARE][SQUARE];
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment