示例#1
0
void Sprite::remapImages(FrameNumber frameFrom, FrameNumber frameTo, const std::vector<uint8_t>& mapping)
{
  ASSERT(m_format == IMAGE_INDEXED);
  ASSERT(mapping.size() == 256);

  CelList cels;
  getCels(cels);

  for (CelIterator it = cels.begin(); it != cels.end(); ++it) {
    Cel* cel = *it;

    // Remap this Cel because is inside the specified range
    if (cel->getFrame() >= frameFrom &&
        cel->getFrame() <= frameTo) {
      Image* image = getStock()->getImage(cel->getImage());
      LockImageBits<IndexedTraits> bits(image);
      LockImageBits<IndexedTraits>::iterator
        it = bits.begin(),
        end = bits.end();

      for (; it != end; ++it)
        *it = mapping[*it];
    }
  }
}
示例#2
0
void Coil::vend()
{  
  servo.attach(_motorPin);
  servo.write(0);
  delay(1350);
  servo.write(90);
  setStock(getStock() - 1);
}
示例#3
0
DatetimeList StockManager::
getTradingCalendar(const KQuery& query, const string& market) {
    Stock stock = getStock("SH000001");
    size_t start_ix = 0, end_ix = 0;
    DatetimeList result;
    if (stock.getIndexRange(query, start_ix, end_ix)) {
        result = stock.getDatetimeList(start_ix, end_ix, query.kType());
    }
    return result;
}
示例#4
0
bool Storage::applyRetrieveReservation(good::Stock& stock, const int reservationID)
{
  good::Stock reservedStock = getRetrieveReservation(reservationID, true);

  if (stock.type() != reservedStock.type())
  {
    Logger::warning( "SimpleGoodStore:GoodType does not match reservation");
    return false;
  }

  if( stock.capacity() < stock.qty() + reservedStock.qty())
  {
    Logger::warning( "SimpleGoodStore:Quantity does not match reservation");
    return false;
  }

  int amount = reservedStock.qty();
  good::Stock& currentStock = getStock(reservedStock.type());
  currentStock.pop( amount );
  stock.push( amount );
  return true;
}
void SimpleGoodStore::applyRetrieveReservation(GoodStock &stock, const long reservationID)
{
    GoodStock reservedStock = getRetrieveReservation(reservationID, true);

    if (stock._goodType != reservedStock._goodType)
    {
        _OC3_DEBUG_BREAK_IF("SimpleGoodStore:GoodType does not match reservation");
        return;
    }

    if( stock._maxQty < stock._currentQty + reservedStock._currentQty)
    {
        _OC3_DEBUG_BREAK_IF("SimpleGoodStore:Quantity does not match reservation");
        return;
    }

    int amount = reservedStock._currentQty;
    GoodStock &currentStock = getStock(reservedStock._goodType);
    currentStock._currentQty -= amount;
    stock._currentQty += amount;
    // std::cout << "SimpleGoodStore, retrieve qty=" << amount << " resID=" << reservationID << std::endl;
}
示例#6
0
void Sprite::remapImages(FrameNumber frameFrom, FrameNumber frameTo, const std::vector<uint8_t>& mapping)
{
  ASSERT(m_format == IMAGE_INDEXED);
  ASSERT(mapping.size() == 256);

  CelList cels;
  getCels(cels);

  for (CelIterator it = cels.begin(); it != cels.end(); ++it) {
    Cel* cel = *it;

    // Remap this Cel because is inside the specified range
    if (cel->getFrame() >= frameFrom &&
        cel->getFrame() <= frameTo) {
      Image* image = getStock()->getImage(cel->getImage());

      for (int y=0; y<image->h; ++y) {
        IndexedTraits::address_t ptr = image_address_fast<IndexedTraits>(image, 0, y);
        for (int x=0; x<image->w; ++x, ++ptr)
          *ptr = mapping[*ptr];
      }
    }
  }
}
示例#7
0
 QString RProduitStock::creerId()
 {
     return getStock()->getCode() + getProduit()->getCode();
 }
示例#8
0
boolean Coil::isEmpty()
{
	return getStock() < 1;
}