Game Development Community

I thought resolveObjectFromGhostIndex was server side...

by Dumbledore · in RTS Starter Kit · 05/22/2008 (6:00 am) · 0 replies

Hello, I'm wondering if someone whose not as new as I am will take a look:

RTSCamera.cc:

void RTSCameraUpdate::process(NetConnection * conn)
{
   // Resolve the ghost id and set the positional data
   if(mGhostID > -1)
   {
      if(!mOnServer)  // is this on the client?  
      // if yes get a pointer to the RTSCamera object with its ghost Id like so:
         mCam = dynamic_cast<RTSCamera*>(conn->resolveObjectFromGhostIndex(mGhostID));  
      // but I thought NetConnection::resolveObjectFromGhostIndex() was a server side call....
      else
         mCam = dynamic_cast<RTSCamera*>(conn->resolveGhost(mGhostID));


I think it should be:

void RTSCameraUpdate::process(NetConnection * conn)
{
   // Resolve the ghost id and set the positional data
   if(mGhostID > -1)
   {
      if( mOnServer )   // CHANGED
         mCam = dynamic_cast<RTSCamera*>(conn->resolveObjectFromGhostIndex(mGhostID));  
      else
         mCam = dynamic_cast<RTSCamera*>(conn->resolveGhost(mGhostID));