// File: /workspace/github_cpp_makefile_star2_O2/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 0x50856
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 0x5089e
leaq 0x30(%rax), %rdi
movsd 0x7d88(%rip), %xmm0     # 0x58598
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 0xdde8
movq 0x8(%rbx), %rax
movsd 0x80(%rax), %xmm0
mulsd 0x7d47(%rip), %xmm0     # 0x58590
movsd %xmm0, 0x80(%rax)
movq (%rbx), %r15
jmp 0x5089e
cmpb $0x0, 0x1b1(%r15)
je 0x50876
movslq 0x14(%rbx), %rax
movq 0x8(%rbx), %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
movb $0x1, 0x51(%rcx,%rax)
jmp 0x5089e
cmpb $0x0, 0x1b0(%r15)
je 0x5089e
cmpb $0x1, 0x1b0(%r15)
jne 0x5089e
movslq 0x14(%rbx), %rax
movq 0x8(%rbx), %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
movb $0x1, 0x52(%rcx,%rax)
cmpb $0x1, 0x1b1(%r15)
jne 0x50a10
movq %rbx, %rdi
callq 0x52fc4
movl %eax, %r14d
movq %rbx, %rdi
callq 0x53028
movl %eax, %ecx
imull %r14d, %ecx
testl %ecx, %ecx
je 0x508fd
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 0x50908
jmp 0x5098a
testl %r14d, %r14d
je 0x5097d
decl %r14d
movslq %r14d, %r12
imulq $0xa8, %r12, %rax
movl 0x18ac(%r15,%rax), %ecx
movl $0xa8, %r14d
cmpl 0x18(%r15), %ecx
jne 0x50935
movl 0x14(%r15), %ecx
cmpl %ecx, 0x18a8(%r15,%rax)
je 0x509fc
movq 0x8(%rbx), %rax
imulq $0x178, %r12, %rcx      # imm = 0x178
leaq (%rax,%rcx), %rdi
addq $0xa8, %rdi
movsd 0x7c45(%rip), %xmm0     # 0x58598
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 0xdde8
jmp 0x509fc
testl %eax, %eax
je 0x50a10
decl %eax
movslq %eax, %r13
imulq $0xa8, %r13, %rax
movl 0x1fe4(%r15,%rax), %ecx
movl $0x10d0, %r14d          # imm = 0x10D0
cmpl 0x18(%r15), %ecx
jne 0x509b3
movl 0x14(%r15), %ecx
cmpl %ecx, 0x1fe0(%r15,%rax)
je 0x509f9
movq 0x8(%rbx), %rax
imulq $0x178, %r13, %rcx      # imm = 0x178
leaq (%rax,%rcx), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
movsd 0x7bc7(%rip), %xmm0     # 0x58598
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 0xdde8
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
nop