[solved]SharedPtr and StringVector::iterator + OGRE 1.0.0

Problems building or running the engine, queries about how to use features etc.
Post Reply
Ken
Gnoblar
Posts: 4
Joined: Thu Feb 17, 2005 8:48 pm

[solved]SharedPtr and StringVector::iterator + OGRE 1.0.0

Post by Ken »

Hi,

I have a big problem with StringVectorPtr. I am trying to make a archive plugin for a particular file format. It is like OgreZip class with some modifications for my necessity.
The plugin compile without errors but when I run a program that uses this plugin it stops in the function ResourceGroupManager::addResourceLocation, after the line 307 without
generating any error. It Simply stops.
This "error" happens when the Ogre try to get the iterator from data returned
by my MyArchive::find function.

Code: Select all


StringVectorPtr MyArchive::find(const String& pattern, bool recursive) {
  FileList::iterator     fileIterator;
  String                 fileName;
  String                 filePath;
  String                 filePathName;
  StringVectorPtr        retVec = StringVectorPtr(new StringVector());

  for (fileIterator=fileList.begin();fileIterator!=fileList.end();fileIterator++) {
      filePath = (*fileIterator)->FileFullPathName;
      fileName = (*fileIterator)->FileName;
      filePathName = filePath + fileName;

      if (recursive || filePath.empty()) {
        if (StringUtil::match(fileName, pattern, false))
          retVec->push_back(filePathName);
      }
      else {
        if (StringUtil::match(filePathName, pattern, false))
          retVec->push_back(filePathName);
      };
    };

    return retVec;
  }



    .... ogre code

  
    void ResourceGroupManager::addResourceLocation(const String& name, 
        const String& locType, const String& resGroup, bool recursive)
    {
        ResourceGroup* grp = getResourceGroup(resGroup);
        if (!grp)
        {
            createResourceGroup(resGroup);
            grp = getResourceGroup(resGroup);
        }

	OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex

        // Get archive
        Archive* pArch = ArchiveManager::getSingleton().load( name, locType );
        // Add to location list
		ResourceLocation* loc = new ResourceLocation();
		loc->archive = pArch;
		loc->recursive = recursive;
        grp->locationList.push_back(loc);
        // Index resources
        StringVectorPtr vec = pArch->find("*", recursive);

[color=red]//=========ERROR HERE=========[/color]
      for(StringVector::iterator it=vec->begin(); it!=vec->end(); ++it )  
        {
	    // Index under full name, case sensitive
            grp->resourceIndexCaseSensitive[(*it)] = pArch;
            if (!pArch->isCaseSensitive())
            {
	            // Index under lower case name too for case insensitive match
    	        String indexName = (*it);
                StringUtil::toLowerCase(indexName);
	            grp->resourceIndexCaseInsensitive[indexName] = pArch;
            }
        }
My project is Multi-threaded Debug DLL. I think forgot to configure something...

Thanks in advanced.
Last edited by Ken on Thu Feb 17, 2005 10:13 pm, edited 1 time in total.
Ken
Gnoblar
Posts: 4
Joined: Thu Feb 17, 2005 8:48 pm

[solved]SharedPtr and StringVector::iterator + OGRE 1.0.0

Post by Ken »

Hi,

I forgot to define _STLP_DEBUG!!!!


:oops:
Post Reply