Server Help

Bot Questions - Tm_baw

ThunderJam - Fri May 11, 2007 8:56 pm
Post subject: Tm_baw
Wanted to try editing SOS' tm_baw for some increased functionality but when i unzipped the src and tried to compile it spews out a bunch of errors that say:

error C2362: initialization of 'i2' is skipped by 'goto InvalidEntry'

i2 is a counter the counter in a for loop, im new to coding merv plugins so i really donno what to do

Code: Show/Hide
#define G2(a) if (isNumeric(buffer))\
         a = getInteger(buffer, 10);\
      else\
         goto InvalidEntry

      G("FromX1");
      if (!buffer[0])
         continue;

      Warp *w = new Warp;

      G2(w->x1);

      G("FromY1");
      G2(w->y1);

      G("FromX2");
      G2(w->x2);

      G("FromY2");
      G2(w->y2);

      G("Ship");
      G2(w->ship);

      G("ToY");
      G2(w->toY);

      G("ToX");
      G2(w->toX);

      G("Freq");
      G2(w->freq);

      for (Uint32 i2 = 0; i2 < 10; i2++)
      {
         String n;
         n = "PrivAction";
         n += i2;

         G(n.msg);
         w->PrivActions[i2] = buffer;

         n = "PubAction";
         n += i2;
         
         G(n.msg);
         w->PubActions[i2] = buffer;
      }

      Warps.append(w);

      continue;
InvalidEntry:
      delete w;
      String s;
      s = "Invalid warp.ini entry: ";
      s += i;
      tell(makeEcho(s.msg));
   }
}

Samapico - Fri May 11, 2007 10:09 pm
Post subject:
probably because there's a variable being initialized between the GoTo and the InvalidEntry: label... If it worked before, maybe you're using a different compiler that doesn't accept that... I think that Visual Studio 2005 does quite a few things differently than Visual Studio 6 when it comes to C++

Try avoiding the GoTo statement completly...
The invalid entry thing could be a separate function instead, and you'd pass it 'w' so it can delete it

Also, try using more significant variable names... i2 is just ugly tongue.gif I don't know if you did that part or if it's part of SOS' code...
Bak - Sat May 12, 2007 10:08 am
Post subject:
sounds like an older compiler... try changing the for loop to

Code: Show/Hide
for (i2=0; i2 < 10; i2++)


and before the #define add

Code: Show/Hide
Uint32 i2 = 0;

All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group