DBViewNumber shouldn't crash anymore.

--HG--
branch : dfighter-tools
This commit is contained in:
dfighter1985 2014-10-20 20:57:08 +02:00
parent 2fe2077170
commit b6d9e3285f
3 changed files with 21 additions and 3 deletions

View file

@ -55,9 +55,7 @@ namespace NLGUI
static void forceLink();
protected:
sint64 getVal() { if (_Modulo == 0) return (_Number.getSInt64() / _Divisor);
else return (_Number.getSInt64() / _Divisor)%_Modulo; }
sint64 getVal();
protected:

View file

@ -47,6 +47,15 @@ namespace NLGUI
_VolatileValue = NULL;
}
/// Tells if this property has a value
bool hasValue() const
{
if( _VolatileValue != NULL )
return true;
else
return false;
}
NLMISC::CCDBNodeLeaf* getNodePtr() const
{
return _VolatileValue;

View file

@ -249,5 +249,16 @@ namespace NLGUI
{
}
sint64 CDBViewNumber::getVal()
{
if( !_Number.hasValue() )
return 0;
if( _Modulo == 0 )
return _Number.getSInt64() / _Divisor;
else
return ( _Number.getSInt64() / _Divisor ) % _Modulo;
}
}