Page 1 of 1

Getting bmp tiles from a zip folder

Posted: Tue Jun 20, 2006 2:25 am
by HighBuddha
I am trying to load a zip file which has all my game tiles in it. I've gone over the tutorials and looked around the forum for some answers, but this is the best i could come up with. Could someone help me out?

Code: Select all

io::IFileSystem* filesystem = device->getFileSystem();
    filesystem->addZipFileArchive("../../MEV2/TILES/tiles.zip", true, true);
    io::IFileList* filelist = filesystem->createFileList();
    
    if(filelist->getFileCount() == 0)
    {
    }
    else
    {
        
        for(int i = 0; i<= filelist->getFileCount(); i++)
        {
                           CTile temp;
   					           temp.settilename(filelist->getFileName(i));
   					       video::ITexture* temp2 = driver->getTexture(temp.gettilename());
   					       driver->makeColorKeyTexture(temp2, core::position2d<s32>(0,0));
                           temp.setImage(temp2);
                           tilelist.push_back(temp);
        }
        filelist->drop();
    }
I keep getting access violation errors on the first line when i try to debug. I am very confused at this point and could really use some help. Thank you to anyone who can give some information.

Posted: Tue Jun 20, 2006 6:16 am
by jam
what is the value of the variable called device? I suspect the pointer is invalid.

Posted: Sun Jul 09, 2006 8:04 pm
by counter123
for(int i = 0; i<= filelist->getFileCount(); i++)
I think you need a < instead of a <= here.

Posted: Sun Jul 09, 2006 9:32 pm
by jam
Good call, counter123.