BUG FIXES
+- Fixed brain-dead handling of undo slots.
+
- Fixed a segfault when xfrotz detects a fatal error.
- Fixed compile failure of the SDL interface for GCC 12 and maybe GCC 11.
.TP
.B \-u N
Sets the number of slots available for Frotz's multiple undo hotkey (see
-below). This defaults to twenty, which should be sufficient for most
+below). This defaults to 25, which should be sufficient for most
purposes. Setting too high a number here may be dangerous on machines
with limited memory.
.TP
void init_setup(void)
{
memset(&f_setup, 0, sizeof(f_setup));
- f_setup.undo_slots = MAX_UNDO_SLOTS;
+ f_setup.undo_slots = DEFAULT_UNDO_SLOTS;
f_setup.script_cols = 80;
f_setup.err_report_mode = ERR_DEFAULT_REPORT_MODE;
f_setup.blorb_file = NULL;
zword addr;
unsigned n;
int i, j;
+ char errorstring[81];
#ifdef TOPS20
zword checksum = 0;
};
/* INDENT-ON */
+ /* Ensure undo slots don't exceed maximum */
+ if (f_setup.undo_slots > MAX_UNDO_SLOTS) {
+ snprintf(errorstring, 80, "Maxmimum undo slots is %d", MAX_UNDO_SLOTS);
+ os_fatal(errorstring);
+ }
+
/* Open story file */
if ((story_fp = os_load_story()) == NULL)
os_fatal("Cannot open story file");
#include "unused.h"
/*** Constants that may be set at compile time ***/
+#ifndef DEFAULT_UNDO_SLOTS
+#define DEFAULT_UNDO_SLOTS 25
+#endif
#ifndef MAX_UNDO_SLOTS
#define MAX_UNDO_SLOTS 500
#endif