summaryrefslogtreecommitdiffstats
path: root/src/script/script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/script.cpp')
-rw-r--r--src/script/script.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/script/script.cpp b/src/script/script.cpp
index f59d27e..578c07d 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -2865,7 +2865,6 @@ bool CScript::rShield(CBotVar* var, CBotVar* result, int& exception, void* user)
CBotTypResult CScript::cFire(CBotVar* &var, void* user)
{
-#if 0
CObject* pThis = static_cast<CObject *>(user);
ObjectType type;
@@ -2873,23 +2872,25 @@ CBotTypResult CScript::cFire(CBotVar* &var, void* user)
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 )
{
- return cNull(var, user);
+ if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
}
else
{
- if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GetNext();
- if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
- return CBotTypResult(CBotTypFloat);
+ if ( var != 0 )
+ {
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
+ if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
+ }
}
-#else
return CBotTypResult(CBotTypFloat);
-#endif
}
// Instruction "fire(delay)".
@@ -2925,6 +2926,7 @@ bool CScript::rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
{
if ( var == 0 ) delay = 0.0f;
else delay = var->GetValFloat();
+ if ( delay < 0.0f ) delay = -delay;
err = script->m_primaryTask->StartTaskFire(delay);
}