- added Get/SetValue functions to PBool.

This commit is contained in:
Christoph Oelckers 2017-03-22 15:44:54 +01:00
parent 62fbb00bc9
commit 04c2565d7f
2 changed files with 30 additions and 0 deletions

View file

@ -711,6 +711,32 @@ double PInt::GetValueFloat(void *addr) const
IMPLEMENT_CLASS(PBool, false, false)
//==========================================================================
//
// PInt :: SetValue
//
//==========================================================================
void PBool::SetValue(void *addr, int val)
{
*(bool*)addr = !!val;
}
void PBool::SetValue(void *addr, double val)
{
*(bool*)addr = val != 0.;
}
int PBool::GetValueInt(void *addr) const
{
return *(bool *)addr;
}
double PBool::GetValueFloat(void *addr) const
{
return *(bool *)addr;
}
//==========================================================================
//
// PBool Default Constructor

View file

@ -263,6 +263,10 @@ class PBool : public PInt
DECLARE_CLASS(PBool, PInt);
public:
PBool();
virtual void SetValue(void *addr, int val);
virtual void SetValue(void *addr, double val);
virtual int GetValueInt(void *addr) const;
virtual double GetValueFloat(void *addr) const;
};
class PFloat : public PBasicType