Changed ActorFrame::SetUpdateRate to reject a negative rate instead of crashing.

This commit is contained in:
Kyzentun
2015-03-24 18:28:11 -06:00
parent f4da2988d9
commit 062b618bda
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -624,7 +624,16 @@ public:
}
static int propagate( T* p, lua_State *L ) { p->SetPropagateCommands( BIArg(1) ); COMMON_RETURN_SELF; }
static int fov( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); COMMON_RETURN_SELF; }
static int SetUpdateRate( T* p, lua_State *L ) { p->SetUpdateRate( FArg(1) ); COMMON_RETURN_SELF; }
static int SetUpdateRate( T* p, lua_State *L )
{
float rate= FArg(1);
if(rate <= 0)
{
luaL_error(L, "ActorFrame:SetUpdateRate(%f) Update rate must be greater than 0.", rate);
}
p->SetUpdateRate(rate);
COMMON_RETURN_SELF;
}
DEFINE_METHOD(GetUpdateRate, GetUpdateRate());
static int SetFOV( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); COMMON_RETURN_SELF; }
static int vanishpoint( T* p, lua_State *L ) { p->SetVanishPoint( FArg(1), FArg(2) ); COMMON_RETURN_SELF; }
+1 -1
View File
@@ -75,7 +75,7 @@ public:
virtual void FinishTweening();
virtual void HurryTweening( float factor );
void SetUpdateRate( float fUpdateRate ) { m_fUpdateRate = fUpdateRate; }
void SetUpdateRate(float rate) { if(rate > 0.0f) { m_fUpdateRate = rate; }}
float GetUpdateRate() { return m_fUpdateRate; }
void SetFOV( float fFOV ) { m_fFOV = fFOV; }
void SetVanishPoint( float fX, float fY) { m_fVanishX = fX; m_fVanishY = fY; }