Game Development Community

TGEA 1.8.0 Bug in Check Mission Area

by Britton LaRoche · in Torque Game Engine Advanced · 01/06/2009 (11:45 pm) · 1 replies

The check mission area function never gets past the following lines of code

MissionArea * obj = dynamic_cast<MissionArea*>(Sim::findObject("GlobalMissionArea"));

   if(!obj)
      return;

The object is always null. It cannot find the GlobalMissionArea

void Player::checkMissionArea()
{
   // Checks to see if the player is in the Mission Area...
   Point3F pos;
   MissionArea * obj = dynamic_cast<MissionArea*>(Sim::findObject("GlobalMissionArea"));

   if(!obj)
      return;

   const RectI &area = obj->getArea();
   getTransform().getColumn(3, &pos);

   if ((pos.x < area.point.x || pos.x > area.point.x + area.extent.x ||
       pos.y < area.point.y || pos.y > area.point.y + area.extent.y)) {
      if(mInMissionArea) {
         mInMissionArea = false;
         Con::executef(mDataBlock, "onLeaveMissionArea",scriptThis());
      }
   }
   else if(!mInMissionArea)
   {
      mInMissionArea = true;
      Con::executef(mDataBlock, "onEnterMissionArea",scriptThis());
   }
}


I check the TGE 1.5.2 code base and noticed it was looking for "MissionArea" I tried changing this value in TGEA 1.8.0 to MissionArea, did a rebuild on stronghold.exe and it still did not work.

MissionArea * obj = dynamic_cast<MissionArea*>(Sim::findObject("MissionArea"));

That did not work.... so I changed the mission file to have "GlobalMissionArea" instead of "MissionArea" for the object name and that worked.... very strange.

new MissionArea(GlobalMissionArea) {
      canSaveDynamicFields = "1";
      Enabled = "1";
      Area = "-150 -450 450 900";
      flightCeiling = "300";
      flightCeilingRange = "20";
      locked = "true";
   };

I noticed the following warnings in the console log for the stronghold demo.

*** Load Main Menu
Warning! You have a duplicate datablock name of MissionInfo. This can cause problems. You should rename one of them.
Warning! You have a duplicate datablock name of MissionInfo. This can cause problems. You should rename one of them.
.....
Exporting server prefs...

Not sure if this is related, but the stronghold mission only has only has one mission info data block.

#1
01/09/2009 (8:32 pm)
I think I saw in the migration guide a note that the name of an object can no longer match the name of the class, so

new MissionArea(MissionArea) {...}

won't work anymore.