My gut feeling says the ai is where the program is going haywire, but I have no way I knowing that. I'll have to do that with the logging components/levels.
matsp, Here is my DestroyTorpedo function:
Code:
void DestroyTorpedo(int one)
{
log("DestroyTorpedo(%d)", one); // Added for debugging purposes
for(e = one; e < torps; e++)
torp[e] = torp[e + 1];
torps--;
return;
}
as you can see, DestroyTorpedo makes torpedo 19 become torpedo 18, so that isn't a problem.
>> Using a standard function to provide ALL of the logging will help tremendously here.
I don't know if I follow. But I'm currently calling log(), and thats the only function I call to record this stuff.
Here is my log function
Code:
// dolog is a boolean that I can activate during runtime by pressing L.
void log(const char *fmt, ...)
{
if(fmt == NULL || !dolog) return;
char text[MAX_PATH];
va_list ap;
va_start(ap, fmt);
vsprintf(text, fmt, ap);
va_end(ap);
FILE *fp = fopen("log.txt", "a+");
fprintf(fp, "%s\r\n", text);
fclose(fp);
return;
}
do you know of any way of increasing it's preformence?