From 8e343db0fab3309578e7e196b53c50e197abb9aa Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 Feb 2015 17:47:10 +0100 Subject: [PATCH 1/4] Fixed: Warning comparing an enum to an int --- code/ryzom/client/src/interface_v3/character_3d.cpp | 2 +- code/ryzom/common/src/game_share/people_pd.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/character_3d.cpp b/code/ryzom/client/src/interface_v3/character_3d.cpp index c76407f11..f711fb764 100644 --- a/code/ryzom/client/src/interface_v3/character_3d.cpp +++ b/code/ryzom/client/src/interface_v3/character_3d.cpp @@ -797,7 +797,7 @@ void CCharacter3D::setup (const SCharacter3DSetup &c3ds) } // Instance skin color - if (c3ds.People != -1) + if (c3ds.People != EGSPD::CPeople::Undefined) if ((c3ds.People != _CurrentSetup.People) || bInstanceRebuilt || bQualityRebuilt) { if (!_Instances[i].empty()) diff --git a/code/ryzom/common/src/game_share/people_pd.h b/code/ryzom/common/src/game_share/people_pd.h index 379a09378..ffcf8732f 100644 --- a/code/ryzom/common/src/game_share/people_pd.h +++ b/code/ryzom/common/src/game_share/people_pd.h @@ -51,6 +51,7 @@ public: enum TPeople { + Undefined = -1, Humanoid = 0, Playable = 0, Fyros = 0, From da7b88f052b0003ad61adf19c6b228d56b8e1938 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 Feb 2015 17:47:55 +0100 Subject: [PATCH 2/4] Fixed: Warning assert always false --- code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp | 2 +- code/ryzom/common/src/game_share/brick_types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 293582f52..6aa1f0e40 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -456,7 +456,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr else { // must not have so much brick type, else must change code! - nlassert(brickType<32); + // nlassert(brickType<32); // Ok set the bit associated _BrickTypeBitField|= 1< Date: Sat, 14 Feb 2015 17:52:15 +0100 Subject: [PATCH 3/4] Fixed: Unnamed semaphores are deprecated under OS X --- code/nel/include/nel/misc/mutex.h | 12 +++++++++--- code/nel/src/misc/mutex.cpp | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/code/nel/include/nel/misc/mutex.h b/code/nel/include/nel/misc/mutex.h index adbc7e7e5..cb7e9a188 100644 --- a/code/nel/include/nel/misc/mutex.h +++ b/code/nel/include/nel/misc/mutex.h @@ -28,7 +28,11 @@ # endif #elif defined(NL_OS_UNIX) # include // PThread -# include // PThread POSIX semaphores +# ifdef NL_OS_MAC +# include +# else +# include // PThread POSIX semaphores +# endif # include # define __forceinline # ifdef NL_OS_MAC @@ -532,8 +536,10 @@ private: #ifdef NL_OS_WINDOWS TNelRtlCriticalSection _Cs; -#elif defined NL_OS_UNIX - sem_t _Sem; +#elif defined(NL_OS_MAC) + dispatch_semaphore_t _Sem; +#elif defined(NL_OS_UNIX) + sem_t _Sem; #else # error "No fair mutex implementation for this OS" #endif diff --git a/code/nel/src/misc/mutex.cpp b/code/nel/src/misc/mutex.cpp index 3c86e2b29..28f6bae37 100644 --- a/code/nel/src/misc/mutex.cpp +++ b/code/nel/src/misc/mutex.cpp @@ -406,13 +406,21 @@ void CUnfairMutex::leave() */ CFairMutex::CFairMutex() { +#ifdef NL_OS_MAC + _Sem = dispatch_semaphore_create(1); +#else sem_init( const_cast(&_Sem), 0, 1 ); +#endif } CFairMutex::CFairMutex( const std::string &name ) { +#ifdef NL_OS_MAC + _Sem = dispatch_semaphore_create(1); +#else sem_init( const_cast(&_Sem), 0, 1 ); +#endif } @@ -421,7 +429,11 @@ CFairMutex::CFairMutex( const std::string &name ) */ CFairMutex::~CFairMutex() { +#ifdef NL_OS_MAC + dispatch_release(_Sem); +#else sem_destroy( const_cast(&_Sem) ); // needs that no thread is waiting on the semaphore +#endif } @@ -430,7 +442,11 @@ CFairMutex::~CFairMutex() */ void CFairMutex::enter() { +#ifdef NL_OS_MAC + dispatch_semaphore_wait(_Sem, DISPATCH_TIME_FOREVER); +#else sem_wait( const_cast(&_Sem) ); +#endif } @@ -439,7 +455,11 @@ void CFairMutex::enter() */ void CFairMutex::leave() { +#ifdef NL_OS_MAC + dispatch_semaphore_signal(_Sem); +#else sem_post( const_cast(&_Sem) ); +#endif } From f07c2f51b8e65e784f923d39e04c6b2d8fc31064 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 Feb 2015 17:54:05 +0100 Subject: [PATCH 4/4] Fixed: Warning multichars --- code/ryzom/client/src/hair_set.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/code/ryzom/client/src/hair_set.cpp b/code/ryzom/client/src/hair_set.cpp index d82733162..5d44e2857 100644 --- a/code/ryzom/client/src/hair_set.cpp +++ b/code/ryzom/client/src/hair_set.cpp @@ -45,20 +45,20 @@ void CHairSet::init (NLMISC::IProgressCallback &progress) progress.progress ((float)k/(float)numHairItem); const CItemSheet *item = SheetMngr.getItem(SLOTTYPE::HEAD_SLOT, k); - if( (item) && (!item->getShape().empty()) ) + if (item && !item->getShape().empty()) { - std::string itemName = NLMISC::toLower(item->getShape()); - if (item->getShape().find("cheveux", 0) != std::string::npos) { // get race - uint16 race = (uint16) itemName[1] | ((uint16) itemName[0] << 8); - switch(race) + std::string itemName = NLMISC::toLower(item->getShape()); + + // fortunately, first character of each race is distinct + switch(itemName[0]) { - case 'ma': _Hairs[Matis].push_back(k); break; - case 'tr': _Hairs[Tryker].push_back(k); break; - case 'zo': _Hairs[Zorai].push_back(k); break; - case 'fy': _Hairs[Fyros].push_back(k); break; + case 'm': _Hairs[Matis].push_back(k); break; + case 't': _Hairs[Tryker].push_back(k); break; + case 'z': _Hairs[Zorai].push_back(k); break; + case 'f': _Hairs[Fyros].push_back(k); break; } } }