[Include] Arrow.inc Create And Point Arrows At Stuff
#14

Ya your right, I wrote that last night when I was dead tired

It's actually only one line missing.

if(gArrowObjectID[i] != INVALID_ARROW_ID) continue;

For OOB checking just add this at the top of all functions that require it.

pawn Code:
if(arrowid < 0 || arrowid >= MAX_ARROWS)
{
    printf("Error: Arrows.Inc::FunctionName()::OOB arrowid reference Arrowid: %i", arrowid);
    return INVALID_ARROW_ID;
}
pawn Code:
Or if you want it a bit cleaner

#define OOBCheck(%0,%1); if(%0 < 0 || %0 >= MAX_ARROWS) { \
    printf("Error: Arrows.Inc::%s Arrowid: %i", %1, %0); \
    return INVALID_ARROW_ID; }

becomes

OOBCheck(arrowid, "Error: Arrows.Inc::FunctionName()::OOB arrowid reference");

I don't usually put OOB checking in my code crashdetect usually works fine but your right if something can go wrong it will go wrong so it's probably a good idea to put into released code.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)