Fixed bug loading textures from zip files.

This commit is contained in:
leo 2012-12-18 18:55:06 +00:00
parent 0e34b95d1a
commit 4d7fa13fc5

View file

@ -170,6 +170,7 @@ bool lcPiecesLibrary::OpenArchive(const char* FileName, const char* CachePath)
lcTexture* Texture = new lcTexture(); lcTexture* Texture = new lcTexture();
mTextures.Add(Texture); mTextures.Add(Texture);
*Dst = 0;
strncpy(Texture->mName, Name + 21, sizeof(Texture->mName)); strncpy(Texture->mName, Name + 21, sizeof(Texture->mName));
Texture->mName[sizeof(Texture->mName) - 1] = 0; Texture->mName[sizeof(Texture->mName) - 1] = 0;
} }
@ -833,7 +834,7 @@ bool lcPiecesLibrary::LoadTexture(lcTexture* Texture)
{ {
lcMemFile TextureFile; lcMemFile TextureFile;
sprintf(FileName, "parts/textures/%s.png", Name); sprintf(FileName, "ldraw/parts/textures/%s.png", Name);
if (!mZipFile->ExtractFile(FileName, TextureFile)) if (!mZipFile->ExtractFile(FileName, TextureFile))
return false; return false;
@ -1264,7 +1265,7 @@ void lcLibraryMeshData::AddLine(int LineType, lcuint32 ColorCode, const lcVector
{ {
Section = mSections[SectionIdx]; Section = mSections[SectionIdx];
if (Section->mColor == ColorCode && Section->mPrimitiveType == PrimitiveType) if (Section->mColor == ColorCode && Section->mPrimitiveType == PrimitiveType && Section->mTexture == NULL)
break; break;
} }
@ -1337,7 +1338,7 @@ void lcLibraryMeshData::AddTexturedLine(int LineType, lcuint32 ColorCode, const
{ {
Section = mSections[SectionIdx]; Section = mSections[SectionIdx];
if (Section->mColor == ColorCode && Section->mPrimitiveType == PrimitiveType) if (Section->mColor == ColorCode && Section->mPrimitiveType == PrimitiveType && Section->mTexture == Map.Texture)
break; break;
} }