aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/savegame.cfsml16
-rw-r--r--engines/sci/engine/savegame.cpp1281
-rw-r--r--engines/sci/module.mk4
-rw-r--r--tools/cfsml.pl18
4 files changed, 614 insertions, 705 deletions
diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml
index 5f2b57aca2..d886cadddc 100644
--- a/engines/sci/engine/savegame.cfsml
+++ b/engines/sci/engine/savegame.cfsml
@@ -111,7 +111,7 @@ void write_reg_t(Common::WriteStream *fh, reg_t *foo) {
}
int read_reg_t(Common::SeekableReadStream *fh, reg_t *foo, const char *lastval, int *line, int *hiteof) {
- int segment, offset;
+ unsigned int segment, offset;
if (sscanf(lastval, PREG, &segment, &offset) < 2) {
sciprintf("Error parsing reg_t on line %d\n", *line);
@@ -463,7 +463,6 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha
int songcount;
int i;
song_t *newsong;
- int oldstatus;
if (strcmp(lastval, "{")) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
@@ -486,7 +485,7 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha
return 0;
}
-struct {
+static struct {
int type;
const char *name;
} mem_obj_string_names[] = {
@@ -512,8 +511,6 @@ int mem_obj_string_to_enum(const char *str) {
return -1;
}
-static int bucket_length;
-
void write_int_hash_map_tp(Common::WriteStream *fh, int_hash_map_t **foo) {
%CFSMLWRITE int_hash_map_t *foo INTO fh;
}
@@ -645,7 +642,6 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
}
int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *lastval, int *line, int *hiteof) {
- char buffer[80];
foo->type = mem_obj_string_to_enum(lastval);
if (foo->type < 0) {
sciprintf("Unknown mem_obj_t type %s on line %d\n", lastval, *line);
@@ -714,10 +710,6 @@ void _gamestate_unfrob(state_t *s) {
int gamestate_save(state_t *s, Common::WriteStream *fh, const char* savename) {
- sci_dir_t dir;
- char *filename;
- int fd;
-
tm curTime;
g_system->getTimeAndDate(curTime);
@@ -840,8 +832,6 @@ static void load_script(state_t *s, seg_id_t seg) {
static void reconstruct_scripts(state_t *s, seg_manager_t *self) {
int i;
mem_obj_t *mobj;
- object_t **objects;
- int *objects_nr;
for (i = 0; i < self->heap_size; i++) {
if (self->heap[i]) {
mobj = self->heap[i];
@@ -1006,8 +996,6 @@ static void reconstruct_sounds(state_t *s) {
}
state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) {
- int fd;
- int i;
int read_eof = 0;
state_t *retval;
songlib_t temp;
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 70a55c8da4..caf154f7e5 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -111,7 +111,7 @@ void write_reg_t(Common::WriteStream *fh, reg_t *foo) {
}
int read_reg_t(Common::SeekableReadStream *fh, reg_t *foo, const char *lastval, int *line, int *hiteof) {
- int segment, offset;
+ unsigned int segment, offset;
if (sscanf(lastval, PREG, &segment, &offset) < 2) {
sciprintf("Error parsing reg_t on line %d\n", *line);
@@ -224,11 +224,11 @@ RECORD synonym_t "synonym_t" {
// Auto-generated CFSML declaration and function block
-#line 739 "savegame.cfsml"
+#line 736 "../../engines/sci/engine/savegame.cfsml"
#define CFSML_SUCCESS 0
#define CFSML_FAILURE 1
-#line 102 "savegame.cfsml"
+#line 102 "../../engines/sci/engine/savegame.cfsml"
#include <stdarg.h> // We need va_lists
#include "sci/include/sci_memory.h"
@@ -398,7 +398,7 @@ static char *_cfsml_get_identifier(Common::SeekableReadStream *fd, int *line, in
retval = (char *)sci_realloc(retval, mem += 1);
retval[pos] = 0; // Terminate string
-#line 281 "savegame.cfsml"
+#line 281 "../../engines/sci/engine/savegame.cfsml"
return _cfsml_last_identifier_retrieved = retval;
}
@@ -441,141 +441,139 @@ static char *_cfsml_get_value(Common::SeekableReadStream *fd, int *line, int *hi
retval = (char *)sci_realloc(retval, mem += 1);
retval[pos] = 0; // Terminate string
-#line 333 "savegame.cfsml"
+#line 333 "../../engines/sci/engine/savegame.cfsml"
return (_cfsml_last_value_retrieved = (char *)sci_realloc(retval, strlen(retval) + 1));
// Re-allocate; this value might be used for quite some while (if we are restoring a string)
}
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_sfx_state_t(Common::WriteStream *fh, sfx_state_t* save_struc);
static int _cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_clone_entry_t(Common::WriteStream *fh, clone_entry_t* save_struc);
static int _cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_object_t(Common::WriteStream *fh, object_t* save_struc);
static int _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_string(Common::WriteStream *fh, char ** save_struc);
static int _cfsml_read_string(Common::SeekableReadStream *fh, char ** save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_menubar_t(Common::WriteStream *fh, menubar_t* save_struc);
static int _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_size_t(Common::WriteStream *fh, size_t* save_struc);
static int _cfsml_read_size_t(Common::SeekableReadStream *fh, size_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_list_entry_t(Common::WriteStream *fh, list_entry_t* save_struc);
static int _cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_int_hash_map_t(Common::WriteStream *fh, int_hash_map_t* save_struc);
static int _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_song_t(Common::WriteStream *fh, song_t* save_struc);
static int _cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_menu_item_t(Common::WriteStream *fh, menu_item_t* save_struc);
static int _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_node_entry_t(Common::WriteStream *fh, node_entry_t* save_struc);
static int _cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_seg_id_t(Common::WriteStream *fh, seg_id_t* save_struc);
static int _cfsml_read_seg_id_t(Common::SeekableReadStream *fh, seg_id_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_dynmem_t(Common::WriteStream *fh, dynmem_t* save_struc);
static int _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_local_variables_t(Common::WriteStream *fh, local_variables_t* save_struc);
static int _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_state_t(Common::WriteStream *fh, state_t* save_struc);
static int _cfsml_read_state_t(Common::SeekableReadStream *fh, state_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_node_table_t(Common::WriteStream *fh, node_table_t* save_struc);
static int _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_sys_strings_t(Common::WriteStream *fh, sys_strings_t* save_struc);
static int _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_byte(Common::WriteStream *fh, byte* save_struc);
static int _cfsml_read_byte(Common::SeekableReadStream *fh, byte* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_node_t(Common::WriteStream *fh, node_t* save_struc);
static int _cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_list_table_t(Common::WriteStream *fh, list_table_t* save_struc);
static int _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_class_t(Common::WriteStream *fh, class_t* save_struc);
static int _cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_song_handle_t(Common::WriteStream *fh, song_handle_t* save_struc);
static int _cfsml_read_song_handle_t(Common::SeekableReadStream *fh, song_handle_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_int(Common::WriteStream *fh, int* save_struc);
static int _cfsml_read_int(Common::SeekableReadStream *fh, int* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_SavegameMetadata(Common::WriteStream *fh, SavegameMetadata* save_struc);
static int _cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_menu_t(Common::WriteStream *fh, menu_t* save_struc);
static int _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_clone_table_t(Common::WriteStream *fh, clone_table_t* save_struc);
static int _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_clone_t(Common::WriteStream *fh, clone_t* save_struc);
static int _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_list_t(Common::WriteStream *fh, list_t* save_struc);
static int _cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_sys_string_t(Common::WriteStream *fh, sys_string_t* save_struc);
static int _cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_script_t(Common::WriteStream *fh, script_t* save_struc);
static int _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 383 "savegame.cfsml"
+#line 383 "../../engines/sci/engine/savegame.cfsml"
static void _cfsml_write_seg_manager_t(Common::WriteStream *fh, seg_manager_t* save_struc);
static int _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_struc, const char *lastval, int *line, int *hiteof);
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_sfx_state_t(Common::WriteStream *fh, sfx_state_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "songlib = ");
write_songlib_t(fh, (songlib_t*) &(save_struc->songlib));
@@ -583,14 +581,13 @@ _cfsml_write_sfx_state_t(Common::WriteStream *fh, sfx_state_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record sfx_state_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -621,13 +618,13 @@ _cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc,
return CFSML_FAILURE;
}
if (!strcmp(token, "songlib")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_songlib_t(fh, (songlib_t*) &(save_struc->songlib), value, line, hiteof)) {
_cfsml_error("Token expected by read_songlib_t() for songlib at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("sfx_state_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -637,13 +634,11 @@ _cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc,
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_clone_entry_t(Common::WriteStream *fh, clone_entry_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "next_free = ");
_cfsml_write_int(fh, (int*) &(save_struc->next_free));
@@ -654,14 +649,13 @@ _cfsml_write_clone_entry_t(Common::WriteStream *fh, clone_entry_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record clone_entry_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -692,20 +686,20 @@ _cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_st
return CFSML_FAILURE;
}
if (!strcmp(token, "next_free")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->next_free), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for next_free at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "entry")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_clone_t(fh, (clone_t*) &(save_struc->entry), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_clone_t() for entry at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("clone_entry_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -715,13 +709,11 @@ _cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_st
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_object_t(Common::WriteStream *fh, object_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "flags = ");
_cfsml_write_int(fh, (int*) &(save_struc->flags));
@@ -739,12 +731,13 @@ _cfsml_write_object_t(Common::WriteStream *fh, object_t* save_struc)
_cfsml_write_int(fh, (int*) &(save_struc->methods_nr));
WSprintf(fh, "\n");
WSprintf(fh, "variables = ");
+ int min, max;
min = max = save_struc->variables_nr;
if (!save_struc->variables)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
write_reg_t(fh, &(save_struc->variables[i]));
WSprintf(fh, "\n");
}
@@ -753,14 +746,13 @@ _cfsml_write_object_t(Common::WriteStream *fh, object_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record object_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -791,47 +783,48 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const
return CFSML_FAILURE;
}
if (!strcmp(token, "flags")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->flags), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for flags at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "pos")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->pos), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for pos at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "variables_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->variables_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for variables_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "variable_names_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->variable_names_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for variable_names_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "methods_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->methods_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for methods_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "variables")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -847,11 +840,11 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const
_cfsml_register_pointer(save_struc->variables);
} else
save_struc->variables = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -869,7 +862,7 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const
} while (!done);
save_struc->variables_nr = max ; // Set array size accordingly
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("object_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -879,11 +872,11 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_string(Common::WriteStream *fh, char ** save_struc)
{
-#line 405 "savegame.cfsml"
+#line 402 "../../engines/sci/engine/savegame.cfsml"
if (!(*save_struc))
WSprintf(fh, "\\null\\");
else {
@@ -893,12 +886,11 @@ _cfsml_write_string(Common::WriteStream *fh, char ** save_struc)
}
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_string(Common::SeekableReadStream *fh, char ** save_struc, const char *lastval, int *line, int *hiteof)
{
- char *token;
-#line 524 "savegame.cfsml"
+#line 519 "../../engines/sci/engine/savegame.cfsml"
if (strcmp(lastval, "\\null\\")) { // null pointer?
unsigned int length = strlen(lastval);
@@ -923,21 +915,20 @@ _cfsml_read_string(Common::SeekableReadStream *fh, char ** save_struc, const cha
}
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_menubar_t(Common::WriteStream *fh, menubar_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "menus = ");
+ int min, max;
min = max = save_struc->menus_nr;
if (!save_struc->menus)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_menu_t(fh, &(save_struc->menus[i]));
WSprintf(fh, "\n");
}
@@ -946,14 +937,13 @@ _cfsml_write_menubar_t(Common::WriteStream *fh, menubar_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record menubar_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -984,12 +974,13 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con
return CFSML_FAILURE;
}
if (!strcmp(token, "menus")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -1005,11 +996,11 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con
_cfsml_register_pointer(save_struc->menus);
} else
save_struc->menus = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -1027,7 +1018,7 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con
} while (!done);
save_struc->menus_nr = max ; // Set array size accordingly
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("menubar_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -1037,19 +1028,19 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_size_t(Common::WriteStream *fh, size_t* save_struc)
{
WSprintf(fh, "%li", (long)*save_struc);
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_size_t(Common::SeekableReadStream *fh, size_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 506 "../../engines/sci/engine/savegame.cfsml"
char *token;
-#line 512 "savegame.cfsml"
*save_struc = strtol(lastval, &token, 0);
if ((*save_struc == 0) && (token == lastval)) {
@@ -1063,13 +1054,11 @@ _cfsml_read_size_t(Common::SeekableReadStream *fh, size_t* save_struc, const cha
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_list_entry_t(Common::WriteStream *fh, list_entry_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "next_free = ");
_cfsml_write_int(fh, (int*) &(save_struc->next_free));
@@ -1080,14 +1069,13 @@ _cfsml_write_list_entry_t(Common::WriteStream *fh, list_entry_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record list_entry_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -1118,20 +1106,20 @@ _cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_stru
return CFSML_FAILURE;
}
if (!strcmp(token, "next_free")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->next_free), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for next_free at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "entry")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_list_t(fh, (list_t*) &(save_struc->entry), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_list_t() for entry at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("list_entry_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -1141,22 +1129,21 @@ _cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_stru
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_int_hash_map_t(Common::WriteStream *fh, int_hash_map_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "base_value = ");
_cfsml_write_int(fh, (int*) &(save_struc->base_value));
WSprintf(fh, "\n");
WSprintf(fh, "nodes = ");
+ int min, max;
min = max = DCS_INT_HASH_MAX+1;
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
write_int_hash_map_node_tp(fh, &(save_struc->nodes[i]));
WSprintf(fh, "\n");
}
@@ -1165,14 +1152,13 @@ _cfsml_write_int_hash_map_t(Common::WriteStream *fh, int_hash_map_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record int_hash_map_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -1203,25 +1189,26 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_
return CFSML_FAILURE;
}
if (!strcmp(token, "base_value")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->base_value), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for base_value at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "nodes")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
+ int max,done,i;
// Prepare to restore static array
max = DCS_INT_HASH_MAX+1;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -1238,7 +1225,7 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_
done = 1;
} while (!done);
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("int_hash_map_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -1248,13 +1235,11 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_song_t(Common::WriteStream *fh, song_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "handle = ");
_cfsml_write_song_handle_t(fh, (song_handle_t*) &(save_struc->handle));
@@ -1283,14 +1268,13 @@ _cfsml_write_song_t(Common::WriteStream *fh, song_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record song_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -1321,62 +1305,62 @@ _cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const cha
return CFSML_FAILURE;
}
if (!strcmp(token, "handle")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_song_handle_t(fh, (song_handle_t*) &(save_struc->handle), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_song_handle_t() for handle at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "resource_num")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->resource_num), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for resource_num at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "priority")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->priority), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for priority at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "status")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->status), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for status at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "restore_behavior")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->restore_behavior), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for restore_behavior at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "restore_time")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->restore_time), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for restore_time at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "loops")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->loops), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for loops at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "hold")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->hold), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for hold at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("song_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -1386,13 +1370,11 @@ _cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const cha
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_menu_item_t(Common::WriteStream *fh, menu_item_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "type = ");
_cfsml_write_int(fh, (int*) &(save_struc->type));
@@ -1407,10 +1389,11 @@ _cfsml_write_menu_item_t(Common::WriteStream *fh, menu_item_t* save_struc)
_cfsml_write_int(fh, (int*) &(save_struc->flags));
WSprintf(fh, "\n");
WSprintf(fh, "said = ");
+ int min, max;
min = max = MENU_SAID_SPEC_SIZE;
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_byte(fh, &(save_struc->said[i]));
WSprintf(fh, "\n");
}
@@ -1440,14 +1423,13 @@ _cfsml_write_menu_item_t(Common::WriteStream *fh, menu_item_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record menu_item_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -1478,46 +1460,47 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc,
return CFSML_FAILURE;
}
if (!strcmp(token, "type")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->type), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for type at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "keytext")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_string(fh, (char **) &(save_struc->keytext), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_string() for keytext at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "keytext_size")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->keytext_size), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for keytext_size at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "flags")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->flags), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for flags at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "said")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
+ int max,done,i;
// Prepare to restore static array
max = MENU_SAID_SPEC_SIZE;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -1535,55 +1518,55 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc,
} while (!done);
} else
if (!strcmp(token, "said_pos")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->said_pos), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for said_pos at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "text")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_string(fh, (char **) &(save_struc->text), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_string() for text at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "text_pos")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->text_pos), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for text_pos at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "modifiers")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->modifiers), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for modifiers at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "key")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->key), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for key at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "enabled")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->enabled), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for enabled at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "tag")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->tag), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for tag at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("menu_item_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -1593,13 +1576,11 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc,
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_node_entry_t(Common::WriteStream *fh, node_entry_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "next_free = ");
_cfsml_write_int(fh, (int*) &(save_struc->next_free));
@@ -1610,14 +1591,13 @@ _cfsml_write_node_entry_t(Common::WriteStream *fh, node_entry_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record node_entry_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -1648,20 +1628,20 @@ _cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_stru
return CFSML_FAILURE;
}
if (!strcmp(token, "next_free")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->next_free), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for next_free at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "entry")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_node_t(fh, (node_t*) &(save_struc->entry), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_node_t() for entry at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("node_entry_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -1671,19 +1651,19 @@ _cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_stru
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_seg_id_t(Common::WriteStream *fh, seg_id_t* save_struc)
{
WSprintf(fh, "%li", (long)*save_struc);
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_seg_id_t(Common::SeekableReadStream *fh, seg_id_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 506 "../../engines/sci/engine/savegame.cfsml"
char *token;
-#line 512 "savegame.cfsml"
*save_struc = strtol(lastval, &token, 0);
if ((*save_struc == 0) && (token == lastval)) {
@@ -1697,13 +1677,11 @@ _cfsml_read_seg_id_t(Common::SeekableReadStream *fh, seg_id_t* save_struc, const
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_dynmem_t(Common::WriteStream *fh, dynmem_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "size = ");
_cfsml_write_int(fh, (int*) &(save_struc->size));
@@ -1712,12 +1690,13 @@ _cfsml_write_dynmem_t(Common::WriteStream *fh, dynmem_t* save_struc)
_cfsml_write_string(fh, (char **) &(save_struc->description));
WSprintf(fh, "\n");
WSprintf(fh, "buf = ");
+ int min, max;
min = max = save_struc->size;
if (!save_struc->buf)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_byte(fh, &(save_struc->buf[i]));
WSprintf(fh, "\n");
}
@@ -1726,14 +1705,13 @@ _cfsml_write_dynmem_t(Common::WriteStream *fh, dynmem_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record dynmem_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -1764,26 +1742,27 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const
return CFSML_FAILURE;
}
if (!strcmp(token, "size")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->size), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for size at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "description")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_string(fh, (char **) &(save_struc->description), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_string() for description at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "buf")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -1799,11 +1778,11 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const
_cfsml_register_pointer(save_struc->buf);
} else
save_struc->buf = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -1821,7 +1800,7 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const
} while (!done);
save_struc->size = max ; // Set array size accordingly
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("dynmem_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -1831,13 +1810,11 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_local_variables_t(Common::WriteStream *fh, local_variables_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "script_id = ");
_cfsml_write_int(fh, (int*) &(save_struc->script_id));
@@ -1846,12 +1823,13 @@ _cfsml_write_local_variables_t(Common::WriteStream *fh, local_variables_t* save_
_cfsml_write_int(fh, (int*) &(save_struc->nr));
WSprintf(fh, "\n");
WSprintf(fh, "locals = ");
+ int min, max;
min = max = save_struc->nr;
if (!save_struc->locals)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
write_reg_t(fh, &(save_struc->locals[i]));
WSprintf(fh, "\n");
}
@@ -1860,14 +1838,13 @@ _cfsml_write_local_variables_t(Common::WriteStream *fh, local_variables_t* save_
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record local_variables_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -1898,26 +1875,27 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t*
return CFSML_FAILURE;
}
if (!strcmp(token, "script_id")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->script_id), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for script_id at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "locals")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -1933,11 +1911,11 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t*
_cfsml_register_pointer(save_struc->locals);
} else
save_struc->locals = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -1955,7 +1933,7 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t*
} while (!done);
save_struc->nr = max ; // Set array size accordingly
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("local_variables_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -1965,13 +1943,11 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t*
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_state_t(Common::WriteStream *fh, state_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "savegame_version = ");
_cfsml_write_int(fh, (int*) &(save_struc->savegame_version));
@@ -1998,12 +1974,13 @@ _cfsml_write_state_t(Common::WriteStream *fh, state_t* save_struc)
_cfsml_write_int(fh, (int*) &(save_struc->classtable_size));
WSprintf(fh, "\n");
WSprintf(fh, "classtable = ");
+ int min, max;
min = max = save_struc->classtable_size;
if (!save_struc->classtable)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_class_t(fh, &(save_struc->classtable[i]));
WSprintf(fh, "\n");
}
@@ -2015,14 +1992,13 @@ _cfsml_write_state_t(Common::WriteStream *fh, state_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_state_t(Common::SeekableReadStream *fh, state_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record state_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -2053,68 +2029,69 @@ _cfsml_read_state_t(Common::SeekableReadStream *fh, state_t* save_struc, const c
return CFSML_FAILURE;
}
if (!strcmp(token, "savegame_version")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_version), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for savegame_version at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "game_version")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_string(fh, (char **) &(save_struc->game_version), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_string() for game_version at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "version")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_sci_version(fh, (sci_version_t*) &(save_struc->version), value, line, hiteof)) {
_cfsml_error("Token expected by read_sci_version() for version at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "menubar")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_menubar_tp(fh, (menubar_t **) &(save_struc->menubar), value, line, hiteof)) {
_cfsml_error("Token expected by read_menubar_tp() for menubar at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "status_bar_foreground")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->status_bar_foreground), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for status_bar_foreground at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "status_bar_background")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->status_bar_background), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for status_bar_background at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "seg_manager")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_seg_manager_t(fh, (seg_manager_t*) &(save_struc->seg_manager), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_seg_manager_t() for seg_manager at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "classtable_size")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->classtable_size), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for classtable_size at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "classtable")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -2130,11 +2107,11 @@ _cfsml_read_state_t(Common::SeekableReadStream *fh, state_t* save_struc, const c
_cfsml_register_pointer(save_struc->classtable);
} else
save_struc->classtable = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -2153,13 +2130,13 @@ _cfsml_read_state_t(Common::SeekableReadStream *fh, state_t* save_struc, const c
save_struc->classtable_size = max ; // Set array size accordingly
} else
if (!strcmp(token, "sound")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_sfx_state_t(fh, (sfx_state_t*) &(save_struc->sound), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_sfx_state_t() for sound at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("state_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -2169,13 +2146,11 @@ _cfsml_read_state_t(Common::SeekableReadStream *fh, state_t* save_struc, const c
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_node_table_t(Common::WriteStream *fh, node_table_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "entries_nr = ");
_cfsml_write_int(fh, (int*) &(save_struc->entries_nr));
@@ -2190,12 +2165,13 @@ _cfsml_write_node_table_t(Common::WriteStream *fh, node_table_t* save_struc)
_cfsml_write_int(fh, (int*) &(save_struc->max_entry));
WSprintf(fh, "\n");
WSprintf(fh, "table = ");
+ int min, max;
min = max = save_struc->entries_nr;
if (!save_struc->table)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_node_entry_t(fh, &(save_struc->table[i]));
WSprintf(fh, "\n");
}
@@ -2204,14 +2180,13 @@ _cfsml_write_node_table_t(Common::WriteStream *fh, node_table_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record node_table_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -2242,40 +2217,41 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru
return CFSML_FAILURE;
}
if (!strcmp(token, "entries_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->entries_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for entries_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "first_free")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->first_free), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for first_free at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "entries_used")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->entries_used), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for entries_used at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "max_entry")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->max_entry), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for max_entry at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "table")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -2291,11 +2267,11 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru
_cfsml_register_pointer(save_struc->table);
} else
save_struc->table = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -2313,7 +2289,7 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru
} while (!done);
save_struc->entries_nr = max ; // Set array size accordingly
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("node_table_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -2323,19 +2299,18 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_sys_strings_t(Common::WriteStream *fh, sys_strings_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "strings = ");
+ int min, max;
min = max = SYS_STRINGS_MAX;
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_sys_string_t(fh, &(save_struc->strings[i]));
WSprintf(fh, "\n");
}
@@ -2344,14 +2319,13 @@ _cfsml_write_sys_strings_t(Common::WriteStream *fh, sys_strings_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record sys_strings_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -2382,18 +2356,19 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st
return CFSML_FAILURE;
}
if (!strcmp(token, "strings")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
+ int max,done,i;
// Prepare to restore static array
max = SYS_STRINGS_MAX;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -2410,7 +2385,7 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st
done = 1;
} while (!done);
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("sys_strings_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -2420,19 +2395,19 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_byte(Common::WriteStream *fh, byte* save_struc)
{
WSprintf(fh, "%li", (long)*save_struc);
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_byte(Common::SeekableReadStream *fh, byte* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 506 "../../engines/sci/engine/savegame.cfsml"
char *token;
-#line 512 "savegame.cfsml"
*save_struc = strtol(lastval, &token, 0);
if ((*save_struc == 0) && (token == lastval)) {
@@ -2446,13 +2421,11 @@ _cfsml_read_byte(Common::SeekableReadStream *fh, byte* save_struc, const char *l
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_node_t(Common::WriteStream *fh, node_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "pred = ");
write_reg_t(fh, (reg_t*) &(save_struc->pred));
@@ -2469,14 +2442,13 @@ _cfsml_write_node_t(Common::WriteStream *fh, node_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record node_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -2507,34 +2479,34 @@ _cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const cha
return CFSML_FAILURE;
}
if (!strcmp(token, "pred")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->pred), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for pred at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "succ")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->succ), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for succ at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "key")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->key), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for key at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "value")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->value), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for value at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("node_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -2544,13 +2516,11 @@ _cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const cha
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_list_table_t(Common::WriteStream *fh, list_table_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "entries_nr = ");
_cfsml_write_int(fh, (int*) &(save_struc->entries_nr));
@@ -2565,12 +2535,13 @@ _cfsml_write_list_table_t(Common::WriteStream *fh, list_table_t* save_struc)
_cfsml_write_int(fh, (int*) &(save_struc->max_entry));
WSprintf(fh, "\n");
WSprintf(fh, "table = ");
+ int min, max;
min = max = save_struc->entries_nr;
if (!save_struc->table)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_list_entry_t(fh, &(save_struc->table[i]));
WSprintf(fh, "\n");
}
@@ -2579,14 +2550,13 @@ _cfsml_write_list_table_t(Common::WriteStream *fh, list_table_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record list_table_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -2617,40 +2587,41 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru
return CFSML_FAILURE;
}
if (!strcmp(token, "entries_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->entries_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for entries_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "first_free")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->first_free), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for first_free at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "entries_used")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->entries_used), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for entries_used at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "max_entry")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->max_entry), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for max_entry at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "table")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -2666,11 +2637,11 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru
_cfsml_register_pointer(save_struc->table);
} else
save_struc->table = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -2688,7 +2659,7 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru
} while (!done);
save_struc->entries_nr = max ; // Set array size accordingly
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("list_table_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -2698,13 +2669,11 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_class_t(Common::WriteStream *fh, class_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "script = ");
_cfsml_write_int(fh, (int*) &(save_struc->script));
@@ -2715,14 +2684,13 @@ _cfsml_write_class_t(Common::WriteStream *fh, class_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record class_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -2753,20 +2721,20 @@ _cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const c
return CFSML_FAILURE;
}
if (!strcmp(token, "script")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->script), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for script at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "reg")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->reg), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for reg at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("class_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -2776,19 +2744,19 @@ _cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const c
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_song_handle_t(Common::WriteStream *fh, song_handle_t* save_struc)
{
WSprintf(fh, "%li", (long)*save_struc);
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_song_handle_t(Common::SeekableReadStream *fh, song_handle_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 506 "../../engines/sci/engine/savegame.cfsml"
char *token;
-#line 512 "savegame.cfsml"
*save_struc = strtol(lastval, &token, 0);
if ((*save_struc == 0) && (token == lastval)) {
@@ -2802,19 +2770,19 @@ _cfsml_read_song_handle_t(Common::SeekableReadStream *fh, song_handle_t* save_st
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_int(Common::WriteStream *fh, int* save_struc)
{
WSprintf(fh, "%li", (long)*save_struc);
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_int(Common::SeekableReadStream *fh, int* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 506 "../../engines/sci/engine/savegame.cfsml"
char *token;
-#line 512 "savegame.cfsml"
*save_struc = strtol(lastval, &token, 0);
if ((*save_struc == 0) && (token == lastval)) {
@@ -2828,13 +2796,11 @@ _cfsml_read_int(Common::SeekableReadStream *fh, int* save_struc, const char *las
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_SavegameMetadata(Common::WriteStream *fh, SavegameMetadata* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "savegame_name = ");
_cfsml_write_string(fh, (char **) &(save_struc->savegame_name));
@@ -2857,14 +2823,13 @@ _cfsml_write_SavegameMetadata(Common::WriteStream *fh, SavegameMetadata* save_st
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record SavegameMetadata; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -2895,48 +2860,48 @@ _cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* s
return CFSML_FAILURE;
}
if (!strcmp(token, "savegame_name")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_string(fh, (char **) &(save_struc->savegame_name), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_string() for savegame_name at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "savegame_version")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_version), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for savegame_version at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "game_version")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_string(fh, (char **) &(save_struc->game_version), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_string() for game_version at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "version")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_sci_version(fh, (sci_version_t*) &(save_struc->version), value, line, hiteof)) {
_cfsml_error("Token expected by read_sci_version() for version at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "savegame_date")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_date), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for savegame_date at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "savegame_time")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_time), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for savegame_time at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("SavegameMetadata: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -2946,13 +2911,11 @@ _cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* s
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_menu_t(Common::WriteStream *fh, menu_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "title = ");
_cfsml_write_string(fh, (char **) &(save_struc->title));
@@ -2964,12 +2927,13 @@ _cfsml_write_menu_t(Common::WriteStream *fh, menu_t* save_struc)
_cfsml_write_int(fh, (int*) &(save_struc->width));
WSprintf(fh, "\n");
WSprintf(fh, "items = ");
+ int min, max;
min = max = save_struc->items_nr;
if (!save_struc->items)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_menu_item_t(fh, &(save_struc->items[i]));
WSprintf(fh, "\n");
}
@@ -2978,14 +2942,13 @@ _cfsml_write_menu_t(Common::WriteStream *fh, menu_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record menu_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -3016,33 +2979,34 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha
return CFSML_FAILURE;
}
if (!strcmp(token, "title")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_string(fh, (char **) &(save_struc->title), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_string() for title at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "title_width")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->title_width), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for title_width at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "width")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->width), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for width at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "items")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -3058,11 +3022,11 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha
_cfsml_register_pointer(save_struc->items);
} else
save_struc->items = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -3080,7 +3044,7 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha
} while (!done);
save_struc->items_nr = max ; // Set array size accordingly
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("menu_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -3090,13 +3054,11 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_clone_table_t(Common::WriteStream *fh, clone_table_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "entries_nr = ");
_cfsml_write_int(fh, (int*) &(save_struc->entries_nr));
@@ -3111,12 +3073,13 @@ _cfsml_write_clone_table_t(Common::WriteStream *fh, clone_table_t* save_struc)
_cfsml_write_int(fh, (int*) &(save_struc->max_entry));
WSprintf(fh, "\n");
WSprintf(fh, "table = ");
+ int min, max;
min = max = save_struc->entries_nr;
if (!save_struc->table)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_clone_entry_t(fh, &(save_struc->table[i]));
WSprintf(fh, "\n");
}
@@ -3125,14 +3088,13 @@ _cfsml_write_clone_table_t(Common::WriteStream *fh, clone_table_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record clone_table_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -3163,40 +3125,41 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st
return CFSML_FAILURE;
}
if (!strcmp(token, "entries_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->entries_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for entries_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "first_free")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->first_free), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for first_free at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "entries_used")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->entries_used), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for entries_used at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "max_entry")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->max_entry), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for max_entry at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "table")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -3212,11 +3175,11 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st
_cfsml_register_pointer(save_struc->table);
} else
save_struc->table = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -3234,7 +3197,7 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st
} while (!done);
save_struc->entries_nr = max ; // Set array size accordingly
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("clone_table_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -3244,13 +3207,11 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_clone_t(Common::WriteStream *fh, clone_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "flags = ");
_cfsml_write_int(fh, (int*) &(save_struc->flags));
@@ -3268,12 +3229,13 @@ _cfsml_write_clone_t(Common::WriteStream *fh, clone_t* save_struc)
_cfsml_write_int(fh, (int*) &(save_struc->methods_nr));
WSprintf(fh, "\n");
WSprintf(fh, "variables = ");
+ int min, max;
min = max = save_struc->variables_nr;
if (!save_struc->variables)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
write_reg_t(fh, &(save_struc->variables[i]));
WSprintf(fh, "\n");
}
@@ -3282,14 +3244,13 @@ _cfsml_write_clone_t(Common::WriteStream *fh, clone_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record clone_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -3320,47 +3281,48 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c
return CFSML_FAILURE;
}
if (!strcmp(token, "flags")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->flags), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for flags at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "pos")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->pos), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for pos at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "variables_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->variables_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for variables_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "variable_names_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->variable_names_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for variable_names_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "methods_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->methods_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for methods_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "variables")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -3376,11 +3338,11 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c
_cfsml_register_pointer(save_struc->variables);
} else
save_struc->variables = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -3398,7 +3360,7 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c
} while (!done);
save_struc->variables_nr = max ; // Set array size accordingly
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("clone_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -3408,13 +3370,11 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_list_t(Common::WriteStream *fh, list_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "first = ");
write_reg_t(fh, (reg_t*) &(save_struc->first));
@@ -3425,14 +3385,13 @@ _cfsml_write_list_t(Common::WriteStream *fh, list_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record list_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -3463,20 +3422,20 @@ _cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const cha
return CFSML_FAILURE;
}
if (!strcmp(token, "first")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->first), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for first at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "last")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_reg_t(fh, (reg_t*) &(save_struc->last), value, line, hiteof)) {
_cfsml_error("Token expected by read_reg_t() for last at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("list_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -3486,13 +3445,11 @@ _cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const cha
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_sys_string_t(Common::WriteStream *fh, sys_string_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "name = ");
_cfsml_write_string(fh, (char **) &(save_struc->name));
@@ -3506,14 +3463,13 @@ _cfsml_write_sys_string_t(Common::WriteStream *fh, sys_string_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record sys_string_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -3544,27 +3500,27 @@ _cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_stru
return CFSML_FAILURE;
}
if (!strcmp(token, "name")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_string(fh, (char **) &(save_struc->name), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_string() for name at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "max_size")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->max_size), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for max_size at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "value")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_string(fh, (char **) &(save_struc->value), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_string() for value at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("sys_string_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -3574,13 +3530,11 @@ _cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_stru
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_script_t(Common::WriteStream *fh, script_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "nr = ");
_cfsml_write_int(fh, (int*) &(save_struc->nr));
@@ -3613,12 +3567,13 @@ _cfsml_write_script_t(Common::WriteStream *fh, script_t* save_struc)
_cfsml_write_int(fh, (int*) &(save_struc->objects_nr));
WSprintf(fh, "\n");
WSprintf(fh, "objects = ");
+ int min, max;
min = max = save_struc->objects_allocated;
if (!save_struc->objects)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
_cfsml_write_object_t(fh, &(save_struc->objects[i]));
WSprintf(fh, "\n");
}
@@ -3636,14 +3591,13 @@ _cfsml_write_script_t(Common::WriteStream *fh, script_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record script_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -3674,82 +3628,83 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const
return CFSML_FAILURE;
}
if (!strcmp(token, "nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "buf_size")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->buf_size), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_size_t() for buf_size at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "script_size")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->script_size), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_size_t() for script_size at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "heap_size")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->heap_size), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_size_t() for heap_size at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "obj_indices")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_int_hash_map_tp(fh, (int_hash_map_t **) &(save_struc->obj_indices), value, line, hiteof)) {
_cfsml_error("Token expected by read_int_hash_map_tp() for obj_indices at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "exports_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->exports_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for exports_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "synonyms_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->synonyms_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for synonyms_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "lockers")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->lockers), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for lockers at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "objects_allocated")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->objects_allocated), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for objects_allocated at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "objects_nr")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->objects_nr), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for objects_nr at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "objects")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -3765,11 +3720,11 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const
_cfsml_register_pointer(save_struc->objects);
} else
save_struc->objects = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -3788,27 +3743,27 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const
save_struc->objects_allocated = max ; // Set array size accordingly
} else
if (!strcmp(token, "locals_offset")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->locals_offset), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for locals_offset at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "locals_segment")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->locals_segment), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for locals_segment at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "marked_as_deleted")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->marked_as_deleted), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for marked_as_deleted at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("script_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -3818,24 +3773,23 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const
return CFSML_SUCCESS;
}
-#line 395 "savegame.cfsml"
+#line 395 "../../engines/sci/engine/savegame.cfsml"
static void
_cfsml_write_seg_manager_t(Common::WriteStream *fh, seg_manager_t* save_struc)
{
- int min, max, i;
-
-#line 415 "savegame.cfsml"
+#line 412 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "{\n");
WSprintf(fh, "id_seg_map = ");
write_int_hash_map_tp(fh, (int_hash_map_t **) &(save_struc->id_seg_map));
WSprintf(fh, "\n");
WSprintf(fh, "heap = ");
+ int min, max;
min = max = save_struc->heap_size;
if (!save_struc->heap)
min = max = 0; /* Don't write if it points to NULL */
-#line 441 "savegame.cfsml"
+#line 439 "../../engines/sci/engine/savegame.cfsml"
WSprintf(fh, "[%d][\n", max);
- for (i = 0; i < min; i++) {
+ for (int i = 0; i < min; i++) {
write_mem_obj_tp(fh, &(save_struc->heap[i]));
WSprintf(fh, "\n");
}
@@ -3871,14 +3825,13 @@ _cfsml_write_seg_manager_t(Common::WriteStream *fh, seg_manager_t* save_struc)
WSprintf(fh, "}");
}
-#line 488 "savegame.cfsml"
+#line 486 "../../engines/sci/engine/savegame.cfsml"
static int
_cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_struc, const char *lastval, int *line, int *hiteof)
{
+#line 541 "../../engines/sci/engine/savegame.cfsml"
char *token;
- int min, max, i;
-#line 546 "savegame.cfsml"
- int assignment, closed, done;
+ int assignment, closed;
if (strcmp(lastval, "{")) {
_cfsml_error("Reading record seg_manager_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval);
@@ -3909,19 +3862,20 @@ _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_st
return CFSML_FAILURE;
}
if (!strcmp(token, "id_seg_map")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (read_int_hash_map_tp(fh, (int_hash_map_t **) &(save_struc->id_seg_map), value, line, hiteof)) {
_cfsml_error("Token expected by read_int_hash_map_tp() for id_seg_map at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "heap")) {
-#line 608 "savegame.cfsml"
+#line 604 "../../engines/sci/engine/savegame.cfsml"
if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
return CFSML_FAILURE;
}
-#line 618 "savegame.cfsml"
+ int max,done,i;
+#line 615 "../../engines/sci/engine/savegame.cfsml"
// Prepare to restore dynamic array
max = strtol(value + 1, NULL, 0);
if (max < 0) {
@@ -3937,11 +3891,11 @@ _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_st
_cfsml_register_pointer(save_struc->heap);
} else
save_struc->heap = NULL;
-#line 642 "savegame.cfsml"
+#line 639 "../../engines/sci/engine/savegame.cfsml"
done = i = 0;
do {
if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) {
-#line 650 "savegame.cfsml"
+#line 647 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error("Token expected at line %d\n", *line);
return 1;
}
@@ -3960,69 +3914,69 @@ _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_st
save_struc->heap_size = max ; // Set array size accordingly
} else
if (!strcmp(token, "heap_size")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->heap_size), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for heap_size at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "reserved_id")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->reserved_id), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for reserved_id at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "exports_wide")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->exports_wide), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for exports_wide at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "sci1_1")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->sci1_1), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for sci1_1 at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "gc_mark_bits")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_int(fh, (int*) &(save_struc->gc_mark_bits), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_int() for gc_mark_bits at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "mem_allocated")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->mem_allocated), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_size_t() for mem_allocated at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "clones_seg_id")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_seg_id_t(fh, (seg_id_t*) &(save_struc->clones_seg_id), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_seg_id_t() for clones_seg_id at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "lists_seg_id")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_seg_id_t(fh, (seg_id_t*) &(save_struc->lists_seg_id), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_seg_id_t() for lists_seg_id at line %d\n", *line);
return CFSML_FAILURE;
}
} else
if (!strcmp(token, "nodes_seg_id")) {
-#line 693 "savegame.cfsml"
+#line 690 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_read_seg_id_t(fh, (seg_id_t*) &(save_struc->nodes_seg_id), value, line, hiteof)) {
_cfsml_error("Token expected by _cfsml_read_seg_id_t() for nodes_seg_id at line %d\n", *line);
return CFSML_FAILURE;
}
} else
-#line 702 "savegame.cfsml"
+#line 699 "../../engines/sci/engine/savegame.cfsml"
{
_cfsml_error("seg_manager_t: Assignment to invalid identifier '%s' in line %d\n", token, *line);
return CFSML_FAILURE;
@@ -4035,7 +3989,7 @@ _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_st
// Auto-generated CFSML declaration and function block ends here
// Auto-generation performed by cfsml.pl 0.8.2
-#line 444 "savegame.cfsml"
+#line 444 "../../engines/sci/engine/savegame.cfsml"
void write_songlib_t(Common::WriteStream *fh, songlib_t *songlib) {
song_t *seeker = *(songlib->lib);
@@ -4047,12 +4001,12 @@ void write_songlib_t(Common::WriteStream *fh, songlib_t *songlib) {
WSprintf(fh, "[\n");
while (seeker) {
seeker->restore_time = seeker->it->get_timepos(seeker->it);
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_song_t(fh, seeker);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 456 "savegame.cfsml"
+#line 456 "../../engines/sci/engine/savegame.cfsml"
seeker = seeker->next;
}
WSprintf(fh, "]\n");
@@ -4063,7 +4017,6 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha
int songcount;
int i;
song_t *newsong;
- int oldstatus;
if (strcmp(lastval, "{")) {
_cfsml_error("Opening brackets expected at line %d\n", *line);
@@ -4078,18 +4031,17 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha
song_lib_init(songlib);
for (i = 0; i < songcount; i++) {
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 782 "savegame.cfsml"
+#line 778 "../../engines/sci/engine/savegame.cfsml"
const char *_cfsml_inp = lastval;
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = read_song_tp(fh, &newsong, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4100,7 +4052,7 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha
}
}
// End of auto-generated CFSML data reader code
-#line 481 "savegame.cfsml"
+#line 480 "../../engines/sci/engine/savegame.cfsml"
song_lib_add(*songlib, newsong);
}
l = fh->readLine(); // "]"
@@ -4109,7 +4061,7 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha
return 0;
}
-struct {
+static struct {
int type;
const char *name;
} mem_obj_string_names[] = {
@@ -4135,24 +4087,22 @@ int mem_obj_string_to_enum(const char *str) {
return -1;
}
-static int bucket_length;
-
void write_int_hash_map_tp(Common::WriteStream *fh, int_hash_map_t **foo) {
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_int_hash_map_t(fh, *foo);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 519 "savegame.cfsml"
+#line 516 "../../engines/sci/engine/savegame.cfsml"
}
void write_song_tp(Common::WriteStream *fh, song_t **foo) {
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_song_t(fh, *foo);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 523 "savegame.cfsml"
+#line 520 "../../engines/sci/engine/savegame.cfsml"
}
song_iterator_t *build_iterator(state_t *s, int song_nr, int type, songit_id_t id);
@@ -4163,18 +4113,17 @@ int read_song_tp(Common::SeekableReadStream *fh, song_t **foo, const char *lastv
*foo = (song_t*) malloc(sizeof(song_t));
token = _cfsml_get_identifier(fh, line, hiteof, &assignment);
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 782 "savegame.cfsml"
+#line 778 "../../engines/sci/engine/savegame.cfsml"
const char *_cfsml_inp = token;
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_song_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4185,7 +4134,7 @@ int read_song_tp(Common::SeekableReadStream *fh, song_t **foo, const char *lastv
}
}
// End of auto-generated CFSML data reader code
-#line 533 "savegame.cfsml"
+#line 530 "../../engines/sci/engine/savegame.cfsml"
(*foo)->delay = 0;
(*foo)->it = NULL;
(*foo)->next_playing = (*foo)->next_stopping = (*foo)->next = NULL;
@@ -4195,18 +4144,17 @@ int read_song_tp(Common::SeekableReadStream *fh, song_t **foo, const char *lastv
int read_int_hash_map_tp(Common::SeekableReadStream *fh, int_hash_map_t **foo, const char *lastval, int *line, int *hiteof) {
*foo = new int_hash_map_t;
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 782 "savegame.cfsml"
+#line 778 "../../engines/sci/engine/savegame.cfsml"
const char *_cfsml_inp = lastval;
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_int_hash_map_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4217,7 +4165,7 @@ int read_int_hash_map_tp(Common::SeekableReadStream *fh, int_hash_map_t **foo, c
}
}
// End of auto-generated CFSML data reader code
-#line 542 "savegame.cfsml"
+#line 539 "../../engines/sci/engine/savegame.cfsml"
(*foo)->holes = NULL;
return 0;
}
@@ -4228,12 +4176,12 @@ void write_int_hash_map_node_tp(Common::WriteStream *fh, int_hash_map_t::node_t
} else {
WSprintf(fh,"[\n%d=>%d\n", (*foo)->name, (*foo)->value);
if ((*foo)->next) {
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
write_int_hash_map_node_tp(fh, &((*foo)->next));
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 553 "savegame.cfsml"
+#line 550 "../../engines/sci/engine/savegame.cfsml"
} else
WSprintf(fh, "L");
WSprintf(fh, "]");
@@ -4278,12 +4226,12 @@ int read_int_hash_map_node_tp(Common::SeekableReadStream *fh, int_hash_map_t::no
void write_menubar_tp(Common::WriteStream *fh, menubar_t **foo) {
if (*foo) {
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_menubar_t(fh, (*foo));
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 598 "savegame.cfsml"
+#line 595 "../../engines/sci/engine/savegame.cfsml"
} else { // Nothing to write
WSprintf(fh, "\\null\\");
}
@@ -4296,18 +4244,17 @@ int read_menubar_tp(Common::SeekableReadStream *fh, menubar_t **foo, const char
} else {
*foo = (menubar_t *) sci_malloc(sizeof(menubar_t));
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 782 "savegame.cfsml"
+#line 778 "../../engines/sci/engine/savegame.cfsml"
const char *_cfsml_inp = lastval;
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_menubar_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4318,91 +4265,90 @@ int read_menubar_tp(Common::SeekableReadStream *fh, menubar_t **foo, const char
}
}
// End of auto-generated CFSML data reader code
-#line 610 "savegame.cfsml"
+#line 607 "../../engines/sci/engine/savegame.cfsml"
}
return *hiteof;
}
void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
WSprintf(fh, "%s\n", mem_obj_string_names[foo->type].name);
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_int(fh, &foo->segmgr_id);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 617 "savegame.cfsml"
+#line 614 "../../engines/sci/engine/savegame.cfsml"
switch (foo->type) {
case MEM_OBJ_SCRIPT:
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_script_t(fh, &foo->data.script);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 620 "savegame.cfsml"
+#line 617 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_CLONES:
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_clone_table_t(fh, &foo->data.clones);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 623 "savegame.cfsml"
+#line 620 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_LOCALS:
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_local_variables_t(fh, &foo->data.locals);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 626 "savegame.cfsml"
+#line 623 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_SYS_STRINGS:
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_sys_strings_t(fh, &foo->data.sys_strings);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 629 "savegame.cfsml"
+#line 626 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_STACK:
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_int(fh, &foo->data.stack.nr);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 632 "savegame.cfsml"
+#line 629 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_HUNK:
break;
case MEM_OBJ_LISTS:
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_list_table_t(fh, &foo->data.lists);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 637 "savegame.cfsml"
+#line 634 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_NODES:
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_node_table_t(fh, &foo->data.nodes);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 640 "savegame.cfsml"
+#line 637 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_DYNMEM:
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_dynmem_t(fh, &foo->data.dynmem);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 643 "savegame.cfsml"
+#line 640 "../../engines/sci/engine/savegame.cfsml"
break;
}
}
int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *lastval, int *line, int *hiteof) {
- char buffer[80];
foo->type = mem_obj_string_to_enum(lastval);
if (foo->type < 0) {
sciprintf("Unknown mem_obj_t type %s on line %d\n", lastval, *line);
@@ -4410,19 +4356,18 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_int(fh, &foo->segmgr_id, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4433,23 +4378,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
}
// End of auto-generated CFSML data reader code
-#line 656 "savegame.cfsml"
+#line 652 "../../engines/sci/engine/savegame.cfsml"
switch (foo->type) {
case MEM_OBJ_SCRIPT:
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_script_t(fh, &foo->data.script, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4460,23 +4404,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
}
// End of auto-generated CFSML data reader code
-#line 659 "savegame.cfsml"
+#line 655 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_CLONES:
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_clone_table_t(fh, &foo->data.clones, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4487,23 +4430,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
}
// End of auto-generated CFSML data reader code
-#line 662 "savegame.cfsml"
+#line 658 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_LOCALS:
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_local_variables_t(fh, &foo->data.locals, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4514,23 +4456,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
}
// End of auto-generated CFSML data reader code
-#line 665 "savegame.cfsml"
+#line 661 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_SYS_STRINGS:
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_sys_strings_t(fh, &foo->data.sys_strings, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4541,23 +4482,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
}
// End of auto-generated CFSML data reader code
-#line 668 "savegame.cfsml"
+#line 664 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_LISTS:
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_list_table_t(fh, &foo->data.lists, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4568,23 +4508,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
}
// End of auto-generated CFSML data reader code
-#line 671 "savegame.cfsml"
+#line 667 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_NODES:
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_node_table_t(fh, &foo->data.nodes, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4595,23 +4534,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
}
// End of auto-generated CFSML data reader code
-#line 674 "savegame.cfsml"
+#line 670 "../../engines/sci/engine/savegame.cfsml"
break;
case MEM_OBJ_STACK:
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_int(fh, &foo->data.stack.nr, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4622,7 +4560,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
}
// End of auto-generated CFSML data reader code
-#line 677 "savegame.cfsml"
+#line 673 "../../engines/sci/engine/savegame.cfsml"
foo->data.stack.entries = (reg_t *)sci_calloc(foo->data.stack.nr, sizeof(reg_t));
break;
case MEM_OBJ_HUNK:
@@ -4630,19 +4568,18 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
break;
case MEM_OBJ_DYNMEM:
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_dynmem_t(fh, &foo->data.dynmem, _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4653,7 +4590,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
}
}
// End of auto-generated CFSML data reader code
-#line 684 "savegame.cfsml"
+#line 680 "../../engines/sci/engine/savegame.cfsml"
break;
}
@@ -4662,12 +4599,12 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
void write_mem_obj_tp(Common::WriteStream *fh, mem_obj_t **foo) {
if (*foo) {
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
write_mem_obj_t(fh, (*foo));
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 693 "savegame.cfsml"
+#line 689 "../../engines/sci/engine/savegame.cfsml"
} else { // Nothing to write
WSprintf(fh, "\\null\\");
}
@@ -4679,18 +4616,17 @@ int read_mem_obj_tp(Common::SeekableReadStream *fh, mem_obj_t **foo, const char
} else {
*foo = (mem_obj_t *)sci_malloc(sizeof(mem_obj_t));
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 782 "savegame.cfsml"
+#line 778 "../../engines/sci/engine/savegame.cfsml"
const char *_cfsml_inp = lastval;
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = read_mem_obj_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
*hiteof = _cfsml_error;
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -4701,7 +4637,7 @@ int read_mem_obj_tp(Common::SeekableReadStream *fh, mem_obj_t **foo, const char
}
}
// End of auto-generated CFSML data reader code
-#line 704 "savegame.cfsml"
+#line 700 "../../engines/sci/engine/savegame.cfsml"
return *hiteof;
}
return 0;
@@ -4715,10 +4651,6 @@ void _gamestate_unfrob(state_t *s) {
int gamestate_save(state_t *s, Common::WriteStream *fh, const char* savename) {
- sci_dir_t dir;
- char *filename;
- int fd;
-
tm curTime;
g_system->getTimeAndDate(curTime);
@@ -4754,18 +4686,18 @@ int gamestate_save(state_t *s, Common::WriteStream *fh, const char* savename) {
// Calculate the time spent with this game
s->game_time = time(NULL) - s->game_start_time.tv_sec;
-#line 818 "savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_SavegameMetadata(fh, meta);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 757 "savegame.cfsml"
-#line 818 "savegame.cfsml"
+#line 749 "../../engines/sci/engine/savegame.cfsml"
+#line 814 "../../engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
_cfsml_write_state_t(fh, s);
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
-#line 758 "savegame.cfsml"
+#line 750 "../../engines/sci/engine/savegame.cfsml"
delete meta;
@@ -4851,8 +4783,6 @@ static void load_script(state_t *s, seg_id_t seg) {
static void reconstruct_scripts(state_t *s, seg_manager_t *self) {
int i;
mem_obj_t *mobj;
- object_t **objects;
- int *objects_nr;
for (i = 0; i < self->heap_size; i++) {
if (self->heap[i]) {
mobj = self->heap[i];
@@ -5017,8 +4947,6 @@ static void reconstruct_sounds(state_t *s) {
}
state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) {
- int fd;
- int i;
int read_eof = 0;
state_t *retval;
songlib_t temp;
@@ -5044,25 +4972,24 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) {
memset(retval, 0, sizeof(SavegameMetadata));
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 769 "savegame.cfsml"
+#line 766 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_line_ctr = 0;
-#line 774 "savegame.cfsml"
+#line 771 "../../engines/sci/engine/savegame.cfsml"
struct _cfsml_pointer_refstruct **_cfsml_myptrrefptr = _cfsml_get_current_refpointer();
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(_cfsml_line_ctr), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(_cfsml_line_ctr), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_SavegameMetadata(fh, meta, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
read_eof = _cfsml_error;
-#line 797 "savegame.cfsml"
+#line 793 "../../engines/sci/engine/savegame.cfsml"
_cfsml_free_pointer_references(_cfsml_myptrrefptr, _cfsml_error);
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -5073,7 +5000,7 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) {
}
}
// End of auto-generated CFSML data reader code
-#line 1036 "savegame.cfsml"
+#line 1024 "../../engines/sci/engine/savegame.cfsml"
if ((meta->savegame_version < FREESCI_MINIMUM_SAVEGAME_VERSION) ||
(meta->savegame_version > FREESCI_CURRENT_SAVEGAME_VERSION)) {
if (meta->savegame_version < FREESCI_MINIMUM_SAVEGAME_VERSION)
@@ -5097,25 +5024,24 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) {
retval->sound_volume = s->sound_volume;
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 769 "savegame.cfsml"
+#line 766 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_line_ctr = 0;
-#line 774 "savegame.cfsml"
+#line 771 "../../engines/sci/engine/savegame.cfsml"
struct _cfsml_pointer_refstruct **_cfsml_myptrrefptr = _cfsml_get_current_refpointer();
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(fh, &(_cfsml_line_ctr), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(fh, &(_cfsml_line_ctr), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_state_t(fh, retval, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
read_eof = _cfsml_error;
-#line 797 "savegame.cfsml"
+#line 793 "../../engines/sci/engine/savegame.cfsml"
_cfsml_free_pointer_references(_cfsml_myptrrefptr, _cfsml_error);
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -5126,7 +5052,7 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) {
}
}
// End of auto-generated CFSML data reader code
-#line 1059 "savegame.cfsml"
+#line 1047 "../../engines/sci/engine/savegame.cfsml"
sfx_exit(&s->sound);
_gamestate_unfrob(retval);
@@ -5224,25 +5150,24 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata*
int read_eof = 0;
// Auto-generated CFSML data reader code
-#line 766 "savegame.cfsml"
+#line 763 "../../engines/sci/engine/savegame.cfsml"
{
-#line 769 "savegame.cfsml"
+#line 766 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_line_ctr = 0;
-#line 774 "savegame.cfsml"
+#line 771 "../../engines/sci/engine/savegame.cfsml"
struct _cfsml_pointer_refstruct **_cfsml_myptrrefptr = _cfsml_get_current_refpointer();
-#line 777 "savegame.cfsml"
+#line 774 "../../engines/sci/engine/savegame.cfsml"
int _cfsml_eof = 0, _cfsml_error;
- int dummy;
-#line 785 "savegame.cfsml"
- const char *_cfsml_inp = _cfsml_get_identifier(stream, &(_cfsml_line_ctr), &_cfsml_eof, &dummy);
+#line 781 "../../engines/sci/engine/savegame.cfsml"
+ const char *_cfsml_inp = _cfsml_get_identifier(stream, &(_cfsml_line_ctr), &_cfsml_eof, 0);
-#line 789 "savegame.cfsml"
+#line 785 "../../engines/sci/engine/savegame.cfsml"
_cfsml_error = _cfsml_read_SavegameMetadata(stream, meta, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof);
-#line 793 "savegame.cfsml"
+#line 789 "../../engines/sci/engine/savegame.cfsml"
read_eof = _cfsml_error;
-#line 797 "savegame.cfsml"
+#line 793 "../../engines/sci/engine/savegame.cfsml"
_cfsml_free_pointer_references(_cfsml_myptrrefptr, _cfsml_error);
-#line 800 "savegame.cfsml"
+#line 796 "../../engines/sci/engine/savegame.cfsml"
if (_cfsml_last_value_retrieved) {
free(_cfsml_last_value_retrieved);
_cfsml_last_value_retrieved = NULL;
@@ -5253,7 +5178,7 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata*
}
}
// End of auto-generated CFSML data reader code
-#line 1156 "savegame.cfsml"
+#line 1144 "../../engines/sci/engine/savegame.cfsml"
if (read_eof)
return false;
diff --git a/engines/sci/module.mk b/engines/sci/module.mk
index bf1acef2b1..2dccaad01d 100644
--- a/engines/sci/module.mk
+++ b/engines/sci/module.mk
@@ -87,8 +87,8 @@ MODULE_OBJS = \
sfx/softseq/softsequencers.o
# Generate savegame.cpp
-$(srcdir)/engines/sci/engine/savegame.cpp: $(srcdir)/engines/sci/engine/savegame.cfsml
- cat $< | perl $(srcdir)/tools/cfsml.pl -f savegame.cfsml > $@
+$(srcdir)/engines/sci/engine/savegame.cpp: $(srcdir)/engines/sci/engine/savegame.cfsml $(srcdir)/tools/cfsml.pl
+ cat $< | perl $(srcdir)/tools/cfsml.pl -f $(<) > $@
# This module can be built as a plugin
ifeq ($(ENABLE_SCI), DYNAMIC_PLUGIN)
diff --git a/tools/cfsml.pl b/tools/cfsml.pl
index 53d5ae1634..bc543e8fc7 100644
--- a/tools/cfsml.pl
+++ b/tools/cfsml.pl
@@ -394,9 +394,6 @@ sub create_writer
write_line_pp(__LINE__, 0);
print "static void\n_cfsml_write_$typename(Common::WriteStream *fh, $ctype* save_struc)\n{\n";
- if ($types{$type}{'type'} eq $type_record) {
- print " int min, max, i;\n\n";
- }
if ($types{$type}{'type'} eq $type_integer) {
print " WSprintf(fh, \"%li\", (long)*save_struc);\n";
@@ -421,6 +418,7 @@ sub create_writer
if ($n->{'array'}) { # Check for arrays
+ print " int min, max;\n";
if ($n->{'array'} eq 'static' or $n->{'size'} * 2) { # fixed integer value?
print " min = max = $n->{'size'};\n";
}
@@ -440,7 +438,7 @@ sub create_writer
write_line_pp(__LINE__, 0);
print " WSprintf(fh, \"[%d][\\n\", max);\n";
- print " for (i = 0; i < min; i++) {\n";
+ print " for (int i = 0; i < min; i++) {\n";
print " $types{$n->{'type'}}{'writer'}";
my $subscribstr = "[i]"; # To avoid perl interpolation problems
print "(fh, &(save_struc->$n->{'name'}$subscribstr));\n";
@@ -487,10 +485,6 @@ sub create_reader
write_line_pp(__LINE__, 0);
print "static int\n_cfsml_read_$typename(Common::SeekableReadStream *fh, $ctype* save_struc, const char *lastval, int *line, int *hiteof)\n{\n";
- print " char *token;\n";
- if ($types{$type}{'type'} eq $type_record) {
- print " int min, max, i;\n";
- }
my $reladdress_nr = 0; # Number of relative addresses needed
my $reladdress = 0; # Current relative address number
my $reladdress_resolver = ""; # Relative addresses are resolved after the main while block
@@ -510,6 +504,7 @@ sub create_reader
if ($types{$type}{'type'} eq $type_integer) {
write_line_pp(__LINE__, 0);
+ print " char *token;\n";
print "\n *save_struc = strtol(lastval, &token, 0);\n";
print " if ((*save_struc == 0) && (token == lastval)) {\n";
print " _cfsml_error(\"strtol failed at line %d\\n\", *line);\n";
@@ -544,7 +539,8 @@ sub create_reader
print " }\n";
} elsif ($types{$type}{'type'} eq $type_record) {
write_line_pp(__LINE__, 0);
- print " int assignment, closed, done;\n\n";
+ print " char *token;\n";
+ print " int assignment, closed;\n\n";
print " if (strcmp(lastval, \"{\")) {\n";
print " _cfsml_error(\"Reading record $type; expected opening braces in line %d, got \\\"%s\\\"\\n\", *line, lastval);\n";
print " return CFSML_FAILURE;\n";
@@ -614,6 +610,7 @@ sub create_reader
print " return CFSML_FAILURE;\n";
print " }\n";
+ print " int max,done,i;\n";
if ($n->{'array'} eq 'dynamic') {
write_line_pp(__LINE__, 0);
# We need to allocate the array first
@@ -776,14 +773,13 @@ sub insert_reader_code {
}
write_line_pp(__LINE__, 0);
print " int _cfsml_eof = 0, _cfsml_error;\n";
- print " int dummy;\n";
if ($firsttoken) {
write_line_pp(__LINE__, 0);
print " const char *_cfsml_inp = $firsttoken;\n";
} else {
write_line_pp(__LINE__, 0);
- print " const char *_cfsml_inp = _cfsml_get_identifier($fh, &($linecounter), &_cfsml_eof, &dummy);\n\n";
+ print " const char *_cfsml_inp = _cfsml_get_identifier($fh, &($linecounter), &_cfsml_eof, 0);\n\n";
}
write_line_pp(__LINE__, 0);