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 } 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; } } } 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/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 91bb94a23..fe7f20e1f 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<