// File: 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
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x798a0
movq %rax, %rdi
callq 0x10de0
testb $0x1, (%rax)
jne 0x10040
callq 0x798a0
movq %rax, %rdi
callq 0x12080
testb $0x1, (%rax)
je 0x10245
leaq 0xee681(%rip), %rdi     # 0xfe6c8
callq 0x8ebb0
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
callq 0x11920
movq %rax, -0x18(%rbp)
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
callq 0x11980
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x11950
testb $0x1, %al
jne 0x10084
jmp 0x10234
leaq -0x18(%rbp), %rdi
callq 0x119b0
cmpl $0x0, (%rax)
je 0x100e3
leaq -0x18(%rbp), %rdi
callq 0x119b0
movq %rax, %rcx
movq -0x38(%rbp), %rax
addq $0x14, %rcx
movq %rcx, -0x40(%rbp)
movq 0x10(%rax), %rdi
callq 0x12100
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x120a0
testb $0x1, %al
jne 0x100c5
jmp 0x100e3
callq 0x63700
movq %rax, -0x48(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x12120
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x64100
leaq -0x18(%rbp), %rdi
callq 0x119b0
movq %rax, %rdi
addq $0x50, %rdi
callq 0xa9f0
testb $0x1, %al
jne 0x101e2
callq 0x798a0
movq %rax, %rdi
callq 0x12140
testb $0x1, (%rax)
je 0x1014f
movq 0xeded7(%rip), %rdi     # 0xfdff0
movq 0xede90(%rip), %rsi     # 0xfdfb0
callq 0xa630
movq %rax, -0x50(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x119b0
movq %rax, %rdi
addq $0x50, %rdi
callq 0xa240
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0xa5a0
jmp 0x101e0
callq 0x9e170
movq %rax, -0x58(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x119b0
movq %rax, %rdi
addq $0x50, %rdi
callq 0xa240
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x9e4c0
cmpl $0x0, %eax
jge 0x101de
jmp 0x10180
movq 0xede69(%rip), %rdi     # 0xfdff0
leaq 0xb0fd9(%rip), %rsi     # 0xc1167
callq 0xa5a0
movq %rax, %rdi
leaq 0xb50b4(%rip), %rsi     # 0xc5251
callq 0xa5a0
movq %rax, %rdi
movl $0x486, %esi            # imm = 0x486
callq 0xaa40
movq %rax, %rdi
leaq 0xb33a6(%rip), %rsi     # 0xc355f
callq 0xa5a0
movq %rax, %rdi
leaq 0xb0fb9(%rip), %rsi     # 0xc1181
callq 0xa5a0
movq %rax, %rdi
movq 0xeddd9(%rip), %rsi     # 0xfdfb0
callq 0xa630
jmp 0x101de
jmp 0x101e0
jmp 0x101e2
callq 0x798a0
movq %rax, %rdi
callq 0x12160
testb $0x1, (%rax)
je 0x10224
cmpq $0x0, -0x10(%rbp)
je 0x10224
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x119b0
movq %rax, %rdi
addq $0x50, %rdi
callq 0xa240
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0xaa80
jmp 0x10226
leaq -0x18(%rbp), %rdi
callq 0x11cf0
jmp 0x1005d
leaq 0xee48d(%rip), %rdi     # 0xfe6c8
callq 0x8ebe0
jmp 0x1041d
movb $0x0, 0xee4a4(%rip)     # 0xfe6f0
leaq 0xee475(%rip), %rdi     # 0xfe6c8
callq 0x8ebb0
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
callq 0x11920
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
callq 0x11980
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x11950
testb $0x1, %al
jne 0x10290
jmp 0x10323
leaq -0x28(%rbp), %rdi
callq 0x119b0
cmpl $0x0, (%rax)
je 0x10313
leaq -0x28(%rbp), %rdi
callq 0x119b0
movq %rax, %rcx
movq -0x38(%rbp), %rax
addq $0x14, %rcx
movq %rcx, -0x68(%rbp)
movq 0x10(%rax), %rdi
callq 0x12100
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0x120a0
testb $0x1, %al
jne 0x102d1
jmp 0x10313
leaq -0x28(%rbp), %rdi
callq 0x119b0
movq %rax, %rdi
addq $0x50, %rdi
callq 0xa240
movq %rax, %rsi
leaq 0xee400(%rip), %rdi     # 0xfe6f0
callq 0xaa80
callq 0x63700
movq %rax, -0x70(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x12120
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x64100
jmp 0x10315
leaq -0x28(%rbp), %rdi
callq 0x11cf0
jmp 0x10269
leaq 0xee39e(%rip), %rdi     # 0xfe6c8
callq 0x8ebe0
movsbl 0xee3ba(%rip), %eax     # 0xfe6f0
cmpl $0x0, %eax
je 0x103f2
callq 0x798a0
movq %rax, %rdi
callq 0x12140
testb $0x1, (%rax)
je 0x10375
movq 0xedc98(%rip), %rdi     # 0xfdff0
movq 0xedc51(%rip), %rsi     # 0xfdfb0
callq 0xa630
movq %rax, %rdi
leaq 0xee382(%rip), %rsi     # 0xfe6f0
callq 0xa5a0
jmp 0x103f0
callq 0x9e170
movq %rax, %rdi
leaq 0xee36c(%rip), %rsi     # 0xfe6f0
callq 0x9e4c0
cmpl $0x0, %eax
jge 0x103ee
jmp 0x10390
movq 0xedc59(%rip), %rdi     # 0xfdff0
leaq 0xb0dc9(%rip), %rsi     # 0xc1167
callq 0xa5a0
movq %rax, %rdi
leaq 0xb4ea4(%rip), %rsi     # 0xc5251
callq 0xa5a0
movq %rax, %rdi
movl $0x4a4, %esi            # imm = 0x4A4
callq 0xaa40
movq %rax, %rdi
leaq 0xb3196(%rip), %rsi     # 0xc355f
callq 0xa5a0
movq %rax, %rdi
leaq 0xb0da9(%rip), %rsi     # 0xc1181
callq 0xa5a0
movq %rax, %rdi
movq 0xedbc9(%rip), %rsi     # 0xfdfb0
callq 0xa630
jmp 0x103ee
jmp 0x103f0
jmp 0x103f2
callq 0x798a0
movq %rax, %rdi
callq 0x12160
testb $0x1, (%rax)
je 0x1041b
cmpq $0x0, -0x10(%rbp)
je 0x1041b
movq -0x10(%rbp), %rdi
leaq 0xee2da(%rip), %rsi     # 0xfe6f0
callq 0xaa80
jmp 0x1041d
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)