store previous BallData state for each ball

Issue #55 resolved
Justin Schwartz created an issue

certain callbacks require knowledge of how the ball used to be to make an assessment on what to do. they could store this information themselves, but there is no harm in storing it in ArenaBallData.

Comments (4)

  1. Justin Schwartz reporter
    • changed status to open

    Proposed solution: Add struct BallData *old; to ArenaBallData, which is updated before balls[ballid] is, between when advisers are called and when callbacks are called.

  2. Justin Schwartz reporter

    Hmm, due to the way the advisers run is implemented, both previous and balls will be set before advisers are called. Not a big deal.

  3. Justin Schwartz reporter

    Wrapping up this self-rant: the details aren't really important, just keep in mind that accessing ArenaBallData from a balls adviser will probably yield unexpected results, not truly reflecting what the state of the ball was. If there are implementations that require their advisers knowing the exact state of the ball before any advisers were called, then the code can be reworked.

    Also attempting to PlaceBall will likely fail (though this is okay since advisers shouldn't be triggering actions like this.)

    Addressed, untested, Wiki macro error: Changeset 1044 not found.

  4. Justin Schwartz reporter

    Running without problems, with one minor application. Updated in Wiki macro error: Changeset 1064 not found. to make sure a stale pointer isn't left in this previous struct.

  5. Log in to comment