From 5467fd379f2b2606a7834b791d3b697bba102fa7 Mon Sep 17 00:00:00 2001 From: "wagic.jeck" Date: Mon, 14 Sep 2009 18:30:47 +0000 Subject: [PATCH] Jeck - Signed/unsigned fix in resource manager, options save fix. --- projects/mtg/include/WCachedResource.h | 6 ++++++ projects/mtg/include/WResourceManager.h | 2 +- projects/mtg/src/OptionItem.cpp | 3 ++- projects/mtg/src/WCachedResource.cpp | 2 +- projects/mtg/src/WResourceManager.cpp | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/projects/mtg/include/WCachedResource.h b/projects/mtg/include/WCachedResource.h index 6cf3e7880..6063f05c4 100644 --- a/projects/mtg/include/WCachedResource.h +++ b/projects/mtg/include/WCachedResource.h @@ -2,6 +2,12 @@ #define _WCACHEDRESOURCE_H_ #include +#if defined WIN32 || defined LINUX +#define INVALID_MTEX ((GLuint) -1) +#else +#define INVALID_MTEX -1 +#endif + class WResource{ public: friend class WResourceManager; diff --git a/projects/mtg/include/WResourceManager.h b/projects/mtg/include/WResourceManager.h index 4aec4f888..580d05f96 100644 --- a/projects/mtg/include/WResourceManager.h +++ b/projects/mtg/include/WResourceManager.h @@ -29,7 +29,7 @@ enum ENUM_RETRIEVE_STYLE{ RETRIEVE_VRAM, //Retrieve it, and use vram if have to we create it. Must still remove it. RETRIEVE_MANAGE, //Makes resource permanent. RETRIEVE_THUMB, //Retrieve it as a thumbnail. - CACHE_THUMB = RETRIEVE_THUMB, //Backwords compatibility. + CACHE_THUMB = RETRIEVE_THUMB, //Backwards compatibility. }; enum ENUM_CACHE_SUBTYPE{ diff --git a/projects/mtg/src/OptionItem.cpp b/projects/mtg/src/OptionItem.cpp index 97eba2b9a..79f4522e8 100644 --- a/projects/mtg/src/OptionItem.cpp +++ b/projects/mtg/src/OptionItem.cpp @@ -526,7 +526,6 @@ void OptionsList::save(){ for (int i = 0; i < nbitems; i++){ listItems[i]->setData(); } - ::options.save(); } void OptionsList::Update(float dt){ @@ -652,6 +651,8 @@ void OptionsMenu::save(){ for(int x=0;xsave(); + + ::options.save(); } bool OptionsMenu::isTab(string name){ diff --git a/projects/mtg/src/WCachedResource.cpp b/projects/mtg/src/WCachedResource.cpp index 8519fdfc4..d0f54aeb5 100644 --- a/projects/mtg/src/WCachedResource.cpp +++ b/projects/mtg/src/WCachedResource.cpp @@ -234,7 +234,7 @@ bool WCachedTexture::Attempt(string filename, int submode, int & error){ } //Failure of a different sort. - if(texture->mTexId == -1){ + if(texture->mTexId == INVALID_MTEX){ SAFE_DELETE(texture); error = CACHE_ERROR_BAD; return false; diff --git a/projects/mtg/src/WResourceManager.cpp b/projects/mtg/src/WResourceManager.cpp index f30cb9555..779f35ab1 100644 --- a/projects/mtg/src/WResourceManager.cpp +++ b/projects/mtg/src/WResourceManager.cpp @@ -417,7 +417,7 @@ JTexture* WResourceManager::GetTexture(int id){ for(it = textureWCache.managed.begin();it!= textureWCache.managed.end(); it++){ if(it->second){ jtex = it->second->Actual(); - if(jtex->mTexId == id) + if(id == (int) jtex->mTexId) return jtex; } }