From 68d9c28dc2ba33a88a7a7e5bed0fd4f930c6c717 Mon Sep 17 00:00:00 2001 From: leozide Date: Thu, 27 Jul 2017 16:09:38 -0700 Subject: [PATCH] Fixed loading primitives from loose files. --- common/lc_library.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/common/lc_library.cpp b/common/lc_library.cpp index c46efb66..ec5c6eb0 100644 --- a/common/lc_library.cpp +++ b/common/lc_library.cpp @@ -647,6 +647,7 @@ bool lcPiecesLibrary::OpenDirectory(const QDir& LibraryDir) Src++; Dst++; } + *Dst = 0; if (Dst - Name <= 4) continue; @@ -1602,10 +1603,6 @@ bool lcPiecesLibrary::LoadPrimitive(lcLibraryPrimitive* Primitive) } else { - char Name[LC_PIECE_NAME_LEN]; - strcpy(Name, Primitive->mName); - strlwr(Name); - char FileName[LC_MAXPATH]; lcDiskFile PrimFile; bool Found = false; @@ -1613,9 +1610,9 @@ bool lcPiecesLibrary::LoadPrimitive(lcLibraryPrimitive* Primitive) if (mHasUnofficial) { if (Primitive->mSubFile) - sprintf(FileName, "unofficial/parts/%s.dat", Name); + sprintf(FileName, "unofficial/parts/%s", Primitive->mName); else - sprintf(FileName, "unofficial/p/%s.dat", Name); + sprintf(FileName, "unofficial/p/%s", Primitive->mName); PrimFile.SetFileName(mLibraryDir.absoluteFilePath(QLatin1String(FileName))); Found = PrimFile.Open(QIODevice::ReadOnly); } @@ -1623,9 +1620,9 @@ bool lcPiecesLibrary::LoadPrimitive(lcLibraryPrimitive* Primitive) if (!Found) { if (Primitive->mSubFile) - sprintf(FileName, "parts/%s.dat", Name); + sprintf(FileName, "parts/%s", Primitive->mName); else - sprintf(FileName, "p/%s.dat", Name); + sprintf(FileName, "p/%s", Primitive->mName); PrimFile.SetFileName(mLibraryDir.absoluteFilePath(QLatin1String(FileName))); Found = PrimFile.Open(QIODevice::ReadOnly); }