// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/WorldState.cpp
// Function: WorldStateUpdater::UpdateInfoWhenCollided()
void WorldStateUpdater::UpdateInfoWhenCollided() {
  if (mpObserver->Sense().IsCollideWithBall() ||
      mpObserver->Sense().IsCollideWithPlayer() ||
      mpObserver->Sense().IsCollideWithPost()) {
    if (mpObserver->Sense().IsCollideWithBall()) {
      SelfState().UpdateCollideWithBall(true);
    } else if (mpObserver->Sense().IsCollideWithPlayer()) {
      SelfState().UpdateCollideWithPlayer(true);
    } else if (mpObserver->Sense().IsCollideWithPost()) {
      SelfState().UpdateCollideWithPost(true);
    }
  }

  //如果发生碰撞，速度需要处理 仅在未更新看到速度时使用
  if (mpObserver->Sense().IsCollideWithBall() && Ball().GetVelDelay() != 0) {
    Ball().UpdateVel(GetBall().GetVel() * -0.1, GetBall().GetVelDelay(),
                     GetBall().GetVelConf());
    Ball().UpdateVelEps(0.1 * Ball().GetVelEps());
  }

  if (mpObserver->Sense().IsCollideWithPlayer()) {
    //找到最近的球员
    bool is_teammate = false;
    Unum tmmt = GetSeenClosestTeammate(); //无则返回0
    Unum oppn = GetSeenClosestOpponent(); //无则返回0

    if (tmmt * oppn == 0) {
      if (tmmt != 0) {
        is_teammate = true;
      } else if (oppn != 0) {
        is_teammate = false;
      } else {
        return;
      }
    } else {
      if (mpObserver->Teammate(tmmt).Dist() <=
          mpObserver->Opponent(oppn).Dist()) {
        is_teammate = true;
      } else {
        is_teammate = false;
      }
    }

    if (is_teammate) {
      if (mpObserver->Teammate(tmmt).GetDirChg().time() !=
          mpObserver->LatestSightTime()) {
        Teammate(tmmt).UpdateVel(Teammate(tmmt).GetVel() * -0.1,
                                 Teammate(tmmt).GetVelDelay(),
                                 Teammate(tmmt).GetVelConf());
      }
      Teammate(tmmt).UpdateCollideWithPlayer(true);
    } else {
      if (mpObserver->Opponent(oppn).GetDirChg().time() !=
          mpObserver->LatestSightTime()) {
        Opponent(oppn).UpdateVel(Opponent(oppn).GetVel() * -0.1,
                                 Opponent(oppn).GetVelDelay(),
                                 Opponent(oppn).GetVelConf());
      }
      Opponent(oppn).UpdateCollideWithPlayer(true);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq (%rdi), %r15
cmpb $0x0, 0x1b2(%r15)
je 0x607e8
movslq 0x14(%rbx), %rcx
movq 0x8(%rbx), %rax
imulq $0x178, %rcx, %rcx      # imm = 0x178
movb $0x1, 0x50(%rax,%rcx)
movl 0x70(%rax), %edx
testl %edx, %edx
je 0x60830
leaq 0x30(%rax), %rdi
movsd 0x9e26(%rip), %xmm0     # 0x6a5c8
movsd 0x60(%rax), %xmm1
mulsd %xmm0, %xmm1
mulsd 0x68(%rax), %xmm0
leaq -0x38(%rbp), %rsi
movsd %xmm1, (%rsi)
movsd %xmm0, 0x8(%rsi)
movsd 0x78(%rax), %xmm0
callq 0xf53c
movq 0x8(%rbx), %rax
movsd 0x80(%rax), %xmm0
mulsd 0x9de5(%rip), %xmm0     # 0x6a5c0
movsd %xmm0, 0x80(%rax)
movq (%rbx), %r15
jmp 0x60830
cmpb $0x0, 0x1b1(%r15)
je 0x60808
movslq 0x14(%rbx), %rax
movq 0x8(%rbx), %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
movb $0x1, 0x51(%rcx,%rax)
jmp 0x60830
cmpb $0x0, 0x1b0(%r15)
je 0x60830
cmpb $0x1, 0x1b0(%r15)
jne 0x60830
movslq 0x14(%rbx), %rax
movq 0x8(%rbx), %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
movb $0x1, 0x52(%rcx,%rax)
cmpb $0x1, 0x1b1(%r15)
jne 0x609a7
movq %rbx, %rdi
callq 0x640bc
movl %eax, %r14d
movq %rbx, %rdi
callq 0x6411c
testl %r14d, %r14d
setne %cl
testl %eax, %eax
setne %dl
testb %cl, %dl
je 0x60894
decl %r14d
movslq %r14d, %r12
imulq $0xa8, %r12, %rcx
decl %eax
movslq %eax, %r13
imulq $0xa8, %r13, %rax
movsd 0x1fa8(%r15,%rax), %xmm0
ucomisd 0x1870(%r15,%rcx), %xmm0
jae 0x6089f
jmp 0x60921
testl %r14d, %r14d
je 0x60914
decl %r14d
movslq %r14d, %r12
imulq $0xa8, %r12, %rax
movl 0x18ac(%r15,%rax), %ecx
movl $0xa8, %r14d
cmpl 0x18(%r15), %ecx
jne 0x608cc
movl 0x14(%r15), %ecx
cmpl %ecx, 0x18a8(%r15,%rax)
je 0x60993
movq 0x8(%rbx), %rax
imulq $0x178, %r12, %rcx      # imm = 0x178
leaq (%rax,%rcx), %rdi
addq $0xa8, %rdi
movsd 0x9cde(%rip), %xmm0     # 0x6a5c8
movsd 0x30(%rdi), %xmm1
mulsd %xmm0, %xmm1
mulsd 0x38(%rdi), %xmm0
leaq -0x38(%rbp), %rsi
movsd %xmm1, (%rsi)
movsd %xmm0, 0x8(%rsi)
movl 0x40(%rdi), %edx
movsd 0x48(%rdi), %xmm0
callq 0xf53c
jmp 0x60993
testl %eax, %eax
je 0x609a7
decl %eax
movslq %eax, %r13
imulq $0xa8, %r13, %rax
movl 0x1fe4(%r15,%rax), %ecx
movl $0x10d0, %r14d          # imm = 0x10D0
cmpl 0x18(%r15), %ecx
jne 0x6094a
movl 0x14(%r15), %ecx
cmpl %ecx, 0x1fe0(%r15,%rax)
je 0x60990
movq 0x8(%rbx), %rax
imulq $0x178, %r13, %rcx      # imm = 0x178
leaq (%rax,%rcx), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
movsd 0x9c60(%rip), %xmm0     # 0x6a5c8
movsd 0x30(%rdi), %xmm1
mulsd %xmm0, %xmm1
mulsd 0x38(%rdi), %xmm0
leaq -0x38(%rbp), %rsi
movsd %xmm1, (%rsi)
movsd %xmm0, 0x8(%rsi)
movl 0x40(%rdi), %edx
movsd 0x48(%rdi), %xmm0
callq 0xf53c
movq %r13, %r12
addq 0x8(%rbx), %r14
imulq $0x178, %r12, %rax      # imm = 0x178
movb $0x1, 0x121(%rax,%r14)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq