⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scriptplayer.cc

📁 The Little Green BATS is the first and so far only Dutch team in the 3D simulation league. We are a
💻 CC
字号:
#include "scriptplayer.ih"ScriptPlayer::ScriptPlayer(string const &id, string const &playerClass)  : Behavior("ScriptPlayer", id, playerClass),    d_waitUntil(-1),    d_lastStepTime(0),    d_curLine(0),    d_lastChecked(0),    d_maxSpeed(100.0){	d_committed = true;	  XMLNodeSet params = getParams("/script");  istringstream scriptReader;  if(params && !params.empty())  {    XMLNode scriptNode = params.front();    scriptReader.str(scriptNode.getContent());    //unsigned nLines;    //scriptReader >> nLines;    vector<pair<double, double> > scriptLine(Types::NJOINTS + 1, pair<double,double>(0, d_maxSpeed / 180.0 * M_PI));        while (!scriptReader.eof())    {      _debugLevel4("Reading new line");            int joint = -1;      char eq = '=';      double value = 0;      char punc = 0;            bool newline = false;            while (eq == '=' && punc != ';')      {        // Set wait to 0        scriptLine[Types::NJOINTS] = pair<double, double>(0, 0);                scriptReader >> joint >> eq >> value >> punc;        double maxSpeed = d_maxSpeed;        if (punc == ':')          scriptReader >> maxSpeed >> punc;                  if (joint < 0 || joint > Types::NJOINTS)          break;                  newline = true;                _debugLevel4("eq: " << eq << ", angle: " << value << ", punc: " << punc);                if (joint < Types::NJOINTS)          scriptLine[joint] = pair<double, double>((value / 180.0) * M_PI, (maxSpeed / 180.0) * M_PI);        else // Wait instruction          scriptLine[Types::NJOINTS] = pair<double, double>(value, 0);              }            if (newline)        d_script.push_back(scriptLine);      else        break;              //for (unsigned j = 0; j <= Types::NJOINTS; ++j)      // cerr << scriptLine[j] << " ";      //cerr << endl;    }  }  d_tree = new AST::Node(sequenceType);  d_tree->addChild(new AST::Node(andType));  for (unsigned i = 0; i < Types::NJOINTS; ++i)    d_tree->getChild(0)->addChild(new AST::Node(orType));}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -