View Single Post
Re: botmaaaaaaaaan!!!!!
Old
  (#3)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: botmaaaaaaaaan!!!!! - 21-03-2004

bah don't worry, I made a great fuss again for not very much ----> it's FIXED. w00h00h000000t!!!

Actually I spent hours on it, but the only method that works when all the other fails remain the trial and error: you comment out (/* like this */) half of the code, then compile the bot and see if it crashes. If it doesn't you uncomment half of what you'd commented and you try again. If it doesn't you uncomment half of it again, until you narrow down the bug.

The line that was causing the error was, believe it or not:
Code:
pPlayer = ThreatTab[i].pEntity;
pPlayer being edict_t *, pEntity idem, and i being NOT out of range. A perfectly valid line. Everything that was below that line was commented, but IF that line was NOT commented, the game crashed. Unbearable.

Anyhow I put it back because I've found the REAL problem elsewhere in this very function. Count Floyd has the very bad habit of declaring his variable names everywhere BUT where they should be declared.
Code:
void SomeFunction (edict_t *pPlayer) // first definition of pPlayer
{
   int i; // first definition of i
 
   for (i = 0; i < somevalue; i++)
   {
	  DoSomething ();
 
	  edict_t *pPlayer = INDEXENT (i); // new definition of pPlayer
 
	  // three pages later...
 
	  for (int index = 0; index < 32; index++)
	  {
		 // four other pages later...
 
		 int i = someOtherValue; // new definition of i
		 while (i > 0)
		 {
			edict_t *pPlayer = bots[i].pEdict; // new definition of pPlayer
			DoSomeStuffWithVariable (i--);
		 }
	  }
   }
}
there are things like that everywhere. Actually it's a miracle his bot worked so well for all that time... 9_9


Anyway I'm still interested in knowing what the NUM_FOR_EDICT(): bad pointer error means



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 21-03-2004 at 01:45..
  
Reply With Quote