Fixed negative parameter in fire() (issue #305)
Also fixed checking parameter count and type for ants, spiders and shootersdev-mp
parent
2b9abf2a48
commit
bc3b7ef283
|
@ -2862,7 +2862,6 @@ bool CScript::rShield(CBotVar* var, CBotVar* result, int& exception, void* user)
|
||||||
|
|
||||||
CBotTypResult CScript::cFire(CBotVar* &var, void* user)
|
CBotTypResult CScript::cFire(CBotVar* &var, void* user)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
CObject* pThis = static_cast<CObject *>(user);
|
CObject* pThis = static_cast<CObject *>(user);
|
||||||
ObjectType type;
|
ObjectType type;
|
||||||
|
|
||||||
|
@ -2870,23 +2869,25 @@ CBotTypResult CScript::cFire(CBotVar* &var, void* user)
|
||||||
|
|
||||||
if ( type == OBJECT_ANT )
|
if ( type == OBJECT_ANT )
|
||||||
{
|
{
|
||||||
return cOnePoint(var, user);
|
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
|
||||||
|
CBotTypResult ret = cPoint(var, user);
|
||||||
|
if ( ret.GetType() != 0 ) return ret;
|
||||||
|
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
|
||||||
}
|
}
|
||||||
else if ( type == OBJECT_SPIDER )
|
else if ( type == OBJECT_SPIDER )
|
||||||
{
|
{
|
||||||
return cNull(var, user);
|
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
|
if ( var != 0 )
|
||||||
|
{
|
||||||
if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
|
if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
|
||||||
var = var->GetNext();
|
var = var->GetNext();
|
||||||
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
|
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
|
||||||
return CBotTypResult(CBotTypFloat);
|
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
return CBotTypResult(CBotTypFloat);
|
return CBotTypResult(CBotTypFloat);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instruction "fire(delay)".
|
// Instruction "fire(delay)".
|
||||||
|
@ -2922,6 +2923,7 @@ bool CScript::rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
|
||||||
{
|
{
|
||||||
if ( var == 0 ) delay = 0.0f;
|
if ( var == 0 ) delay = 0.0f;
|
||||||
else delay = var->GetValFloat();
|
else delay = var->GetValFloat();
|
||||||
|
if ( delay < 0.0f ) delay = -delay;
|
||||||
err = script->m_primaryTask->StartTaskFire(delay);
|
err = script->m_primaryTask->StartTaskFire(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue