shithub: puzzles

Download patch

ref: b6ee9debcfe46c7ed4e958511e754f150f4e9773
parent: e5df38fa152115c02938e6360fc66ae02f5251bf
author: Simon Tatham <anakin@pobox.com>
date: Fri May 10 13:56:00 EDT 2013

Fix grid generation crashes at Penrose 3x3 sizes. What seemed to be
happening was that at the point of calling grid_make_consistent, the
grid had no faces or vertices, probably because grid_trim_vigorously
had removed them all, causing grid_make_consistent to try to allocate
a negative amount of memory and die in snewn.

Fixed by detecting this case in new_desc_penrose and retrying until
generation is successful. (It wasn't happening 100% of the time, just
_most_ of the time.) The same verification step is also used in
validate_desc_penrose in case a user manages to manually construct a
set of parameters leading to this failure mode.

[originally from svn r9840]