Game Development Community

GhostIdBitSize fix in Item.cc

by Eric Hartman · in Torque Game Engine · 02/19/2005 (1:02 pm) · 2 replies

There is a hardcoded GhostIdBitSize in item::unpackupdate. The result is that if you have increasd the ghost bit size, items that you drop and do setcollisiontimeout on will be invisible until their next update. The fix is easy.

This code:
void Item::unpackUpdate(NetConnection *connection, BitStream *stream)
{
....
   if (stream->readFlag()) {
      S32 gIndex = stream->readInt(10);
      setCollisionTimeout(static_cast<ShapeBase*>(connection->resolveGhost(gIndex)));
   }
...
}
Should be this:
void Item::unpackUpdate(NetConnection *connection, BitStream *stream)
{
....
   if (stream->readFlag()) {
      [b]S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize);[/b]
      setCollisionTimeout(static_cast<ShapeBase*>(connection->resolveGhost(gIndex)));
   }
...
}

#1
02/19/2005 (4:49 pm)
Good eye. On my todolist now.
#2
03/15/2005 (12:03 am)
Fixed this. Thanks!