1
0
Fork 0
mirror of https://gitlab.com/Oreolek/salet.git synced 2024-07-02 06:45:06 +03:00

wrapLevel sort of fixed

This commit is contained in:
Alexander Yakovlev 2016-03-10 22:30:28 +07:00
parent 6e3cda3a9c
commit e1b4f82156
3 changed files with 5 additions and 7 deletions

View file

@ -169,11 +169,9 @@ class SaletRoom
@entering.fcall(this, system, @name)
return system.view.write(thing.take.fcall(thing, system).toString())
if thing.act
text = system.view.wrapLevel(
thing.act.fcall(thing, system).toString(),
thing.level
return system.view.changeLevel(thing.level, () ->
return thing.act.fcall(thing, system).toString()
)
return system.view.changeLevel(thing.level, text)
# the loop is done but no return came - match not found
console.error("Could not find #{link[2]} in current room.")

View file

@ -153,7 +153,7 @@ class Salet
room = @rooms[roomId]
assert(room, "unknown_situation".l({id:roomId}))
if (room.canView.fcall(this, currentRoom))
if (room.canView.fcall(this, this, currentRoom))
viewableRoomData.push({
priority: room.priority
id: roomId

View file

@ -205,7 +205,7 @@ class SaletView
# Remove every section marked as a different level.
# For a link level 0, we hide every link of level 1 and above.
# It's for the player to focus.
changeLevel: (level, text) =>
changeLevel: (level, callback) =>
maxLevel = 6
if level < maxLevel
i = level + 1
@ -215,7 +215,7 @@ class SaletView
i++
directive = hideArray.join(", ")
$(directive).hide()
@write text
@write system.view.wrapLevel(callback(), level)
wrapLevel: (text, level) =>
return "<div class='lvl#{level}'>"+markdown(text)+'</div>'