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]; } } }
void Coil::vend() { servo.attach(_motorPin); servo.write(0); delay(1350); servo.write(90); setStock(getStock() - 1); }
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; }
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 ¤tStock = getStock(reservedStock._goodType); currentStock._currentQty -= amount; stock._currentQty += amount; // std::cout << "SimpleGoodStore, retrieve qty=" << amount << " resID=" << reservationID << std::endl; }
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]; } } } }
QString RProduitStock::creerId() { return getStock()->getCode() + getProduit()->getCode(); }
boolean Coil::isEmpty() { return getStock() < 1; }