0
0
Fork 0
mirror of https://gitlab.com/Oreolek/salet-module.git synced 2024-05-24 11:58:21 +03:00

Fixed the goBack function

This commit is contained in:
Alexander Yakovlev 2017-05-15 16:37:01 +07:00
parent 36bd3cdf5d
commit 82c30ede15
3 changed files with 3 additions and 9 deletions

View file

@ -1,6 +1,6 @@
{
"name": "salet",
"version": "1.7.4",
"version": "1.7.5",
"description": "A general client-side framework for cybertext interactive fiction games.",
"keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"],
"homepage": "https://salet.su",

View file

@ -77,9 +77,6 @@ class SaletRoom
if salet.rooms[f].exit?
salet.rooms[f].exit @name
if window.history.pushState?
window.history.pushState(@name, @title)
if @enter
@enter f

View file

@ -305,13 +305,10 @@ class Salet
# Go back N rooms. It's not an UNDO.
# Also, steps = 1 is the current room
@goBack = (steps = 2) ->
window.history.back()
if @progress.path.length <= 1
if @progress.path.length <= steps
location = @start
else if @progress.path.length > steps
location = @progress.path[@progress.path.length - steps]
else
return @goBack(steps - 1)
location = @progress.path[@progress.path.length - steps]
if location?
@processClick(location)