Example #1
0
void Message::pack(OutputFrame::Ptr frame) const {
  if (frame->getVersion() == fv0_2) {
    frame->packInt(1);
    frame->packInt(0);
  } else {
    frame->packInt(0);
  }
  frame->packString(name);
  frame->packString(desc);
  if (frame->getVersion() > fv0_2) {
    frame->packInt(turn_number);
    frame->packInt(references.size());
    for (References::iterator itcurr = references.begin(); itcurr != references.end(); ++itcurr) {
      frame->packInt((*itcurr).first);
      frame->packInt((*itcurr).second);
    }
  }
}
bool AsyncTimeRemaining::createFrame(OutputFrame::Ptr f) {
  f->setType(ft02_Time_Remaining);
  f->packInt(rtime);
  if(f->getVersion() >= fv0_4){
    f->packInt(why); //reason
    f->packInt(Game::getGame()->getTurnNumber());
    f->packString(Game::getGame()->getTurnName());
  }
  return true;
}
Example #3
0
void Order::createFrame(OutputFrame::Ptr f, int pos)
{
  f->setType(ft02_Order);
  if(f->getVersion() <= fv0_3){
    f->packInt(Game::getGame()->getOrderManager()->getOrderQueue(orderqueueid)->getObjectId());
  }else{
    f->packInt(orderqueueid);
  }
  f->packInt(pos);
  f->packInt(type);
  f->packInt(turns);
  f->packIdMap(resources);
  std::for_each( parameters.begin(), parameters.end(), boost::bind( &OrderParameter::pack, _1, f ) );
}