Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object OpCloseParen : Action {
if (newParenCount == 0) {
val newStack = image.stack.toMutableList()
newStack.add(ListIota(image.parenthesized.toList().map { it.iota }))
val image2 = image.copy(
val image2 = image.withUsedOp().copy(
stack = newStack,
parenCount = newParenCount,
parenthesized = listOf()
Expand All @@ -34,7 +34,7 @@ object OpCloseParen : Action {
// we need to add the close paren
val newParens = image.parenthesized.toMutableList()
newParens.add(ParenthesizedIota(thisIota, false))
val image2 = image.copy(
val image2 = image.withUsedOp().copy(
parenCount = newParenCount,
parenthesized = newParens
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import at.petrak.hexcasting.common.lib.hex.HexEvalSounds

object OpEscape : Action {
override fun operate(env: CastingEnvironment, image: CastingImage, continuation: SpellContinuation): OperationResult {
val image2 = image.copy(
val image2 = image.withUsedOp().copy(
escapeNext = true
)
return OperationResult(image2, listOf(), continuation, HexEvalSounds.NORMAL_EXECUTE)
}

override fun operateInParens(env: CastingEnvironment, image: CastingImage, continuation: SpellContinuation, thisIota: Iota): ParenthesizedOperationResult {
val image2 = image.copy(
val image2 = image.withUsedOp().copy(
escapeNext = true
)
return ParenthesizedOperationResult(image2, listOf(), continuation, HexEvalSounds.NORMAL_EXECUTE, ResolvedPatternType.EVALUATED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import at.petrak.hexcasting.common.lib.hex.HexEvalSounds

object OpOpenParen : Action {
override fun operate(env: CastingEnvironment, image: CastingImage, continuation: SpellContinuation): OperationResult {
val image2 = image.copy(
val image2 = image.withUsedOp().copy(
parenCount = image.parenCount + 1
)
return OperationResult(image2, listOf(), continuation, HexEvalSounds.NORMAL_EXECUTE)
Expand All @@ -22,7 +22,7 @@ object OpOpenParen : Action {
// we have escaped the parens onto the stack; we just also record our count.
val newParens = image.parenthesized.toMutableList()
newParens.add(CastingImage.ParenthesizedIota(thisIota, false))
val image2 = image.copy(
val image2 = image.withUsedOp().copy(
parenthesized = newParens,
parenCount = image.parenCount + 1
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object OpUndo : Action {
HexActions.CLOSE_PAREN.prototype.angles -> newParenCount++
}
}
val image2 = image.copy(
val image2 = image.withUsedOp().copy(
parenthesized = newParens,
parenCount = newParenCount
)
Expand Down
Loading