When we reached MAX_BOSS_TELEPORT_SEGS in init_boss_segments, make sure we also escape out of the for-loop - otherwise we still might overflow

This commit is contained in:
zicodxx 2008-11-20 02:09:01 +00:00
parent 33490e497e
commit c705433bec
2 changed files with 11 additions and 1 deletions

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20081120
--------
main/ai2.c: When we reached MAX_BOSS_TELEPORT_SEGS in init_boss_segments, make sure we also escape out of the for-loop - otherwise we still might overflow
20081119
--------
main/gamecntl.c: Actually demand ANY valid key to abort the Death sequence

View file

@ -304,6 +304,8 @@ if (size_check)
#endif
if (*num_segs >= MAX_BOSS_TELEPORT_SEGS) {
tail = head;
sidenum=MAX_SIDES_PER_SEGMENT;
break;
}
}
}
@ -1996,7 +1998,11 @@ void teleport_boss(object *objp)
rand_index = (d_rand() * Num_boss_teleport_segs) >> 15;
rand_segnum = Boss_teleport_segs[rand_index];
Assert((rand_segnum >= 0) && (rand_segnum <= Highest_segment_index));
int i;
printf("LIST_START\n");
for (i=0; i<Num_boss_teleport_segs;i++)
printf("%i - index %i\n",Boss_teleport_segs[i],i);
printf("LIST END\n");
#ifdef NETWORK
if (Game_mode & GM_MULTI)
multi_send_boss_actions(objp-Objects, 1, rand_segnum, 0);