Changes between Initial Version and Version 1 of Ticket #1985, comment 5
- Timestamp:
- Sep 10, 2013, 11:34:45 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #1985, comment 5
initial v1 2 2 3 3 I 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 5 Github for latest version: https://github.com/jammus/0ad/compare/0ad:430af4a008...0796168