// File: /workspace/github_cpp_makefile_star2_O3/dnegovan[P]Intruder-On-Donnar-V/Space.cpp
// Function: Space::takeItem(Player&, int)
void Space::takeItem(Player& markNelson, int input)
{
    if (markNelson.pack.isFull())
    {
        std::cout << RED
                  << "\nYour pack is full. Discard items you don't need."
                  << RESET << std::endl;
        //won't be able to take anything else, exit search menu
        return;
    }
    else
    {
        std::cout << NARRATOR_COLOR << "\n" << roomItems[input-1]
                  << " added to pack." << RESET << std::endl;
        //add item to pack
        markNelson.pack.addItem(roomItems[input-1]);

        //update ingredient counter if necessary
        checkForIngredient(markNelson, roomItems[input-1]);

        //remove item from room
        auto iterator = roomItems.begin() + input - 1;
        roomItems.erase(iterator);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0xd654
testb %al, %al
je 0x14a62
movq 0x75d7(%rip), %rbx      # 0x1bfc8
leaq 0x1fcb(%rip), %rsi      # 0x169c3
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x2867(%rip), %rsi      # 0x17273
movl $0x31, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x168e(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %rbx, %rdi
callq 0x3210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3140
movq 0x755f(%rip), %r12      # 0x1bfc8
leaq 0x1623(%rip), %rsi      # 0x16093
movl $0x5, %edx
movq %r12, %rdi
callq 0x3210
leaq 0x1ec0(%rip), %rsi      # 0x16944
movl $0x1, %edx
movq %r12, %rdi
callq 0x3210
movslq %r15d, %rax
movq %rax, -0x30(%rbp)
leaq -0x1(%rax), %r13
movq 0x30(%rbx), %rax
shlq $0x5, %r13
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r12, %rdi
callq 0x3210
movq %rax, %r15
leaq 0x27e6(%rip), %rsi      # 0x172a5
movl $0xf, %edx
movq %rax, %rdi
callq 0x3210
leaq 0x15db(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %r15, %rdi
callq 0x3210
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq 0x30(%rbx), %rax
leaq -0x60(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0xd7ca
movq %r14, %rdi
movq %r15, %rsi
callq 0xd67c
addq $0x30, %rbx
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x14b49
callq 0x31c0
movq (%rbx), %rax
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %r15
movq %r15, %rdi
callq 0xd7ca
movq 0x900c(%rip), %rdi      # 0x1db80
movq 0x900d(%rip), %rsi      # 0x1db88
movq %r15, %rdx
callq 0xd9a5
cmpq 0x8ffe(%rip), %rax      # 0x1db88
je 0x14b90
incl 0x1c(%r14)
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x14b9e
callq 0x31c0
movq (%rbx), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %rsi
addq $-0x20, %rsi
movq %rbx, %rdi
callq 0xdae2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x50(%rbp), %rdi
jmp 0x14bd8
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x14be2
callq 0x31c0
movq %rbx, %rdi
callq 0x3320