Game Development Community

Help with syntax (and other errors) Adding Reactive Mission Regi

by Brian Lyon · in General Discussion · 08/12/2004 (9:37 pm) · 6 replies

Im trying to add the resource Adding Reactive Mission Regions from www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5114
im getting like 27 errors from player.cc (the parts modified by the resource)
SimGroup*   pRgns = dynamic_cast<SimGroup*>(Sim::findObject("MissionRegions"));
   if( !pRgns )
      return;
   SimObjectId inRgn = 0;
   char szID[12];
   for( SimGroup::iterator i = pRgns->begin(); i != pRgns->end(); i++ ) {
      MissionRegion* rgn = dynamic_cast<MissionRegion*>(*i);
      const RectI &box = rgn->getArea();
      if( pos.x < box.point.x || pos.x > box.point.x + box.extent.x
      ||  pos.y < box.point.y || pos.y > box.point.y + box.extent.y ) {
         // not in this one
      }
      else { // inside this one
         inRgn = rgn->getId();
         if( mMissionRegion != inRgn ) { // leaving previous region
            dSprintf(szID, sizeof(szID), "%d", mMissionRegion);
            Con::executef(mDataBlock,4,"onLeaveMissionRegion",scriptThis(),szID);
            mMissionRegion = inRgn;
            Con::executef(mDataBlock,4,"onEnterMissionRegion",scriptThis(),rgn->getId
String());
         }
      }
   }
   if( !inRgn ) { // not inside any defined region
      if( mMissionRegion != 0 ) { // leaving previous region
         dSprintf(szID, sizeof(szID), "%d", mMissionRegion);
         Con::executef(mDataBlock,4,"onLeaveMissionRegion",scriptThis(),szID);
         // reentry of region zero
         mMissionRegion = inRgn;
         dSprintf(szID, sizeof(szID), "%d", mMissionRegion);
         Con::executef(mDataBlock,4,"onEnterMissionRegion",scriptThis(),szID);
      }
   }
the errors:
:\Documents and Settings\zenthor\Desktop\torqueheadsdk\torque2\engine\game\player.cc(2817) : error C2143: syntax error : missing ';' before 'if'
C:\Documents and Settings\zenthor\Desktop\torqueheadsdk\torque2\engine\game\player.cc(2821) : error C2143: syntax error : missing ';' before 'if'
C:\Documents and Settings\zenthor\Desktop\torqueheadsdk\torque2\engine\game\player.cc(2821) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\zenthor\Desktop\torqueheadsdk\torque2\engine\game\player.cc(2821) : error C2447: missing function header (old-style formal list?)
theres alot more totaling 27 but there to long to post here
im following the resource exactly and the code looks the same please help

#1
08/12/2004 (9:52 pm)
Put in ; where it tells you too
#2
08/12/2004 (10:08 pm)
Uhhhhh not a good idea. Had he installed that block of code exactly like he was told to....


"In the function Player::checkMissionArea() in engine\game\player.cc behind the last statement block add"

there shouldn't have been any problem. Based on his profile I would have to say the above code was not installed properly. Most likely he went to the very end of the function and pasted it directly BEHIND the "function Player::checkMissionArea()" function instead of appending it just inside the last bracket of the function.
#3
08/12/2004 (10:19 pm)
Im coming mostly from a Turbo pascal background.. sorry
#4
08/12/2004 (10:23 pm)
...
#5
08/12/2004 (10:47 pm)
Thx gonzo it worked
#6
08/13/2004 (5:06 pm)
No problem dude, glad to hear it's all fixed up.

Good luck, have fun