Refactoring + implementation of dropNextActionsIfNecessary

hh
Laurent 6 years ago
parent 8dcf26815d
commit c1e09c41eb
  1. 10
      app/src/main/java/net/pokeranalytics/android/model/handhistory/Builder.kt

@ -143,9 +143,7 @@ class Builder {
val computedAction = this.sortedActions.first { it.action.index == index } val computedAction = this.sortedActions.first { it.action.index == index }
computedAction.action.type = actionType computedAction.action.type = actionType
dropIfNecessary(index) dropNextActionsIfNecessary(index)
// remaining stack + effective amount
when (actionType) { when (actionType) {
Action.Type.CALL -> { Action.Type.CALL -> {
@ -164,8 +162,10 @@ class Builder {
return computedAction.requireAmount return computedAction.requireAmount
} }
private fun dropIfNecessary(index: Int) { private fun dropNextActionsIfNecessary(index: Int) {
this.sortedActions.drop(index + 1) if (index > this.handHistory.numberOfPlayers) {
this.sortedActions.drop(index + 1)
}
} }
/*** /***

Loading…
Cancel
Save