//----------------------------------------------- // computeVS : // compute Visual Slots for this sheet. //----------------------------------------------- void CSheetManager::computeVS() { static std::map< std::string, uint16 > ProcessedItem; map< string, uint16 >::iterator it; CVisualSlotManager::TVisualSlot vs; vs.resize(SLOTTYPE::NB_SLOT); // TEntitySheetMap::iterator itS = _EntitySheetContainer.begin(); while(itS != _EntitySheetContainer.end()) { // Visual Slots are only valid for Items. CItemSheet *item = dynamic_cast<CItemSheet *>((*itS).second.EntitySheet); if (item && (*itS).first.getSheetType()==CSheetId::typeFromFileExtension(std::string("sitem"))) { for(uint j=0; j<SLOTTYPE::NB_SLOT_TYPE; ++j) { SLOTTYPE::TSlotType slotType= (SLOTTYPE::TSlotType)j; if( item->hasSlot(slotType) ) { SLOTTYPE::EVisualSlot visualSlot = SLOTTYPE::convertTypeToVisualSlot(slotType); if(visualSlot != SLOTTYPE::HIDDEN_SLOT) { string currentSheet = ((*itS).first).toString(); CVisualSlotManager::TElement vsElmt; string sheetName = toString("%s%d", currentSheet.c_str(), visualSlot); // Is the sheet already process (could be process by a sheet with a different lvl) it = ProcessedItem.find( sheetName ); // Insert if not found if(it == ProcessedItem.end()) { uint itemNumber; if(vs[visualSlot].Element.size() == 0) itemNumber = 1; else itemNumber = vs[visualSlot].Element[vs[visualSlot].Element.size()-1].Index+1; // Item Processed ProcessedItem.insert(make_pair(sheetName, itemNumber)); vsElmt.Index = itemNumber; } else { vsElmt.Index = (*it).second; } // vsElmt.SheetId = (*itS).first; vs[visualSlot].Element.push_back(vsElmt); } } } } // Next Sheet ++itS; } // Open the file. NLMISC::COFile f; if(f.open("visual_slot.tab")) { // Dump entities. f.serialCont(vs); // Close the File. f.close(); } else nlwarning("SheetMngr:load: cannot open/create the file 'visual_slot.tab'."); }// computeVS //