lib/gamefic/engine/tty.rb in gamefic-1.0.0 vs lib/gamefic/engine/tty.rb in gamefic-1.1.0
- old
+ new
@@ -31,14 +31,11 @@
end
def ansi
@stream.ansi
end
def save filename, snapshot
- data = {
- :metadata => @character.plot.metadata,
- :entities => snapshot
- }
+ data = snapshot.merge(:metadata => @character.plot.metadata)
json = JSON.generate data
if json.nil?
@character.tell "Nothing to save."
end
if filename.nil?
@@ -61,10 +58,10 @@
if File.exists?(filename)
data = JSON.parse File.read(filename), symbolize_names: true
if (data[:metadata] != @character.plot.metadata)
@character.tell "The save file is not compatible with this version of the game."
else
- return data[:entities]
+ return data
end
else
@character.tell "File \"#{filename}\" not found."
end
end