Server Help

Bot Questions - Weird mervbot bug...

Tommyhawk - Mon Jul 26, 2004 11:04 pm
Post subject: Weird mervbot bug...
I have a really odd thing happening in one of my MervBot plugins. When I declare a variable at the top of the botInfo class I get really random and erratic values for it as if the memory its located at is being accessed and changed while the bot is running, even though I never change it (or at least don't change it to the values its being set at) and I've initialized it in the botInfo constructor. The only way around it is to declare a bunch of dummy variables that I don't use before I start declaring the actual variables I want. For example,

Code: Show/Hide
class botInfo
{
   bool CONNECTION_DENIED;

   CALL_HANDLE handle;
   CALL_COMMAND callback;
   CALL_PLIST playerlist;
   CALL_FLIST flaglist;
   CALL_MAP map;
   CALL_BLIST bricklist;
   char *arena;
   arenaSettings *settings;
   Player *me;
   bool biller_online;

   objectInfo object_array[MAX_OBJECTS];
   int num_objects;
   Player *object_dest;

   int countdown[7];

   // Put bot data here
   Player *nothing[2000];  ////// DUMMY PLAYER OBJECTS /////

   int f0capttimer;
   int f1capttimer;
   int capt0vote;
   int capt1vote;


The Player *nothing[2000] is there just so my f0capttimer, f1capttimer, etc.. variables will work but occaisonally they still get set to crazy values. This doesn't happen with every plugin I've made, but it is with this one and for the life of me I can't figure out why. I've even compared my spawn.h line for line with other plugins I've made and I can't notice anything that could cause this. Has anyone seen this before or have any idea whats going on?
Mr Ekted - Mon Jul 26, 2004 11:14 pm
Post subject:
Something is likely going out of bounds in the object_array[] or countdown[].
Solo Ace - Mon Jul 26, 2004 11:16 pm
Post subject:
Meh, I was seeing if that could be the problem, pfft. icon_razz.gif
Anonymous - Tue Jul 27, 2004 2:08 am
Post subject:
post the entire source
CypherJF - Tue Jul 27, 2004 3:08 am
Post subject:
i wonder why you'd need 2000 Player objects anyways?

Definately post up your source code so we can take a better look at it.
50% Packetloss - Tue Jul 27, 2004 4:33 am
Post subject:
yah, there is no way you need that many pointers. THere will never be 2k people in one arena. Use a linklist
Dustpuppy - Tue Jul 27, 2004 4:39 am
Post subject:
CypherJF wrote:
i wonder why you'd need 2000 Player objects anyways?

Definately post up your source code so we can take a better look at it.

50% Packetloss wrote:
yah, there is no way you need that many pointers. THere will never be 2k people in one arena. Use a linklist

Pay attention guys, the player objects are just dummy memory fillers.

Not really adding anything here, but I'd agree with Ekted in that it's most likely an out of bounds. Take a look at where you're accessing them, and if you can't find a problem post your spawn.cpp (and command.cpp?) too
Smong - Tue Jul 27, 2004 8:39 am
Post subject:
Or maybe the header files you have don't match the version of merv that you run your plugins with.

Since nothing is a pointer, you could just do 'void *dummy[2000]' which would take the same amount of memory.
Tommyhawk - Tue Jul 27, 2004 4:26 pm
Post subject:
Well I was having this problem for MONTHS and now its gone and I don't know why. I'll probably let you know if it happens again. Thanks for the help anyway.
CypherJF - Tue Jul 27, 2004 5:24 pm
Post subject:
.shrug.

I knew they were just dummy pointers; but still...
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group