Exemple #1
0
bool Debug::execute(aithread &thread) const
{
  // Perform independant behaviours
  if ( this->getOpcode() == AISCRIPT::Enum::FATAL_ERROR )
  {
    // Message
    Broodwar->sendText("Illegal AI script executed.");

    // Debug
    thread.saveDebug(Text::Green, this->getOpcode());
    
    // Kill the script
    thread.killThread();
    thread.noretry();
    return false;
  }
  else if ( this->getOpcode() == AISCRIPT::Enum::DEBUG )
  {
    // Read parameters
    WORD wJump;
    thread.readTuple( std::tie( wJump) );

    // Send the message
    Broodwar->sendText("%s", &pbAIScriptBinary[thread.getScriptOffset()] );

    // Jump to offset
    thread.setScriptOffset(wJump);
    thread.saveDebug(Text::Green, this->getOpcode(), "p_%X %s", wJump, &pbAIScriptBinary[thread.getScriptOffset()]);
  }
  return true;
}
Exemple #2
0
bool Return::execute(aithread &thread) const
{
  thread.saveDebug(Text::Green, this->getOpcode());
  bool result = thread.ret();
  
  // Error handling, kill the script if the callstack is empty
  if ( !result )
  {
    thread.killThread();
    thread.noretry();
    return false;
  }

  // Success
  return true;
}