...
 
Commits (1)
  • Rob Swindell's avatar
    Fixed: Monsters did not move on 64-bit systems · d3b4c85c
    Rob Swindell authored
    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.
    d3b4c85c
......@@ -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];