@@ -402,50 +402,55 @@ int CLuaHandlingDefs::GetVehicleHandling(lua_State* luaVM)
402402 SString strProperty;
403403 argStream.ReadString (strProperty);
404404
405+ bool bResult = true ;
405406 eHandlingProperty eProperty = m_pHandlingManager->GetPropertyEnumFromName (strProperty);
406- if (eProperty = = HANDLING_MAX)
407+ if (eProperty ! = HANDLING_MAX)
407408 {
408- argStream.SetCustomError (" Invalid property" );
409- m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
410- lua_pushboolean (luaVM, false );
411- return 1 ;
412- }
413-
414- float fValue = 0 .0f ;
415- CVector vecValue = CVector (0 .0f , 0 .0f , 0 .0f );
416- SString strValue = " " ;
417- unsigned int uiValue = 0 ;
418- unsigned char ucValue = 0 ;
419- if (CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, fValue ))
420- {
421- lua_pushnumber (luaVM, fValue );
422- }
423- else if (CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, uiValue))
424- {
425- lua_pushnumber (luaVM, uiValue);
426- }
427- else if (CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, ucValue))
428- {
429- lua_pushnumber (luaVM, ucValue);
430- }
431- else if (CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, strValue))
432- {
433- lua_pushstring (luaVM, strValue);
409+ float fValue = 0 .0f ;
410+ CVector vecValue = CVector (0 .0f , 0 .0f , 0 .0f );
411+ SString strValue = " " ;
412+ unsigned int uiValue = 0 ;
413+ unsigned char ucValue = 0 ;
414+ if (CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, fValue ))
415+ {
416+ lua_pushnumber (luaVM, fValue );
417+ }
418+ else if (CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, uiValue))
419+ {
420+ lua_pushnumber (luaVM, uiValue);
421+ }
422+ else if (CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, ucValue))
423+ {
424+ lua_pushnumber (luaVM, ucValue);
425+ }
426+ else if (CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, strValue))
427+ {
428+ lua_pushstring (luaVM, strValue);
429+ }
430+ else if (CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, vecValue))
431+ {
432+ lua_createtable (luaVM, 3 , 0 );
433+ lua_pushnumber (luaVM, 1 );
434+ lua_pushnumber (luaVM, vecValue.fX );
435+ lua_settable (luaVM, -3 );
436+ lua_pushnumber (luaVM, 2 );
437+ lua_pushnumber (luaVM, vecValue.fY );
438+ lua_settable (luaVM, -3 );
439+ lua_pushnumber (luaVM, 3 );
440+ lua_pushnumber (luaVM, vecValue.fZ );
441+ lua_settable (luaVM, -3 );
442+ }
443+ else
444+ {
445+ bResult = false ;
446+ }
434447 }
435- else if ( CStaticFunctionDefinitions::GetVehicleHandling (pVehicle, eProperty, vecValue))
448+ else
436449 {
437- lua_createtable (luaVM, 3 , 0 );
438- lua_pushnumber (luaVM, 1 );
439- lua_pushnumber (luaVM, vecValue.fX );
440- lua_settable (luaVM, -3 );
441- lua_pushnumber (luaVM, 2 );
442- lua_pushnumber (luaVM, vecValue.fY );
443- lua_settable (luaVM, -3 );
444- lua_pushnumber (luaVM, 3 );
445- lua_pushnumber (luaVM, vecValue.fZ );
446- lua_settable (luaVM, -3 );
450+ bResult = false ;
447451 }
448- else
452+
453+ if (!bResult)
449454 {
450455 argStream.SetCustomError (" Invalid property" );
451456 m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
0 commit comments