Stack rework
This commit is contained in:
parent
5da9e11f36
commit
ea9c41054b
7 changed files with 60 additions and 39 deletions
|
@ -40,14 +40,14 @@ func add(stack: Stack) -> Stack:
|
|||
var found_index : int = find(stack.held_item)
|
||||
if found_index != -1:
|
||||
stack_added.emit(stack,found_index)
|
||||
stack = internal_array[found_index].merge_stack(stack)
|
||||
if stack == null:
|
||||
internal_array[found_index].merge_stack(stack)
|
||||
if stack.is_valid() == false:
|
||||
return null
|
||||
for i in range(len(internal_array)):
|
||||
if internal_array[i].held_item == null or internal_array[i].held_item == stack.held_item:
|
||||
stack_added.emit(stack,i)
|
||||
stack = internal_array[i].merge_stack(stack)
|
||||
if stack == null:
|
||||
internal_array[i].merge_stack(stack)
|
||||
if stack.is_valid() == false:
|
||||
return null
|
||||
return stack
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue