// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq (%rdi), %rcx
movb 0x1b2(%rcx), %al
testb %al, %al
jne 0x6276b
cmpb $0x0, 0x1b1(%rcx)
jne 0x62763
cmpb $0x1, 0x1b0(%rcx)
jne 0x6277f
testb %al, %al
je 0x62845
movslq 0x14(%rbx), %rcx
movq 0x8(%rbx), %rdx
imulq $0x178, %rcx, %rcx      # imm = 0x178
movb $0x1, 0x50(%rdx,%rcx)
testb %al, %al
je 0x627db
movq 0x8(%rbx), %rax
movl 0x70(%rax), %edx
testl %edx, %edx
je 0x627db
leaq 0x30(%rax), %rdi
movsd 0x9e3e(%rip), %xmm0     # 0x6c5d8
movsd 0x60(%rax), %xmm1
mulsd %xmm0, %xmm1
mulsd 0x68(%rax), %xmm0
leaq -0x30(%rbp), %rsi
movsd %xmm1, (%rsi)
movsd %xmm0, 0x8(%rsi)
movsd 0x78(%rax), %xmm0
callq 0xf64c
movq 0x8(%rbx), %rax
movsd 0x80(%rax), %xmm0
mulsd 0x9dfd(%rip), %xmm0     # 0x6c5d0
movsd %xmm0, 0x80(%rax)
movq (%rbx), %r12
cmpb $0x1, 0x1b1(%r12)
jne 0x62971
movq %rbx, %rdi
callq 0x663a6
movl %eax, %r14d
movq %rbx, %rdi
callq 0x66406
testl %r14d, %r14d
setne %cl
testl %eax, %eax
setne %dl
testb %cl, %dl
je 0x62867
leal -0x1(%r14), %ecx
movslq %ecx, %rcx
imulq $0xa8, %rcx, %rcx
leal -0x1(%rax), %edx
movslq %edx, %rdx
imulq $0xa8, %rdx, %rdx
movsd 0x1fa8(%r12,%rdx), %xmm0
ucomisd 0x1870(%r12,%rcx), %xmm0
jae 0x6286c
jmp 0x628e7
cmpb $0x1, 0x1b1(%rcx)
jne 0x628b9
movslq 0x14(%rbx), %rcx
movq 0x8(%rbx), %rdx
imulq $0x178, %rcx, %rcx      # imm = 0x178
movb $0x1, 0x51(%rdx,%rcx)
jmp 0x6277f
testl %r14d, %r14d
je 0x628df
decl %r14d
movslq %r14d, %r14
imulq $0xa8, %r14, %rax
movl 0x18ac(%r12,%rax), %ecx
movl $0xa8, %r15d
cmpl 0x18(%r12), %ecx
jne 0x628a1
movl 0x14(%r12), %ecx
cmpl %ecx, 0x18a8(%r12,%rax)
je 0x6295d
movq 0x8(%rbx), %rax
imulq $0x178, %r14, %rcx      # imm = 0x178
leaq (%rax,%rcx), %rdi
addq $0xa8, %rdi
jmp 0x6292d
cmpb $0x1, 0x1b0(%rcx)
jne 0x6277f
movslq 0x14(%rbx), %rcx
movq 0x8(%rbx), %rdx
imulq $0x178, %rcx, %rcx      # imm = 0x178
movb $0x1, 0x52(%rdx,%rcx)
jmp 0x6277f
testl %eax, %eax
je 0x62971
decl %eax
movslq %eax, %r14
imulq $0xa8, %r14, %rax
movl 0x1fe4(%r12,%rax), %ecx
movl $0x10d0, %r15d          # imm = 0x10D0
cmpl 0x18(%r12), %ecx
jne 0x62917
movl 0x14(%r12), %ecx
cmpl %ecx, 0x1fe0(%r12,%rax)
je 0x6295d
movq 0x8(%rbx), %rax
imulq $0x178, %r14, %rcx      # imm = 0x178
leaq (%rax,%rcx), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
movsd 0x9ca3(%rip), %xmm0     # 0x6c5d8
movsd 0x30(%rdi), %xmm1
mulsd %xmm0, %xmm1
mulsd 0x38(%rdi), %xmm0
leaq -0x30(%rbp), %rsi
movsd %xmm1, (%rsi)
movsd %xmm0, 0x8(%rsi)
movl 0x40(%rdi), %edx
movsd 0x48(%rdi), %xmm0
callq 0xf64c
addq 0x8(%rbx), %r15
imulq $0x178, %r14, %rax      # imm = 0x178
movb $0x1, 0x121(%rax,%r15)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq