// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/ActionEffector.cpp
// Function: ActionEffector::SendCommands(char*)
void ActionEffector::SendCommands(char *msg) {
  if (PlayerParam::instance().isCoach() ||
      PlayerParam::instance().isTrainer()) {
    // Coach分条发送命令
    ActionEffector::CMD_QUEUE_MUTEX.Lock();
    for (std::list<CommandInfo>::iterator it = mCommandQueue.begin();
         it != mCommandQueue.end(); ++it) {
      if (it->mType != CT_None &&
          it->mTime == mWorldState.CurrentTime()) // TODO: seg fault here
      {
        NetworkTest::instance().SetCommandSendCount((*it));
      }
      if (!it->mString.empty()) {
        if (PlayerParam::instance().DynamicDebugMode()) {
          std::cerr << std::endl
                    << it->mString.c_str(); // 动态调试模式，直接输出命令即可
        } else if (UDPSocket::instance().Send(it->mString.c_str()) <
                   0) // 发送命令
        {
          PRINT_ERROR("UDPSocket error!");
        }
      }
      if (PlayerParam::instance().SaveServerMessage() &&
          msg != 0) //说明要记录命令信息
      {
        strcat(msg, it->mString.c_str());
      }
    }
    ActionEffector::CMD_QUEUE_MUTEX.UnLock();
  } else {
    //球员把命令放在一起发
    static char command_msg[MAX_MESSAGE];

    command_msg[0] = '\0';
    ActionEffector::CMD_QUEUE_MUTEX.Lock();
    for (std::list<CommandInfo>::iterator it = mCommandQueue.begin();
         it != mCommandQueue.end(); ++it) {
      if (it->mType != CT_None && it->mTime == mWorldState.CurrentTime()) {
        strcat(command_msg, it->mString.c_str());
        NetworkTest::instance().SetCommandSendCount((*it));
      }
    }
    ActionEffector::CMD_QUEUE_MUTEX.UnLock();

    if (command_msg[0] != '\0') {
      if (PlayerParam::instance().DynamicDebugMode()) {
        std::cerr << std::endl << command_msg; // 动态调试模式，直接输出命令即可
      } else if (UDPSocket::instance().Send(command_msg) < 0) // 发送命令
      {
        PRINT_ERROR("UDPSocket error!");
      }
    }
    if (PlayerParam::instance().SaveServerMessage() &&
        msg != 0) //说明要记录命令信息
    {
      strcat(msg, command_msg);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, -0x30(%rbp)
callq 0x43dce
cmpb $0x0, 0x31a5(%rax)
jne 0xe35b
callq 0x43dce
cmpb $0x1, 0x31a6(%rax)
jne 0xe52a
leaq 0x76216(%rip), %rdi     # 0x84578
callq 0x4e01a
movq -0x30(%rbp), %rax
leaq 0x28(%rax), %r15
movq 0x28(%rax), %r14
cmpq %r15, %r14
je 0xe510
cmpl $0x0, 0x10(%r14)
je 0xe3b1
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x28(%r14), %ecx
cmpl 0x14(%rax), %ecx
jne 0xe3b1
movl 0x10(%rax), %eax
cmpl %eax, 0x24(%r14)
jne 0xe3b1
leaq 0x10(%r14), %r12
callq 0x38882
movq %rax, %rdi
movq %r12, %rsi
callq 0x39154
cmpq $0x0, 0x68(%r14)
je 0xe4e9
callq 0x43dce
cmpb $0x1, 0x5c40(%rax)
jne 0xe424
movq 0x75c1f(%rip), %r12     # 0x83ff0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r12, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
movq %rax, %r12
movq 0x60(%r14), %r13
testq %r13, %r13
je 0xe4ce
movq %r13, %rdi
callq 0x9200
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x9560
jmp 0xe4e9
callq 0x54038
movq 0x60(%r14), %rsi
movq %rax, %rdi
callq 0x5432c
testl %eax, %eax
jns 0xe4e9
movl $0x19, %edx
movq 0x75ba7(%rip), %r12     # 0x83ff0
movq %r12, %rdi
leaq 0x5ad64(%rip), %rsi     # 0x691b7
callq 0x9560
movl $0x1, %edx
movq %r12, %rdi
leaq 0x5ed2b(%rip), %rsi     # 0x6d192
callq 0x9560
movq %r12, %rdi
movl $0x486, %esi            # imm = 0x486
callq 0x9880
movq %rax, %r12
movl $0x3, %edx
movq %rax, %rdi
leaq 0x5cfcc(%rip), %rsi     # 0x6b457
callq 0x9560
movl $0x10, %edx
movq %r12, %rdi
leaq 0x5ad32(%rip), %rsi     # 0x691d1
callq 0x9560
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r12, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
jmp 0xe4e9
movq (%r12), %rax
movq -0x18(%rax), %rax
movq %r12, %rdi
addq %rax, %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x9860
callq 0x43dce
testq %rbx, %rbx
je 0xe508
cmpb $0x0, 0x5c42(%rax)
je 0xe508
movq 0x60(%r14), %rsi
movq %rbx, %rdi
callq 0x98c0
movq (%r14), %r14
jmp 0xe373
leaq 0x76061(%rip), %rdi     # 0x84578
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4e036
movb $0x0, 0x7606f(%rip)     # 0x845a0
leaq 0x76040(%rip), %rdi     # 0x84578
callq 0x4e01a
movq -0x30(%rbp), %rax
leaq 0x28(%rax), %r14
movq 0x28(%rax), %r13
cmpq %r14, %r13
je 0xe59f
leaq 0x7604b(%rip), %r15     # 0x845a0
cmpl $0x0, 0x10(%r13)
je 0xe596
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x28(%r13), %ecx
cmpl 0x14(%rax), %ecx
jne 0xe596
movl 0x10(%rax), %eax
cmpl %eax, 0x24(%r13)
jne 0xe596
leaq 0x10(%r13), %r12
movq 0x60(%r13), %rsi
movq %r15, %rdi
callq 0x98c0
callq 0x38882
movq %rax, %rdi
movq %r12, %rsi
callq 0x39154
movq (%r13), %r13
cmpq %r14, %r13
jne 0xe555
leaq 0x75fd2(%rip), %rdi     # 0x84578
callq 0x4e036
cmpb $0x0, 0x75fee(%rip)     # 0x845a0
je 0xe6c3
callq 0x43dce
cmpb $0x1, 0x5c40(%rax)
jne 0xe619
movq 0x75a23(%rip), %r14     # 0x83ff0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r14, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
movq %rax, %r14
leaq 0x75fa2(%rip), %r15     # 0x845a0
movq %r15, %rdi
callq 0x9200
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x9560
jmp 0xe6c3
callq 0x54038
leaq 0x75f7b(%rip), %rsi     # 0x845a0
movq %rax, %rdi
callq 0x5432c
testl %eax, %eax
jns 0xe6c3
movq 0x759b4(%rip), %r14     # 0x83ff0
leaq 0x5ab74(%rip), %rsi     # 0x691b7
movl $0x19, %edx
movq %r14, %rdi
callq 0x9560
leaq 0x5eb3b(%rip), %rsi     # 0x6d192
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
movq %r14, %rdi
movl $0x4a4, %esi            # imm = 0x4A4
callq 0x9880
movq %rax, %r14
leaq 0x5cddc(%rip), %rsi     # 0x6b457
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x5ab42(%rip), %rsi     # 0x691d1
movl $0x10, %edx
movq %r14, %rdi
callq 0x9560
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r14, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
callq 0x43dce
testq %rbx, %rbx
je 0xe6f3
cmpb $0x0, 0x5c42(%rax)
je 0xe6f3
leaq 0x75ec3(%rip), %rsi     # 0x845a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x98c0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq