Function call inconsistencies =-(

Started by
1 comment, last by Tac-Tics 21 years, 5 months ago
Hi. I''m having a little trouble with one of my programs and I need some professional help =-) Well, I''m making a maze program to use in my psychology class to take statistics of how quickly people can navigate mazes and their ability to learn after repeated tries through the same maze. I''ve got most of the maze program set up except for collision detection and other program-end dealies. However, I''m having a bit of trouble with a few function calls. Each wall of the maze has a corresponding object of class "Wall". All the walls are kept in a vector class I wrote called class "Array". Array has a method getSize() that returns the number of items in the vector. Now here''s where things get weird.... In my main game loop, I call g_wallList.getSize() (g_wallList is the global Array object in the game). It returns the correct number of walls and that allows me to loop through and render all the walls with the help of OpenGL. HOWEVER(!) inside my collision detection function, I call the SAME METHOD again and it returns 0(!!!) I through in some debug code that printed out the value of g_wallList.getSize() immediately BEFORE and AFTER I called the collision detect function and it gave me 2 DIFFERENT return values. I''m confused o_O Does anyone have any idea what might be wrong here? I can provide full source if neccessary. Also, I had a similar problem with Texture mapping in OpenGL with the glBindTexture command. If I used it in my main game loop, it worked fine, but inside the render method of the Wall class, it didn''t work at all and I got plain white walls =-( Can anyone help me here? "You TK''ed my chicken!"
Advertisement
Everyone has problems like this occasionaly. It is almost always something small and stupid, which is hard to see by the person who wrote the code. I think you will have to post the code.
If they are in different files, you may have forgot to declare one of them extern and the compiler ended up making a seperate instance of the variable in each file.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.

This topic is closed to new replies.

Advertisement