mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Fix for ArrayObject sorting
- This is a fix for issue https://github.com/GarageGames/Torque3D/issues/228 - This fixes sortna() and sortnd() as outlined in the issue. - This also fixes sortnka() and sortnkd(), as well as the sorting method that take a console function as a parameter.
This commit is contained in:
parent
ef118b883b
commit
4717f22916
1 changed files with 4 additions and 4 deletions
|
|
@ -76,7 +76,7 @@ S32 QSORT_CALLBACK ArrayObject::_valueNumCompare( const void* a, const void* b )
|
|||
F32 bCol = dAtof(eb->value);
|
||||
F32 result = aCol - bCol;
|
||||
S32 res = result < 0 ? -1 : (result > 0 ? 1 : 0);
|
||||
return ( smDecreasing ? res : -res );
|
||||
return ( smDecreasing ? -res : res );
|
||||
}
|
||||
|
||||
S32 QSORT_CALLBACK ArrayObject::_keyCompare( const void* a, const void* b )
|
||||
|
|
@ -95,7 +95,7 @@ S32 QSORT_CALLBACK ArrayObject::_keyNumCompare( const void* a, const void* b )
|
|||
const char* bCol = eb->key;
|
||||
F32 result = dAtof(aCol) - dAtof(bCol);
|
||||
S32 res = result < 0 ? -1 : (result > 0 ? 1 : 0);
|
||||
return ( smDecreasing ? res : -res );
|
||||
return ( smDecreasing ? -res : res );
|
||||
}
|
||||
|
||||
S32 QSORT_CALLBACK ArrayObject::_keyFunctionCompare( const void* a, const void* b )
|
||||
|
|
@ -110,7 +110,7 @@ S32 QSORT_CALLBACK ArrayObject::_keyFunctionCompare( const void* a, const void*
|
|||
|
||||
S32 result = dAtoi( Con::execute( 3, argv ) );
|
||||
S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 );
|
||||
return ( smDecreasing ? res : -res );
|
||||
return ( smDecreasing ? -res : res );
|
||||
}
|
||||
|
||||
S32 QSORT_CALLBACK ArrayObject::_valueFunctionCompare( const void* a, const void* b )
|
||||
|
|
@ -125,7 +125,7 @@ S32 QSORT_CALLBACK ArrayObject::_valueFunctionCompare( const void* a, const void
|
|||
|
||||
S32 result = dAtoi( Con::execute( 3, argv ) );
|
||||
S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 );
|
||||
return ( smDecreasing ? res : -res );
|
||||
return ( smDecreasing ? -res : res );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue