Updated library version check.

This commit is contained in:
leo 2012-11-29 04:51:51 +00:00
parent c0584938a7
commit e86a99c5f4
4 changed files with 16 additions and 6 deletions

View file

@ -88,7 +88,10 @@ bool lcApplication::LoadPiecesLibrary(const char* LibPath, const char* LibraryIn
strcat(LibraryPath, "library.bin"); strcat(LibraryPath, "library.bin");
if (m_Library->Load(LibraryPath, LibraryCachePath)) if (m_Library->Load(LibraryPath, LibraryCachePath))
{
m_Library->mNumOfficialPieces = m_Library->mPieces.GetSize();
return true; return true;
}
} }
} }
} }

View file

@ -15,6 +15,7 @@
lcPiecesLibrary::lcPiecesLibrary() lcPiecesLibrary::lcPiecesLibrary()
{ {
mNumOfficialPieces = 0;
mZipFile = NULL; mZipFile = NULL;
mCacheFile = NULL; mCacheFile = NULL;
mSaveCache = false; mSaveCache = false;
@ -41,6 +42,7 @@ void lcPiecesLibrary::Unload()
delete mTextures[TextureIdx]; delete mTextures[TextureIdx];
mTextures.RemoveAll(); mTextures.RemoveAll();
mNumOfficialPieces = 0;
delete mZipFile; delete mZipFile;
mZipFile = NULL; mZipFile = NULL;
} }

View file

@ -137,6 +137,7 @@ public:
PtrArray<PieceInfo> mPieces; PtrArray<PieceInfo> mPieces;
PtrArray<lcLibraryPrimitive> mPrimitives; PtrArray<lcLibraryPrimitive> mPrimitives;
ObjArray<lcLibraryCategory> mCategories; ObjArray<lcLibraryCategory> mCategories;
int mNumOfficialPieces;
PtrArray<lcTexture> mTextures; PtrArray<lcTexture> mTextures;

View file

@ -10,7 +10,7 @@
#include "project.h" #include "project.h"
#include "globals.h" #include "globals.h"
#include "system.h" #include "system.h"
#include "pieceinf.h" // TODO: remove #include "pieceinf.h"
#include "mainwnd.h" #include "mainwnd.h"
#include "lc_library.h" #include "lc_library.h"
#include "keyboard.h" #include "keyboard.h"
@ -97,13 +97,17 @@ static void CheckForUpdates(void* Data)
else else
str = "You are using the latest version of LeoCAD.\n"; str = "You are using the latest version of LeoCAD.\n";
if (lib > lcGetPiecesLibrary()->mPieces.GetSize()) lcPiecesLibrary* Library = lcGetPiecesLibrary();
if (Library->mNumOfficialPieces)
{ {
str += "There are new pieces available.\n\n"; if (lib > Library->mNumOfficialPieces)
Update = true; {
str += "There are new pieces available.\n\n";
Update = true;
}
else
str += "There are no new pieces available at this time.\n";
} }
else
str += "There are no new pieces available at this time.\n";
if (Data || Update) if (Data || Update)
{ {