Game Development Community

Class variable access question.

by Wendell Brown · in Torque Game Engine · 08/12/2002 (10:33 am) · 0 replies

Hello all,
I have a question I have been sorta struggling with. Not knowing C++ well, I can't seem to figure how to do something.
I have code below that is trying to decide if another object that is being selected, needs to be put into the mSelected(mObjectList.) field that exists in gameTSCtrl.cc(a copy of WorldEditor.cc code).
How can the GuiTextListCtrl class access objects in the GameTSCtrl class or make a call to gameTSCtrl to have its' members updated?
If I knew scripting well enough maybe I should attempt there?

void GuiTextListCtrl::onCellSelected(Point2I cell)
{	
   // See if this is an attempt to select starSystem components
   if( mList[cell.y].id == (U32)Sim::findObject("SDSelectSystem" ) )
   {
      SimObject *simobj;
      if( simobj = Sim::findObject(mList[cell.y].text) )
      {
           SceneObject *sceneobj = (SceneObject *)simobj;

--------->>GameCtrl::modifySelection(sceneobj);
       }
   }
   Con::executef(this, 3, "onSelect",
                 Con::getIntArg(mList[cell.y].id),
                                mList[cell.y].text);

   if (mConsoleCommand[0])
      Con::evaluate(mConsoleCommand, false);
}

This has been placed in gameTSCtrl.cc

void GameTSCtrl::modifySelection( SceneObject * obj)
{	
   if(!mSelected.objInSet(obj))
   {
      mNoMouseDrag = true;
      mSelected.clear();
      mSelected.addObject(obj);
   }
}