// File: /workspace/github_cpp_makefile_star2_O1/Jacobious52[P]Tanks/GameView.cpp
// Function: GameView::update(int)
void GameView::update(int t)
{
    // bullet needs firing
    DebugView::shared_view()->watch("terrain count", _terrain->get_children()->get_count());

    View::update(t);

    // check if bullet is inside tank1
    if (_bullet->get_position().x >= _tank1->get_position().x
        && _bullet->get_position().x <= _tank1->get_position().x + _tank1->get_size().x
        && _bullet->get_position().y > _tank1->get_position().y
        && _bullet->get_position().y <= _tank1->get_position().y + _tank1->get_size().y)
    {
        _winner = _tank2->get_name();
        ConsoleTools::play_music("boom.wav");
        _should_remove_from_parent = true;
        return;
    }
    // check if bullet is inside tank2
    else if (_bullet->get_position().x >= _tank2->get_position().x
        && _bullet->get_position().x <= _tank2->get_position().x + _tank2->get_size().x
        && _bullet->get_position().y > _tank2->get_position().y
        && _bullet->get_position().y <= _tank2->get_position().y + _tank2->get_size().y)
    {
        _winner = _tank1->get_name();
        ConsoleTools::play_music("boom.wav");
        _should_remove_from_parent = true;
        return;
    }
    // bullet has hit. next turn
    if (_bullet->get_launched() == false || _bullet->should_remove_from_parent() == true)
    {
        _terrain->shuffle_wind_speed();
        DebugView::shared_view()->watch("wind speed", _terrain->get_wind_speed());
        draw();
       _get_input();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movl %esi, %r14d
movq %rdi, %rbx
callq 0x4d7e
movq %rax, %r15
leaq -0x70(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x7884(%rip), %rsi      # 0xc120
leaq 0x788a(%rip), %rdx      # 0xc12d
leaq -0x80(%rbp), %rdi
callq 0x5744
movq 0x38(%rbx), %rdi
callq 0x98e8
movq 0x8(%rax), %rax
testq %rax, %rax
js 0x48c5
cvtsi2ss %rax, %xmm0
jmp 0x48da
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
leaq -0x80(%rbp), %rsi
movq %r15, %rdi
callq 0x9c98
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x48f4
callq 0x3240
movq %rbx, %rdi
movl %r14d, %esi
callq 0x9966
movq 0x50(%rbx), %rdi
callq 0x9a42
movq %rax, %r14
movq 0x40(%rbx), %rdi
callq 0x9a42
cmpl %eax, %r14d
jl 0x49a1
movq 0x50(%rbx), %rdi
callq 0x9a42
movq %rax, %r14
movq 0x40(%rbx), %rdi
callq 0x9a42
movq %rax, %r15
movq 0x40(%rbx), %rdi
callq 0x9a56
addl %r15d, %eax
cmpl %r14d, %eax
jl 0x49a1
movq 0x50(%rbx), %rdi
callq 0x9a42
movq %rax, %r14
shrq $0x20, %r14
movq 0x40(%rbx), %rdi
callq 0x9a42
shrq $0x20, %rax
cmpl %eax, %r14d
jle 0x49a1
movq 0x50(%rbx), %rdi
callq 0x9a42
movq %rax, %r14
shrq $0x20, %r14
movq 0x40(%rbx), %rdi
callq 0x9a42
movq %rax, %r15
shrq $0x20, %r15
movq 0x40(%rbx), %rdi
callq 0x9a56
shrq $0x20, %rax
addl %r15d, %eax
cmpl %r14d, %eax
jge 0x4ad1
movq 0x50(%rbx), %rdi
callq 0x9a42
movq %rax, %r14
movq 0x48(%rbx), %rdi
callq 0x9a42
cmpl %eax, %r14d
jl 0x4a43
movq 0x50(%rbx), %rdi
callq 0x9a42
movq %rax, %r14
movq 0x48(%rbx), %rdi
callq 0x9a42
movq %rax, %r15
movq 0x48(%rbx), %rdi
callq 0x9a56
addl %r15d, %eax
cmpl %r14d, %eax
jl 0x4a43
movq 0x50(%rbx), %rdi
callq 0x9a42
movq %rax, %r14
shrq $0x20, %r14
movq 0x48(%rbx), %rdi
callq 0x9a42
shrq $0x20, %rax
cmpl %eax, %r14d
jle 0x4a43
movq 0x50(%rbx), %rdi
callq 0x9a42
movq %rax, %r14
shrq $0x20, %r14
movq 0x48(%rbx), %rdi
callq 0x9a42
movq %rax, %r15
shrq $0x20, %r15
movq 0x48(%rbx), %rdi
callq 0x9a56
shrq $0x20, %rax
addl %r15d, %eax
cmpl %r14d, %eax
jge 0x4b38
movq 0x50(%rbx), %rdi
callq 0x8d54
testb %al, %al
je 0x4a5d
movq 0x50(%rbx), %rdi
callq 0x9a00
testb %al, %al
je 0x4ac1
movq 0x38(%rbx), %rdi
callq 0x7b02
callq 0x4d7e
movq %rax, %r14
leaq -0x50(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x76ba(%rip), %rsi      # 0xc137
leaq 0x76bd(%rip), %rdx      # 0xc141
leaq -0x60(%rbp), %rdi
callq 0x5744
movq 0x38(%rbx), %rdi
callq 0x7f4e
leaq -0x60(%rbp), %rsi
movq %r14, %rdi
callq 0x9c98
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x4ab0
callq 0x3240
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movq %rbx, %rdi
callq 0x4266
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x48(%rbx), %rsi
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x9bf2
leaq 0x68(%rbx), %rdi
movq %r14, %rsi
callq 0x3140
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4aff
callq 0x3240
leaq -0xb0(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x761d(%rip), %rsi      # 0xc12e
leaq 0x761e(%rip), %rdx      # 0xc136
leaq -0xc0(%rbp), %r14
movq %r14, %rdi
callq 0x5744
movq %r14, %rdi
callq 0x39ae
movq -0xc0(%rbp), %rdi
jmp 0x4b9d
movq 0x40(%rbx), %rsi
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x9bf2
leaq 0x68(%rbx), %rdi
movq %r14, %rsi
callq 0x3140
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4b66
callq 0x3240
leaq -0x90(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x75b6(%rip), %rsi      # 0xc12e
leaq 0x75b7(%rip), %rdx      # 0xc136
leaq -0xa0(%rbp), %r14
movq %r14, %rdi
callq 0x5744
movq %r14, %rdi
callq 0x39ae
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x4ba7
callq 0x3240
movb $0x1, 0x30(%rbx)
jmp 0x4ac1
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
jmp 0x4be3
jmp 0x4bca
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
jmp 0x4be3
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4bf6
jmp 0x4bfb
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
jne 0x4bf6
jmp 0x4bfb
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x4bfb
callq 0x3240
movq %rbx, %rdi
callq 0x3440
nop