From f18a9c916d23c96c013f702aaec6b2c539ceb273 Mon Sep 17 00:00:00 2001 From: megamage Date: Mon, 23 Mar 2009 20:13:37 -0600 Subject: *Fix some crashes possibly related to vehicles. *Fix a bug that client crashes when seer is far away from caster. --HG-- branch : trunk --- src/game/Object.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/game/Object.cpp') diff --git a/src/game/Object.cpp b/src/game/Object.cpp index b17f905b7dd..d84e2b7c07e 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -864,6 +864,48 @@ void Object::SetUInt64Value( uint16 index, const uint64 &value ) } } +bool Object::AddUInt64Value(uint16 index, const uint64 &value) +{ + ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , true ) ); + if(value && !*((uint64*)&(m_uint32Values[index]))) + { + m_uint32Values[ index ] = *((uint32*)&value); + m_uint32Values[ index + 1 ] = *(((uint32*)&value) + 1); + + if(m_inWorld) + { + if(!m_objectUpdated) + { + ObjectAccessor::Instance().AddUpdateObject(this); + m_objectUpdated = true; + } + } + return true; + } + return false; +} + +bool Object::RemoveUInt64Value(uint16 index, const uint64 &value) +{ + ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , true ) ); + if(value && *((uint64*)&(m_uint32Values[index])) == value) + { + m_uint32Values[ index ] = 0; + m_uint32Values[ index + 1 ] = 0; + + if(m_inWorld) + { + if(!m_objectUpdated) + { + ObjectAccessor::Instance().AddUpdateObject(this); + m_objectUpdated = true; + } + } + return true; + } + return false; +} + void Object::SetFloatValue( uint16 index, float value ) { ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); -- cgit v1.2.3