Menu

#3 Flexible number of actors

open
nobody
None
6
2003-01-03
2002-12-31
No

In Beta 2 and before, the player could crash the
program by firing a bunch of shots, overflowing the
ActorList[] array. In Beta 3, registerActor() simply
returns NULL if ActorList is full, preventing some
Actor from appearing in the game. While limiting
gameplay is better than ending it, a better solution
would be to dynamically expand the ActorList[] array.

This is impossible to fix while retaining the current
set of logic and data structures, since registerActor()
is called from behaviours that use pointers to data
within ActorList[]. If ActorList is realloced, these
pointers now point to bad memory.

A possible solution is to have two ActorLists, one for
the current frame's Actors and one for the next
frame's. registerActor() would add to the next frame's
list, while other functions would operate on the
current frame. Since nothing other than
registerActor() would touch the next frame's list, it
would be acceptable to dynamically expand it.

Discussion

  • David Turover

    David Turover - 2003-01-03

    Logged In: YES
    user_id=547547

    Upgrading priority since this an actual Bug derives from this.

     
  • David Turover

    David Turover - 2003-01-03
    • priority: 4 --> 6
     

Log in to post a comment.