diff options
Diffstat (limited to 'engines/sci/engine/savegame.cpp')
-rw-r--r-- | engines/sci/engine/savegame.cpp | 122 |
1 files changed, 58 insertions, 64 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 881c13faf8..b52f4515ce 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -326,7 +326,7 @@ static char *_cfsml_unmangle_string(const char *s, unsigned int length) { while ((source != end) && (c = *source++) && (c > 31)) { if (c == '\\') { // Escaped character? - c = *source++; + c = *source++; if ((c != '\\') && (c != '"')) // Un-escape 0-31 only c -= ('a' - 1); } @@ -606,7 +606,7 @@ _cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc, return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -674,7 +674,7 @@ _cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_st return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -771,7 +771,7 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -860,10 +860,10 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const _cfsml_error("Token expected by read_reg_t() for variables[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->variables_nr = max ; // Set array size accordingly + save_struc->variables_nr = max ; // Set array size accordingly } else #line 699 "engines/sci/engine/savegame.cfsml" { @@ -962,7 +962,7 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -1016,10 +1016,10 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con _cfsml_error("Token expected by _cfsml_read_menu_t() for menus[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->menus_nr = max ; // Set array size accordingly + save_struc->menus_nr = max ; // Set array size accordingly } else #line 699 "engines/sci/engine/savegame.cfsml" { @@ -1094,7 +1094,7 @@ _cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_stru return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -1177,7 +1177,7 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_ return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -1224,7 +1224,7 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_ _cfsml_error("Token expected by read_int_hash_map_node_tp() for nodes[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); } else @@ -1312,7 +1312,7 @@ _cfsml_read_SegManager(Common::SeekableReadStream *fh, SegManager* save_struc, c return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -1373,10 +1373,10 @@ _cfsml_read_SegManager(Common::SeekableReadStream *fh, SegManager* save_struc, c _cfsml_error("Token expected by read_mem_obj_tp() for heap[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->heap_size = max ; // Set array size accordingly + save_struc->heap_size = max ; // Set array size accordingly } else if (!strcmp(token, "heap_size")) { #line 690 "engines/sci/engine/savegame.cfsml" @@ -1506,7 +1506,7 @@ _cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const cha return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -1661,7 +1661,7 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -1729,7 +1729,7 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, _cfsml_error("Token expected by _cfsml_read_byte() for said[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); } else @@ -1829,7 +1829,7 @@ _cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_stru return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -1943,7 +1943,7 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -2011,10 +2011,10 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const _cfsml_error("Token expected by _cfsml_read_byte() for buf[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->size = max ; // Set array size accordingly + save_struc->size = max ; // Set array size accordingly } else #line 699 "engines/sci/engine/savegame.cfsml" { @@ -2076,7 +2076,7 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -2144,10 +2144,10 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* _cfsml_error("Token expected by read_reg_t() for locals[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->nr = max ; // Set array size accordingly + save_struc->nr = max ; // Set array size accordingly } else #line 699 "engines/sci/engine/savegame.cfsml" { @@ -2215,7 +2215,7 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -2297,10 +2297,10 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru _cfsml_error("Token expected by _cfsml_read_node_entry_t() for table[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->entries_nr = max ; // Set array size accordingly + save_struc->entries_nr = max ; // Set array size accordingly } else #line 699 "engines/sci/engine/savegame.cfsml" { @@ -2354,7 +2354,7 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -2394,7 +2394,7 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st _cfsml_error("Token expected by _cfsml_read_sys_string_t() for strings[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); } else @@ -2477,7 +2477,7 @@ _cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const cha return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -2585,7 +2585,7 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -2667,10 +2667,10 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru _cfsml_error("Token expected by _cfsml_read_list_entry_t() for table[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->entries_nr = max ; // Set array size accordingly + save_struc->entries_nr = max ; // Set array size accordingly } else #line 699 "engines/sci/engine/savegame.cfsml" { @@ -2719,7 +2719,7 @@ _cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const c return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -2880,7 +2880,7 @@ _cfsml_read_EngineState(Common::SeekableReadStream *fh, EngineState* save_struc, return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -2990,10 +2990,10 @@ _cfsml_read_EngineState(Common::SeekableReadStream *fh, EngineState* save_struc, _cfsml_error("Token expected by _cfsml_read_class_t() for classtable[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->classtable_size = max ; // Set array size accordingly + save_struc->classtable_size = max ; // Set array size accordingly } else if (!strcmp(token, "sound")) { #line 690 "engines/sci/engine/savegame.cfsml" @@ -3061,7 +3061,7 @@ _cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* s return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -3180,7 +3180,7 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -3255,10 +3255,10 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha _cfsml_error("Token expected by _cfsml_read_menu_item_t() for items[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->items_nr = max ; // Set array size accordingly + save_struc->items_nr = max ; // Set array size accordingly } else #line 699 "engines/sci/engine/savegame.cfsml" { @@ -3326,7 +3326,7 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -3408,10 +3408,10 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st _cfsml_error("Token expected by _cfsml_read_clone_entry_t() for table[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->entries_nr = max ; // Set array size accordingly + save_struc->entries_nr = max ; // Set array size accordingly } else #line 699 "engines/sci/engine/savegame.cfsml" { @@ -3482,7 +3482,7 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -3571,10 +3571,10 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c _cfsml_error("Token expected by read_reg_t() for variables[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->variables_nr = max ; // Set array size accordingly + save_struc->variables_nr = max ; // Set array size accordingly } else #line 699 "engines/sci/engine/savegame.cfsml" { @@ -3623,7 +3623,7 @@ _cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const cha return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -3701,7 +3701,7 @@ _cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_stru return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -3829,7 +3829,7 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const return CFSML_FAILURE; } if (!assignment) { - if (!strcmp(token, "}")) + if (!strcmp(token, "}")) closed = 1; else { _cfsml_error("Expected assignment or closing braces in line %d\n", *line); @@ -3953,10 +3953,10 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const _cfsml_error("Token expected by _cfsml_read_object_t() for objects[i++] at line %d\n", *line); return CFSML_FAILURE; } - } else + } else done = 1; } while (!done); - save_struc->objects_allocated = max ; // Set array size accordingly + save_struc->objects_allocated = max ; // Set array size accordingly } else if (!strcmp(token, "locals_offset")) { #line 690 "engines/sci/engine/savegame.cfsml" @@ -3991,7 +3991,7 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const // Auto-generated CFSML declaration and function block ends here -// Auto-generation performed by cfsml.pl 0.8.2 +// Auto-generation performed by cfsml.pl 0.8.2 #line 447 "engines/sci/engine/savegame.cfsml" void write_songlib_t(Common::WriteStream *fh, songlib_t *songlib) { @@ -4974,9 +4974,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { } */ - retval = (EngineState *) sci_malloc(sizeof(EngineState)); - - memset(retval, 0, sizeof(EngineState)); + retval = new EngineState(); retval->savegame_version = -1; _global_save_state = retval; @@ -5014,7 +5012,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { } } // End of auto-generated CFSML data reader code -#line 1038 "engines/sci/engine/savegame.cfsml" +#line 1036 "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) @@ -5066,7 +5064,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { } } // End of auto-generated CFSML data reader code -#line 1061 "engines/sci/engine/savegame.cfsml" +#line 1059 "engines/sci/engine/savegame.cfsml" sfx_exit(&s->sound); _gamestate_unfrob(retval); @@ -5105,10 +5103,6 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { // Time state: retval->last_wait_time = g_system->getMillis(); - // File IO state: - retval->file_handles_nr = 2; - retval->file_handles = (FILE **)sci_calloc(2, sizeof(FILE *)); - // static parser information: retval->parser_rules = s->parser_rules; retval->parser_words_nr = s->parser_words_nr; @@ -5190,7 +5184,7 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* } } // End of auto-generated CFSML data reader code -#line 1156 "engines/sci/engine/savegame.cfsml" +#line 1150 "engines/sci/engine/savegame.cfsml" if (read_eof) return false; |