From: Matze B. <mat...@us...> - 2002-09-16 18:52:34
|
Update of /cvsroot/planeshift/planeshift/src/common/util In directory usw-pr-cvs1:/tmp/cvs-serv25306/src/common/util Modified Files: texfactory.cpp texfactory.h Log Message: planeshift STRICT_SMARTIES patch part1 Index: texfactory.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/common/util/texfactory.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texfactory.cpp 20 Aug 2002 21:04:45 -0000 1.2 --- texfactory.cpp 16 Sep 2002 18:52:31 -0000 1.3 *************** *** 17,22 **** * */ - - #include <config.h> --- 17,20 ---- *************** *** 43,52 **** psTextureFactory::object_reg = object_reg; ! iVFS* vfs = CS_QUERY_REGISTRY(object_reg, iVFS); if (!vfs) return false; ! iFile* file = vfs->Open(xmlfilename, VFS_FILE_READ); ! vfs->DecRef(); if (!file) --- 41,49 ---- psTextureFactory::object_reg = object_reg; ! csRef<iVFS> vfs = CS_QUERY_REGISTRY(object_reg, iVFS); if (!vfs) return false; ! csRef<iFile> file = vfs->Open(xmlfilename, VFS_FILE_READ); if (!file) *************** *** 68,73 **** } while (readsize == 512); - file->DecRef(); - psXMLString temp,racestr; int tagstart, start; --- 65,68 ---- *************** *** 165,169 **** } ! iImage *psTextureFactory::CreateTextureImage(const char *xmlspec) { psXMLString xml(xmlspec); --- 160,164 ---- } ! csPtr<iImage> psTextureFactory::CreateTextureImage(const char *xmlspec) { psXMLString xml(xmlspec); *************** *** 182,186 **** tag.GetTagParm("base",filename); ! iImage *base = GetImage(race,filename); if (!base) --- 177,181 ---- tag.GetTagParm("base",filename); ! csRef<iImage> base = GetImage(race,filename); if (!base) *************** *** 190,194 **** } ! iImage *newimage = base->Clone(); // Now cycle through all part tags and integrate each region into existing image. --- 185,189 ---- } ! csRef<iImage> newimage = base->Clone(); // Now cycle through all part tags and integrate each region into existing image. *************** *** 201,205 **** tag.GetTagParm("texture",filename); ! iImage *source = GetImage(race,filename); if (!source) { --- 196,200 ---- tag.GetTagParm("texture",filename); ! csRef<iImage> source = GetImage(race,filename); if (!source) { *************** *** 207,211 **** (const char *)race, (const char *)filename); - newimage->DecRef(); return NULL; } --- 202,205 ---- *************** *** 221,225 **** (const char *)race, (const char *)part); - newimage->DecRef(); return NULL; } --- 215,218 ---- *************** *** 228,232 **** } ! return newimage; } --- 221,226 ---- } ! newimage->IncRef (); ! return csPtr<iImage> (newimage); } *************** *** 250,257 **** } ! iImage *psTextureFactory::GetImage(const char *race,const char *filename) { // Go through cache first, then try to load. - iImage *first = (iImage*) imagecache.GetFirstItem(); iImage *p = first; --- 244,250 ---- } ! csPtr<iImage> psTextureFactory::GetImage(const char *race,const char *filename) { // Go through cache first, then try to load. iImage *first = (iImage*) imagecache.GetFirstItem(); iImage *p = first; *************** *** 272,278 **** // if still not found here, attempt to load ! iLoader *loader = CS_QUERY_REGISTRY(object_reg, iLoader); if(!loader) return NULL; // or something else ! iImage* image = loader->LoadImage(name, CS_IMGFMT_TRUECOLOR); --- 265,271 ---- // if still not found here, attempt to load ! csRef<iLoader> loader = CS_QUERY_REGISTRY(object_reg, iLoader); if(!loader) return NULL; // or something else ! csRef<iImage> image = loader->LoadImage(name, CS_IMGFMT_TRUECOLOR); *************** *** 287,305 **** if (image) { - image->DecRef(); image=NULL; } } ! loader->DecRef(); ! return image; } - - - /*--------------------------------------------------------------------*/ - - psRegion::psRegion(const char *racename,const char *partname) --- 280,292 ---- if (image) { image=NULL; } } ! image->IncRef (); ! return csPtr<iImage> (image); } /*--------------------------------------------------------------------*/ psRegion::psRegion(const char *racename,const char *partname) Index: texfactory.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/common/util/texfactory.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texfactory.h 20 Aug 2002 21:04:45 -0000 1.2 --- texfactory.h 16 Sep 2002 18:52:31 -0000 1.3 *************** *** 61,65 **** * otherwise the image is loaded, added to the cache list, and returned. */ ! iImage *GetImage(const char *race,const char *filename); public: --- 61,65 ---- * otherwise the image is loaded, added to the cache list, and returned. */ ! csPtr<iImage> GetImage(const char *race,const char *filename); public: *************** *** 80,84 **** * ptr is returned to the caller. Otherwise, NULL. */ ! iImage *CreateTextureImage(const char *xmlspec); }; --- 80,84 ---- * ptr is returned to the caller. Otherwise, NULL. */ ! csPtr<iImage> CreateTextureImage(const char *xmlspec); }; |