.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Well , just a small question (http://forums.bots-united.com/showthread.php?t=3273)

Rifleman 25-12-2004 08:21

Well , just a small question
 
I am currently experimenting POD 2.6 src , I am curious why sometimes the bot wont shoot ? Perhaps some pod l33t could help me ...


[NEW]
I am frustated of getting this buffer overrun error ...

Code:

Buffer overrun detected
 
D:\valve\hl.exe
 
A buffer overrun has been detected which has corrupted the program's internal state. The program cannot safely continue execution and must now be terminated

WTH ??!

dub 25-12-2004 15:05

Re: Well , just a small question
 
one bad pointer crash i know of could help (very common crash bug)
Code:

// Enemy behind Obstacle ? Bot wants to fire ?
        if (pBot->iStates & STATE_SUSPECTENEMY && pBot->bWantsToFire)
        {
                int iTask = pBot->pTasks->iTask;
                // Don't allow shooting through walls when camping
                if(iTask == TASK_PAUSE || iTask == TASK_CAMP)
                        pBot->bWantsToFire = FALSE;
        }

should be

Code:

// Enemy behind Obstacle ? Bot wants to fire ?
        if (pBot->iStates & STATE_SUSPECTENEMY && pBot->bWantsToFire)
        {
                int iTask = BotGetSafeTask (pBot)->iTask;
                // Don't allow shooting through walls when camping
                if(iTask == TASK_PAUSE || iTask == TASK_CAMP)
                        pBot->bWantsToFire = FALSE;
        }


Whistler 25-12-2004 15:39

Re: Well , just a small question
 
"buffer overrun" means this:
PHP Code:

#include <string.h>
main()
{
   
char sz[5];
   
strcpy(sz"abcdefghijklmnopqrstuvwxyz"); // buffer overrun



Rifleman 25-12-2004 16:49

Re: Well , just a small question
 
thanks guys ! The problem comes from my A* modification and now its fixed ! thanks again !

Whistler 26-12-2004 03:09

Re: Well , just a small question
 
I fail to see how A* is related to shooting...

@$3.1415rin 26-12-2004 12:14

Re: Well , just a small question
 
when having wrong pointers somewhere, you might often get error in nonrelated code ...

The Storm 26-12-2004 12:44

Re: Well , just a small question
 
I wont to ask question to.
Is this thinks are same
Code:

  int iTask = pBot->pTasks->iTask;
and
Code:

  int iTask = BotGetSafeTask (pBot)->iTask;
?

Rifleman 26-12-2004 12:46

Re: Well , just a small question
 
no , I didn't say it is related to the combat code...

Pierre-Marie Baty 26-12-2004 14:51

Re: Well , just a small question
 
this
Code:

int iTask = pBot->pTasks->iTask;
returns a pointer to the iTask element in the structure pointed to by pTasks. But this code will crash if pTasks is NULL, i.e. points to no tasks structure. This however
Code:

int iTask = BotGetSafeTask (pBot)->iTask;
will always return a valid pTasks pointer (even if it points to an empty task structure, what I'd call a "failsafe pointer"). This way iTask is always guaranteed to be accessible and the code won't crash.


All times are GMT +2. The time now is 06:12.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.