shithub: puzzles

Download patch

ref: 981b831c21fb21d9ab04abf6a3bf330aa7a14dc5
parent: 90e42d4cdedf999a5c996ff4ac1353ecee280ea5
author: Simon Tatham <anakin@pobox.com>
date: Wed May 18 13:25:30 EDT 2005

It's a good idea to validate presets received from the environment.

[originally from svn r5805]

--- a/midend.c
+++ b/midend.c
@@ -585,6 +585,12 @@
                 preset = me->ourgame->default_params();
                 me->ourgame->decode_params(preset, val);
 
+		if (me->ourgame->validate_params(preset)) {
+		    /* Drop this one from the list. */
+		    me->ourgame->free_params(preset);
+		    continue;
+		}
+
                 if (me->presetsize <= me->npresets) {
                     me->presetsize = me->npresets + 10;
                     me->presets = sresize(me->presets, me->presetsize,