Fix specific usage of Con::executef where it was not being assigned to a ConsoleValue before getting it's data out of it.

This commit is contained in:
Jeff Hutchinson 2021-09-24 19:32:57 -04:00
parent 0f89373782
commit 755bbacaa0
13 changed files with 35 additions and 21 deletions

View file

@ -103,7 +103,8 @@ S32 QSORT_CALLBACK ArrayObject::_keyFunctionCompare( const void* a, const void*
ArrayObject::Element* ea = ( ArrayObject::Element* )( a );
ArrayObject::Element* eb = ( ArrayObject::Element* )( b );
S32 result = dAtoi(Con::executef((const char*)smCompareFunction, ea->key, eb->key));
ConsoleValue cValue = Con::executef((const char*)smCompareFunction, ea->key, eb->key);
S32 result = cValue.getInt();
S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 );
return ( smDecreasing ? -res : res );
}
@ -113,7 +114,8 @@ S32 QSORT_CALLBACK ArrayObject::_valueFunctionCompare( const void* a, const void
ArrayObject::Element* ea = ( ArrayObject::Element* )( a );
ArrayObject::Element* eb = ( ArrayObject::Element* )( b );
S32 result = dAtoi( Con::executef( (const char*)smCompareFunction, ea->value, eb->value ) );
ConsoleValue cValue = Con::executef( (const char*)smCompareFunction, ea->value, eb->value );
S32 result = cValue.getInt();
S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 );
return ( smDecreasing ? -res : res );
}

View file

@ -118,7 +118,8 @@ S32 QSORT_CALLBACK SimObjectList::_callbackSort( const void *a, const void *b )
static char idB[64];
dSprintf( idB, sizeof( idB ), "%d", objB->getId() );
return dAtoi( Con::executef( (const char*)smSortScriptCallbackFn, idA, idB ) );
ConsoleValue cValue = Con::executef( (const char*)smSortScriptCallbackFn, idA, idB );
return cValue.getInt();
}
void SimObjectList::scriptSort( const String &scriptCallback )