Optimized lighting algorithm

For some reason I was using selection sort instead of quicksort....

Signed-off-by: James Hagborg <jameshagborg@gmail.com>