// File: dnegovan[P]Intruder-On-Donnar-V/CrewMember.cpp
// Function: CrewMember::talk()
void CrewMember::talk()
{
    //create otherCrew vector by removing this name from copy of full crew list
    otherCrew = crewList;
    auto iterator = std::find(otherCrew.begin(), otherCrew.end(), name);
    otherCrew.erase(iterator);

    int input = 0;

    std::cout << NARRATOR_COLOR "\n" << fullTitle << RESET << std::endl;

    //if the occupant is infected, use special dialogue (different txt file)
    std::string fileName;
    if (infected)
    {
        //use infected dialogue options
        fileName = name + "Infected.txt";
    }
    else
    {
        //use regular dialogue options
        fileName = name + ".txt";
    }

    //open dialogue file
    std::ifstream stream(fileName, std::ios::in);

    //diaplay greeting (1st line of file)
    std::string dialogue;
    getline(stream, dialogue);
    std::cout << DIALOGUE_COLOR << dialogue << RESET << "\n" << std::endl;
    stream.close();

    while (true)
    {
        //need to skip the first line, already showed it above
        stream.open(fileName);
        getline(stream, dialogue);

        //menu for asking about other crewmembers
        while (input < 1 || input > ALL_CREW)
        {
            for (int i = 0; i < (ALL_CREW - 1); i++)
            {
                std::cout << i + 1 << ". Ask about " << otherCrew[i] << "\n";
            }

            std::cout << ALL_CREW << ". Return" << std::endl;

            input = getInteger();
        }

        if (input == ALL_CREW)
        {
            //on the menu, 1 more than all other crew will be the cancel option
            return;
        }

        //get and then overwrite any lines between greeting and user's choice
        //repeats until desired option
        for (int i = 0; i < input; i++)
        {
            getline(stream, dialogue);
        }

        std::cout << std::endl;
        printString(dialogue, DIALOGUE_COLOR, 0);
        wait(MED);

        //reset for next loop
        input = 0;
        stream.close();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x328(%rbp)
addq $0x50, %rdi
leaq 0x138bb(%rip), %rsi     # 0x29950
callq 0x16610
movq -0x328(%rbp), %rdi
addq $0x50, %rdi
callq 0x134d0
movq -0x328(%rbp), %rdi
movq %rax, -0x18(%rbp)
addq $0x50, %rdi
callq 0x13820
movq -0x328(%rbp), %rdx
movq %rax, -0x20(%rbp)
addq $0x8, %rdx
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x137d0
movq %rax, %rcx
movq -0x328(%rbp), %rax
movq %rcx, -0x10(%rbp)
addq $0x50, %rax
movq %rax, -0x330(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x136e0
movq -0x330(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x13670
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq 0x12ea6(%rip), %rdi     # 0x28fc8
leaq 0x92ef(%rip), %rsi      # 0x1f418
callq 0x3210
movq -0x328(%rbp), %rsi
movq %rax, %rdi
addq $0x28, %rsi
callq 0x31e0
movq %rax, %rdi
leaq 0x8f88(%rip), %rsi      # 0x1f0d3
callq 0x3210
movq %rax, %rdi
movq 0x12e56(%rip), %rsi     # 0x28fb0
callq 0x3240
leaq -0x58(%rbp), %rdi
callq 0x3300
movq -0x328(%rbp), %rax
testb $0x1, 0x49(%rax)
je 0x161be
movq -0x328(%rbp), %rsi
addq $0x8, %rsi
leaq 0x9298(%rip), %rdx      # 0x1f41f
leaq -0x78(%rbp), %rdi
callq 0x16860
jmp 0x16192
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3270
leaq -0x78(%rbp), %rdi
callq 0x3448
jmp 0x161fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x165d3
movq -0x328(%rbp), %rsi
addq $0x8, %rsi
leaq 0x97ba(%rip), %rdx      # 0x1f98a
leaq -0xa8(%rbp), %rdi
callq 0x16860
jmp 0x161de
leaq -0x58(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x3270
leaq -0xa8(%rbp), %rdi
callq 0x3448
leaq -0x2b0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0x8, %edx
callq 0x3370
jmp 0x16211
leaq -0x2d0(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x3300
movq -0x338(%rbp), %rsi
leaq -0x2b0(%rbp), %rdi
callq 0x3050
jmp 0x16239
movq 0x12d88(%rip), %rdi     # 0x28fc8
leaq 0x91e5(%rip), %rsi      # 0x1f42c
callq 0x3210
movq %rax, -0x340(%rbp)
jmp 0x16255
movq -0x340(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x31e0
movq %rax, -0x348(%rbp)
jmp 0x16271
movq -0x348(%rbp), %rdi
leaq 0x8e54(%rip), %rsi      # 0x1f0d3
callq 0x3210
movq %rax, -0x350(%rbp)
jmp 0x1628d
movq -0x350(%rbp), %rdi
leaq 0x96a9(%rip), %rsi      # 0x1f944
callq 0x3210
movq %rax, -0x358(%rbp)
jmp 0x162a9
movq -0x358(%rbp), %rdi
movq 0x12cf9(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x162be
leaq -0x2b0(%rbp), %rdi
callq 0x3060
jmp 0x162cc
jmp 0x162ce
jmp 0x162d0
leaq -0x2b0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0x8, %edx
callq 0x31c0
jmp 0x162e7
leaq -0x2b0(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x3050
jmp 0x162fc
jmp 0x162fe
movb $0x1, %al
cmpl $0x1, -0x34(%rbp)
movb %al, -0x359(%rbp)
jl 0x16319
cmpl $0x5, -0x34(%rbp)
setg %al
movb %al, -0x359(%rbp)
movb -0x359(%rbp), %al
testb $0x1, %al
jne 0x16328
jmp 0x1644c
movl $0x0, -0x2d4(%rbp)
cmpl $0x4, -0x2d4(%rbp)
jge 0x163e6
movl -0x2d4(%rbp), %esi
incl %esi
movq 0x12c7a(%rip), %rdi     # 0x28fc8
callq 0x33b0
movq %rax, -0x368(%rbp)
jmp 0x1635c
movq -0x368(%rbp), %rdi
leaq 0x90c8(%rip), %rsi      # 0x1f432
callq 0x3210
movq %rax, -0x370(%rbp)
jmp 0x16378
movq -0x328(%rbp), %rdi
addq $0x50, %rdi
movslq -0x2d4(%rbp), %rsi
callq 0x134b0
movq -0x370(%rbp), %rdi
movq %rax, %rsi
callq 0x31e0
movq %rax, -0x378(%rbp)
jmp 0x163a7
movq -0x378(%rbp), %rdi
leaq 0x958f(%rip), %rsi      # 0x1f944
callq 0x3210
jmp 0x163bc
jmp 0x163be
movl -0x2d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2d4(%rbp)
jmp 0x16332
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x165bb
movq 0x12bdb(%rip), %rdi     # 0x28fc8
movl $0x5, %esi
callq 0x33b0
movq %rax, -0x380(%rbp)
jmp 0x16400
movq -0x380(%rbp), %rdi
leaq 0x8ef0(%rip), %rsi      # 0x1f2fe
callq 0x3210
movq %rax, -0x388(%rbp)
jmp 0x1641c
movq -0x388(%rbp), %rdi
movq 0x12b86(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x16431
callq 0x175c0
movl %eax, -0x38c(%rbp)
jmp 0x1643e
movl -0x38c(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x162fe
cmpl $0x5, -0x34(%rbp)
jne 0x1647c
leaq -0x2d0(%rbp), %rdi
callq 0x3448
leaq -0x2b0(%rbp), %rdi
callq 0x3090
leaq -0x58(%rbp), %rdi
callq 0x3448
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
movl $0x0, -0x2d8(%rbp)
movl -0x2d8(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x164b9
leaq -0x2b0(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x3050
jmp 0x164a6
jmp 0x164a8
movl -0x2d8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2d8(%rbp)
jmp 0x16486
movq 0x12b08(%rip), %rdi     # 0x28fc8
movq 0x12ae9(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x164ce
leaq -0x2f8(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x30f0
jmp 0x164e3
leaq -0x319(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x33d0
movq -0x398(%rbp), %rdx
leaq 0x8f28(%rip), %rsi      # 0x1f42c
leaq -0x318(%rbp), %rdi
callq 0x32f0
jmp 0x16512
leaq -0x2f8(%rbp), %rdi
leaq -0x318(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x18910
jmp 0x1652a
leaq -0x318(%rbp), %rdi
callq 0x3448
leaq -0x319(%rbp), %rdi
callq 0x3250
leaq -0x2f8(%rbp), %rdi
callq 0x3448
movsd 0x8eba(%rip), %xmm0     # 0x1f410
callq 0x188c0
jmp 0x1655d
movl $0x0, -0x34(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x3060
jmp 0x16572
jmp 0x162ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x165a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x3448
leaq -0x319(%rbp), %rdi
callq 0x3250
leaq -0x2f8(%rbp), %rdi
callq 0x3448
leaq -0x2d0(%rbp), %rdi
callq 0x3448
leaq -0x2b0(%rbp), %rdi
callq 0x3090
leaq -0x58(%rbp), %rdi
callq 0x3448
movq -0x80(%rbp), %rdi
callq 0x33c0
nopw %cs:(%rax,%rax)
nop