Hello, look at this method from DataManager:
def self.load_game_without_rescue(index) File.open(make_filename(index), "rb") do |file| Marshal.load(file) extract_save_contents(Marshal.load(file)) reload_map_if_updated @last_savefile_index = index end return true endCan someone explain to me why in line 3 Marshal.load(file) is called? It looks like it does not do anything so Im a little bit confused.
And why does this code don't work?:
def self.load_game_without_rescue(index) File.open(make_filename(index), "rb") do |file| Marshal.load(file) extract_save_contents(Marshal.load(file)) # added: contents = Marshal.load(file) p contents[:system] # /added reload_map_if_updated @last_savefile_index = index end return true endI get an end of file reached exception.
Im grateful for every help and explenation.
def self.load_game_without_rescue(index) File.open(make_filename(index), "rb") do |file| Marshal.load(file) extract_save_contents(Marshal.load(file)) reload_map_if_updated @last_savefile_index = index end return true endCan someone explain to me why in line 3 Marshal.load(file) is called? It looks like it does not do anything so Im a little bit confused.
And why does this code don't work?:
def self.load_game_without_rescue(index) File.open(make_filename(index), "rb") do |file| Marshal.load(file) extract_save_contents(Marshal.load(file)) # added: contents = Marshal.load(file) p contents[:system] # /added reload_map_if_updated @last_savefile_index = index end return true endI get an end of file reached exception.
Im grateful for every help and explenation.