Game Development Community

TGE 1.7.1 Bug and Fix::ResolveGhostID

by Terence Tan · in Torque Game Engine Advanced · 09/13/2008 (8:05 pm) · 0 replies

Currently in the script method resolveGhostID under sim\netConnection.cpp line 1123 reads:

S32 gID = dAtoi(argv[2]);

   // Safety check
   if(gID < 0 || gID > NetConnection::MaxGhostCount) return 0;

   NetObject *foo = object->resolveGhost(gID);

   if(foo)
      return foo->getId();
   else
      return 0;

Passing a zero, crashes in object->resolveGhost(gID)...I am assuming that there are no '0' id's (Never seen any in my work with Torque.

So I would change this to:
// Safety check
   if(gID <= 0 || gID > NetConnection::MaxGhostCount) return 0;