From e86a99c5f485f8cbc5e17b02dcc1f4f47250a095 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 29 Nov 2012 04:51:51 +0000 Subject: [PATCH] Updated library version check. --- common/lc_application.cpp | 3 +++ common/lc_library.cpp | 2 ++ common/lc_library.h | 1 + win/Leocad.cpp | 16 ++++++++++------ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/common/lc_application.cpp b/common/lc_application.cpp index 613fb0a3..2b85409d 100644 --- a/common/lc_application.cpp +++ b/common/lc_application.cpp @@ -88,7 +88,10 @@ bool lcApplication::LoadPiecesLibrary(const char* LibPath, const char* LibraryIn strcat(LibraryPath, "library.bin"); if (m_Library->Load(LibraryPath, LibraryCachePath)) + { + m_Library->mNumOfficialPieces = m_Library->mPieces.GetSize(); return true; + } } } } diff --git a/common/lc_library.cpp b/common/lc_library.cpp index 5cc96ff1..c24821a8 100644 --- a/common/lc_library.cpp +++ b/common/lc_library.cpp @@ -15,6 +15,7 @@ lcPiecesLibrary::lcPiecesLibrary() { + mNumOfficialPieces = 0; mZipFile = NULL; mCacheFile = NULL; mSaveCache = false; @@ -41,6 +42,7 @@ void lcPiecesLibrary::Unload() delete mTextures[TextureIdx]; mTextures.RemoveAll(); + mNumOfficialPieces = 0; delete mZipFile; mZipFile = NULL; } diff --git a/common/lc_library.h b/common/lc_library.h index ae4fd922..47b6601d 100644 --- a/common/lc_library.h +++ b/common/lc_library.h @@ -137,6 +137,7 @@ public: PtrArray mPieces; PtrArray mPrimitives; ObjArray mCategories; + int mNumOfficialPieces; PtrArray mTextures; diff --git a/win/Leocad.cpp b/win/Leocad.cpp index 65d019d8..3bb35d92 100644 --- a/win/Leocad.cpp +++ b/win/Leocad.cpp @@ -10,7 +10,7 @@ #include "project.h" #include "globals.h" #include "system.h" -#include "pieceinf.h" // TODO: remove +#include "pieceinf.h" #include "mainwnd.h" #include "lc_library.h" #include "keyboard.h" @@ -97,13 +97,17 @@ static void CheckForUpdates(void* Data) else 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"; - Update = true; + if (lib > Library->mNumOfficialPieces) + { + 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) {