Changes between Initial Version and Version 1 of Ticket #1985, comment 5


Ignore:
Timestamp:
Sep 10, 2013, 11:34:45 PM (11 years ago)
Author:
James Scott

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1985, comment 5

    initial v1  
    22
    33I chose to use randomIndex rather than randomItem so that targets can be easily removed by index if they fail the visibility test (line 306). An alternative would be to add a removeItem(target) method.  My concern here was that this would work fine for this case where elements are integers or strings as the filter callback, or findItem internal method, would do a simple equality check. However if more complicated objects were stored in WeightedList this would need some rethink. I'm happy to implement this if preferred.
     4
     5Github for latest version: https://github.com/jammus/0ad/compare/0ad:430af4a008...0796168