Removed Get/SetInfoReturn
parent
303dd17d58
commit
ad84478c71
|
@ -64,7 +64,7 @@ public:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! Destroy the object immediately. Use this only if you are 100% sure this is what you want, because object with magnifyDamage=0 should be able to bypass all damage. It's recommended to use CDamageableObject::DamageObject() instead.
|
//! Destroy the object immediately. Use this only if you are 100% sure this is what you want, because object with magnifyDamage=0 should be able to bypass all damage. It's recommended to use CDamageableObject::DamageObject() instead.
|
||||||
/* NOTE: After this function exits, you can assume the object has been definetly destroyed */
|
/** NOTE: After this function exits, you can assume the object has been definetly destroyed */
|
||||||
virtual void DestroyObject(DestructionType type) = 0;
|
virtual void DestroyObject(DestructionType type) = 0;
|
||||||
|
|
||||||
//! Returns the distance modifier for CLightning, used to modify hit probability. Value in range [0..1], where 0 is never and 1 is normal probability
|
//! Returns the distance modifier for CLightning, used to modify hit probability. Value in range [0..1], where 0 is never and 1 is normal probability
|
||||||
|
|
|
@ -148,7 +148,6 @@ COldObject::COldObject(int id)
|
||||||
m_shieldRadius = 0.0f;
|
m_shieldRadius = 0.0f;
|
||||||
m_magnifyDamage = 1.0f;
|
m_magnifyDamage = 1.0f;
|
||||||
m_param = 0.0f;
|
m_param = 0.0f;
|
||||||
m_infoReturn = NAN;
|
|
||||||
|
|
||||||
m_character = Character();
|
m_character = Character();
|
||||||
m_character.wheelFront = 1.0f;
|
m_character.wheelFront = 1.0f;
|
||||||
|
@ -1632,16 +1631,6 @@ void COldObject::SetTransporterPart(int part)
|
||||||
m_transporterLink = part;
|
m_transporterLink = part;
|
||||||
}
|
}
|
||||||
|
|
||||||
void COldObject::SetInfoReturn(float value)
|
|
||||||
{
|
|
||||||
m_infoReturn = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
float COldObject::GetInfoReturn()
|
|
||||||
{
|
|
||||||
return m_infoReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Returns matrices of an object portion.
|
// Returns matrices of an object portion.
|
||||||
|
|
||||||
|
|
|
@ -271,9 +271,6 @@ public:
|
||||||
|
|
||||||
void FlatParent() override;
|
void FlatParent() override;
|
||||||
|
|
||||||
void SetInfoReturn(float value);
|
|
||||||
float GetInfoReturn() override;
|
|
||||||
|
|
||||||
void SetPosition(const Math::Vector& pos) override;
|
void SetPosition(const Math::Vector& pos) override;
|
||||||
Math::Vector GetPosition() const override;
|
Math::Vector GetPosition() const override;
|
||||||
|
|
||||||
|
@ -380,8 +377,6 @@ protected:
|
||||||
|
|
||||||
int m_partiSel[4];
|
int m_partiSel[4];
|
||||||
|
|
||||||
float m_infoReturn;
|
|
||||||
|
|
||||||
EventType m_buttonAxe;
|
EventType m_buttonAxe;
|
||||||
|
|
||||||
float m_time;
|
float m_time;
|
||||||
|
|
|
@ -145,8 +145,3 @@ void COldObjectInterface::FlatParent()
|
||||||
{
|
{
|
||||||
throw std::logic_error("FlatParent: not implemented!");
|
throw std::logic_error("FlatParent: not implemented!");
|
||||||
}
|
}
|
||||||
|
|
||||||
float COldObjectInterface::GetInfoReturn()
|
|
||||||
{
|
|
||||||
throw std::logic_error("GetInfoReturn: not implemented!");
|
|
||||||
}
|
|
||||||
|
|
|
@ -104,7 +104,4 @@ public:
|
||||||
|
|
||||||
// This will be eventually removed after refactoring to subclasses
|
// This will be eventually removed after refactoring to subclasses
|
||||||
virtual CAuto* GetAuto();
|
virtual CAuto* GetAuto();
|
||||||
|
|
||||||
// CProgrammableObject or refactor
|
|
||||||
virtual float GetInfoReturn();
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -69,7 +69,6 @@ bool CTaskInfo::EventProcess(const Event &event)
|
||||||
Error CTaskInfo::Start(const char *name, float value, float power, bool send)
|
Error CTaskInfo::Start(const char *name, float value, float power, bool send)
|
||||||
{
|
{
|
||||||
m_error = true;
|
m_error = true;
|
||||||
m_object->SetInfoReturn(NAN);
|
|
||||||
|
|
||||||
CExchangePost* exchangePost = FindExchangePost(power);
|
CExchangePost* exchangePost = FindExchangePost(power);
|
||||||
if (exchangePost == nullptr)
|
if (exchangePost == nullptr)
|
||||||
|
@ -88,10 +87,8 @@ Error CTaskInfo::Start(const char *name, float value, float power, bool send)
|
||||||
}
|
}
|
||||||
else // receive?
|
else // receive?
|
||||||
{
|
{
|
||||||
auto infoValue = exchangePost->GetInfoValue(name);
|
if (exchangePost->HasInfo(name))
|
||||||
if (infoValue != boost::none)
|
|
||||||
{
|
{
|
||||||
m_object->SetInfoReturn(*infoValue);
|
|
||||||
op = 0; // beginning of transmission (for terminal)
|
op = 0; // beginning of transmission (for terminal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ public:
|
||||||
Error IsEnded() override;
|
Error IsEnded() override;
|
||||||
bool Abort() override;
|
bool Abort() override;
|
||||||
|
|
||||||
protected:
|
|
||||||
CExchangePost* FindExchangePost(float power);
|
CExchangePost* FindExchangePost(float power);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
|
|
||||||
class COldObject;
|
class COldObject;
|
||||||
|
@ -126,5 +127,5 @@ protected:
|
||||||
int m_error = 0; // error (0=ok)
|
int m_error = 0; // error (0=ok)
|
||||||
int m_cursor1 = 0;
|
int m_cursor1 = 0;
|
||||||
int m_cursor2 = 0;
|
int m_cursor2 = 0;
|
||||||
float m_returnValue = 0.0f;
|
boost::optional<float> m_returnValue = boost::none;
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,6 +52,8 @@
|
||||||
|
|
||||||
#include "object/subclass/exchange_post.h"
|
#include "object/subclass/exchange_post.h"
|
||||||
|
|
||||||
|
#include "object/task/taskinfo.h"
|
||||||
|
|
||||||
#include "physics/physics.h"
|
#include "physics/physics.h"
|
||||||
|
|
||||||
#include "script/cbottoken.h"
|
#include "script/cbottoken.h"
|
||||||
|
@ -1320,7 +1322,7 @@ bool CScriptFunctions::rDetect(CBotVar* var, CBotVar* result, int& exception, vo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !WaitForForegroundTask(script, result, exception) ) return false; // not finished
|
if ( !WaitForForegroundTask(script, result, exception) ) return false; // not finished
|
||||||
result->SetValFloat(script->m_returnValue);
|
result->SetValFloat(*script->m_returnValue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2186,11 +2188,10 @@ CBotTypResult CScriptFunctions::cReceive(CBotVar* &var, void* user)
|
||||||
bool CScriptFunctions::rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
|
bool CScriptFunctions::rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
|
||||||
{
|
{
|
||||||
CScript* script = static_cast<CScript*>(user);
|
CScript* script = static_cast<CScript*>(user);
|
||||||
CObject* pThis = script->m_object;
|
|
||||||
CBotString cbs;
|
CBotString cbs;
|
||||||
Error err;
|
Error err;
|
||||||
const char* p;
|
const char* p;
|
||||||
float value, power;
|
float power;
|
||||||
|
|
||||||
exception = 0;
|
exception = 0;
|
||||||
|
|
||||||
|
@ -2207,24 +2208,26 @@ bool CScriptFunctions::rReceive(CBotVar* var, CBotVar* result, int& exception, v
|
||||||
var = var->GetNext();
|
var = var->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
err = script->m_taskExecutor->StartTaskInfo(static_cast<const char*>(p), 0.0f, power, false);
|
err = script->m_taskExecutor->StartTaskInfo(p, 0.0f, power, false);
|
||||||
if ( err != ERR_OK )
|
if ( err != ERR_OK )
|
||||||
{
|
{
|
||||||
script->m_taskExecutor->StopForegroundTask();
|
script->m_taskExecutor->StopForegroundTask();
|
||||||
result->SetInit(CBotVar::InitType::IS_NAN);
|
result->SetInit(CBotVar::InitType::IS_NAN);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CExchangePost* exchangePost = dynamic_cast<CTaskInfo*>(script->m_taskExecutor->GetForegroundTask())->FindExchangePost(power);
|
||||||
|
script->m_returnValue = exchangePost->GetInfoValue(p);
|
||||||
}
|
}
|
||||||
if ( !WaitForForegroundTask(script, result, exception) ) return false; // not finished
|
if ( !WaitForForegroundTask(script, result, exception) ) return false; // not finished
|
||||||
|
|
||||||
value = pThis->GetInfoReturn();
|
if ( script->m_returnValue == boost::none )
|
||||||
if ( std::isnan(value) )
|
|
||||||
{
|
{
|
||||||
result->SetInit(CBotVar::InitType::IS_NAN);
|
result->SetInit(CBotVar::InitType::IS_NAN);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result->SetValFloat(value);
|
result->SetValFloat(*script->m_returnValue);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file ui/control/key.h
|
* \file ui/controls/key.h
|
||||||
* \brief Key slot control
|
* \brief Key slot control
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue