Skip to content

Commit

Permalink
Improve error messages for setCameraFieldOfView
Browse files Browse the repository at this point in the history
  • Loading branch information
qaisjp committed Dec 4, 2015
1 parent 3491c37 commit 71fb329
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,30 +172,33 @@ int CLuaFunctionDefs::SetCameraFieldOfView ( lua_State* luaVM )

argStream.ReadEnumString ( eMode );
argStream.ReadNumber ( fFOV );

if ( fFOV < 0 || fFOV > 179 )
argStream.SetCustomError ( "Outside 0-179 boundaries" );


if ( !argStream.HasErrors () )
{
if (eMode == FOV_MODE_PLAYER)
g_pGame->GetSettings ()->SetFieldOfViewPlayer ( fFOV );
else if ( eMode == FOV_MODE_VEHICLE )
g_pGame->GetSettings ()->SetFieldOfViewVehicle ( fFOV );
else if ( eMode == FOV_MODE_VEHICLE_MAX )
g_pGame->GetSettings ()->SetFieldOfViewVehicleMax ( fFOV );
else {
argStream.m_iIndex = 1;
m_pScriptDebugging->LogCustom ( luaVM, SString("Enum not yet implemented: " + EnumToString ( eMode )) );
lua_pushboolean ( luaVM, false );
while (true) {
if ( fFOV < 0 || fFOV > 179 ) {
argStream.SetCustomError ( "FOV is outside the 0-179 boundary" );
break;
}

if (eMode == FOV_MODE_PLAYER)
g_pGame->GetSettings ()->SetFieldOfViewPlayer ( fFOV );
else if ( eMode == FOV_MODE_VEHICLE )
g_pGame->GetSettings ()->SetFieldOfViewVehicle ( fFOV );
else if ( eMode == FOV_MODE_VEHICLE_MAX )
g_pGame->GetSettings ()->SetFieldOfViewVehicleMax ( fFOV );
else {
argStream.m_iIndex = 1;
argStream.SetCustomError( SString( "Enum not yet implemented: " + EnumToString ( eMode ) ) );
break;
}

lua_pushboolean ( luaVM, true );
return 1;
}
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
Expand Down

0 comments on commit 71fb329

Please sign in to comment.