void GameLayerMapBorder::updateBox2dBorderLine() { //return ; // _isBox2DBorderLineDirt = true; if(_isBox2DBorderLineDirt) { _isBox2DBorderLineDirt = false; removeAllBorderLineInBox2dWorld(); std::set<BorderCell> oldSet; float y = GameLayerPlant::getRunningLayer()->getPlantMinTopHeightInView()-200; auto cellmin= _mapGrid->getMapGridCellByPosition(0, y); int minY =cellmin._y; for(auto& i:_borderMap) { if(i.first._y < minY)continue; oldSet.insert(BorderCell(i.first,i.second._maskType)); } std::list<GameBorderLine> oldList(std::move(getBorderlines(std::move(oldSet)))); for(auto& line :oldList) { addBorderLineToBox2dWorld(line); } } }
void MultiDLDbImpl::list(const vector<DLDbIdentifier> &list) { StLock<Mutex> _(mLock); set<DLDbIdentifier> oldList(mListRef->begin(), mListRef->end()); mListRef = ListRef(list); set<DLDbIdentifier> newList(mListRef->begin(), mListRef->end()); vector<DLDbIdentifier> obsolete; back_insert_iterator<vector<DLDbIdentifier> > ii(obsolete); // Remove all db's from the map that were in oldList but are not in mListRef. set_difference(oldList.begin(), oldList.end(), newList.begin(), newList.end(), ii); for (vector<DLDbIdentifier>::const_iterator it = obsolete.begin(); it != obsolete.end(); ++it) mDbMap.erase(*it); }
bool Station::setSlotOutTheWindow(Basic::PairStream* const list) { Basic::PairStream* newList = 0; // Make sure the new list only has OTW type objects if (list != 0) { for (Basic::List::Item* item = list->getFirstItem(); item != 0; item = item->getNext()) { Basic::Pair* pair = (Basic::Pair*)(item->getValue()); Otw* p = dynamic_cast<Otw*>( pair->object() ); if (p != 0) { if (newList == 0) { newList = new Basic::PairStream(); } newList->put(pair); // Add this OTW to our new OTW list p->container(this); } else if (isMessageEnabled(MSG_WARNING)) { // Not of the proper type std::cerr << "Player::setOutTheWindow: OTW at slot \"" << pair->slot() << "\" is not of type Otw" << std::endl; } } } // Remove the old OTW interfaces if (otw != 0) { SPtr<Basic::PairStream> oldList( otw ); otw = 0; // we are no longer the container for these old OTW interfaces for (Basic::List::Item* item = oldList->getFirstItem(); item != 0; item = item->getNext()) { Basic::Pair* pair = (Basic::Pair*)(item->getValue()); Component* p = (Component*)( pair->object() ); p->container(0); } } // Set the pointer to the list of OTW interfaces otw = newList; return true; }