mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-20 07:58:44 +00:00
Merge with hotfix
--HG-- branch : develop
This commit is contained in:
commit
6784301afc
7 changed files with 42 additions and 15 deletions
|
@ -28,7 +28,11 @@
|
||||||
# endif
|
# endif
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
# include <pthread.h> // PThread
|
# include <pthread.h> // PThread
|
||||||
|
# ifdef NL_OS_MAC
|
||||||
|
# include <dispatch/dispatch.h>
|
||||||
|
# else
|
||||||
# include <semaphore.h> // PThread POSIX semaphores
|
# include <semaphore.h> // PThread POSIX semaphores
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# define __forceinline
|
# define __forceinline
|
||||||
# ifdef NL_OS_MAC
|
# ifdef NL_OS_MAC
|
||||||
|
@ -532,7 +536,9 @@ private:
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
TNelRtlCriticalSection _Cs;
|
TNelRtlCriticalSection _Cs;
|
||||||
#elif defined NL_OS_UNIX
|
#elif defined(NL_OS_MAC)
|
||||||
|
dispatch_semaphore_t _Sem;
|
||||||
|
#elif defined(NL_OS_UNIX)
|
||||||
sem_t _Sem;
|
sem_t _Sem;
|
||||||
#else
|
#else
|
||||||
# error "No fair mutex implementation for this OS"
|
# error "No fair mutex implementation for this OS"
|
||||||
|
|
|
@ -406,13 +406,21 @@ void CUnfairMutex::leave()
|
||||||
*/
|
*/
|
||||||
CFairMutex::CFairMutex()
|
CFairMutex::CFairMutex()
|
||||||
{
|
{
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
_Sem = dispatch_semaphore_create(1);
|
||||||
|
#else
|
||||||
sem_init( const_cast<sem_t*>(&_Sem), 0, 1 );
|
sem_init( const_cast<sem_t*>(&_Sem), 0, 1 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CFairMutex::CFairMutex( const std::string &name )
|
CFairMutex::CFairMutex( const std::string &name )
|
||||||
{
|
{
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
_Sem = dispatch_semaphore_create(1);
|
||||||
|
#else
|
||||||
sem_init( const_cast<sem_t*>(&_Sem), 0, 1 );
|
sem_init( const_cast<sem_t*>(&_Sem), 0, 1 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -421,7 +429,11 @@ CFairMutex::CFairMutex( const std::string &name )
|
||||||
*/
|
*/
|
||||||
CFairMutex::~CFairMutex()
|
CFairMutex::~CFairMutex()
|
||||||
{
|
{
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
dispatch_release(_Sem);
|
||||||
|
#else
|
||||||
sem_destroy( const_cast<sem_t*>(&_Sem) ); // needs that no thread is waiting on the semaphore
|
sem_destroy( const_cast<sem_t*>(&_Sem) ); // needs that no thread is waiting on the semaphore
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,7 +442,11 @@ CFairMutex::~CFairMutex()
|
||||||
*/
|
*/
|
||||||
void CFairMutex::enter()
|
void CFairMutex::enter()
|
||||||
{
|
{
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
dispatch_semaphore_wait(_Sem, DISPATCH_TIME_FOREVER);
|
||||||
|
#else
|
||||||
sem_wait( const_cast<sem_t*>(&_Sem) );
|
sem_wait( const_cast<sem_t*>(&_Sem) );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -439,7 +455,11 @@ void CFairMutex::enter()
|
||||||
*/
|
*/
|
||||||
void CFairMutex::leave()
|
void CFairMutex::leave()
|
||||||
{
|
{
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
dispatch_semaphore_signal(_Sem);
|
||||||
|
#else
|
||||||
sem_post( const_cast<sem_t*>(&_Sem) );
|
sem_post( const_cast<sem_t*>(&_Sem) );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,20 +45,20 @@ void CHairSet::init (NLMISC::IProgressCallback &progress)
|
||||||
progress.progress ((float)k/(float)numHairItem);
|
progress.progress ((float)k/(float)numHairItem);
|
||||||
|
|
||||||
const CItemSheet *item = SheetMngr.getItem(SLOTTYPE::HEAD_SLOT, k);
|
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)
|
if (item->getShape().find("cheveux", 0) != std::string::npos)
|
||||||
{
|
{
|
||||||
// get race
|
// get race
|
||||||
uint16 race = (uint16) itemName[1] | ((uint16) itemName[0] << 8);
|
std::string itemName = NLMISC::toLower(item->getShape());
|
||||||
switch(race)
|
|
||||||
|
// fortunately, first character of each race is distinct
|
||||||
|
switch(itemName[0])
|
||||||
{
|
{
|
||||||
case 'ma': _Hairs[Matis].push_back(k); break;
|
case 'm': _Hairs[Matis].push_back(k); break;
|
||||||
case 'tr': _Hairs[Tryker].push_back(k); break;
|
case 't': _Hairs[Tryker].push_back(k); break;
|
||||||
case 'zo': _Hairs[Zorai].push_back(k); break;
|
case 'z': _Hairs[Zorai].push_back(k); break;
|
||||||
case 'fy': _Hairs[Fyros].push_back(k); break;
|
case 'f': _Hairs[Fyros].push_back(k); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -797,7 +797,7 @@ void CCharacter3D::setup (const SCharacter3DSetup &c3ds)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instance skin color
|
// Instance skin color
|
||||||
if (c3ds.People != -1)
|
if (c3ds.People != EGSPD::CPeople::Undefined)
|
||||||
if ((c3ds.People != _CurrentSetup.People) || bInstanceRebuilt || bQualityRebuilt)
|
if ((c3ds.People != _CurrentSetup.People) || bInstanceRebuilt || bQualityRebuilt)
|
||||||
{
|
{
|
||||||
if (!_Instances[i].empty())
|
if (!_Instances[i].empty())
|
||||||
|
|
|
@ -456,7 +456,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// must not have so much brick type, else must change code!
|
// must not have so much brick type, else must change code!
|
||||||
nlassert(brickType<32);
|
// nlassert(brickType<32);
|
||||||
|
|
||||||
// Ok set the bit associated
|
// Ok set the bit associated
|
||||||
_BrickTypeBitField|= 1<<brickType;
|
_BrickTypeBitField|= 1<<brickType;
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace BRICK_TYPE
|
||||||
TIMED_ACTION,
|
TIMED_ACTION,
|
||||||
BRICK_TYPE_COUNT,
|
BRICK_TYPE_COUNT,
|
||||||
BONUS,
|
BONUS,
|
||||||
UNKNOWN
|
UNKNOWN // Warning: Shouldn't exceed 32
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
|
|
||||||
enum TPeople
|
enum TPeople
|
||||||
{
|
{
|
||||||
|
Undefined = -1,
|
||||||
Humanoid = 0,
|
Humanoid = 0,
|
||||||
Playable = 0,
|
Playable = 0,
|
||||||
Fyros = 0,
|
Fyros = 0,
|
||||||
|
|
Loading…
Reference in a new issue