Sign in to follow this  
tHomahwk

weird Run-time error (debug & release mode)

Recommended Posts

As the title suggests, I have a weird run time error (debug only tested right now). First just to let everyone know, C++, VS 2005. I have a function, that I am passing in two parameters, a pointer to a class and a float. Where the function is called, the float variable that is passed in = 85.0f, however, when I enter the function, the local variable is 0.0f and if I go back up the stack, the initial variable still = 85.0f. If I place a constant value there, (i.e. pass in 85.0f instead of the variable) it works fine. Also I call this function from other places using variables, and they work fine. The pointer is passed in corrently, only the float type is having issues. In both places, the type is float (i.e. no typedefs, or casting even). Both classes reside in the same namespace as well. prototype and function call below.
bool ActorManager::MainActorInRadius( const Actor *pActor, const float fRadius ) const;

if( ActorManager::GetSingletonPointer()->MainActorInRadius( dynamic_cast<Actor*>( this ), this->m_fAttackRadius ) )





Any help is a appriciated. tHom EDIT: I am thoroughly confused now. I was trying to add some menu content, when I notice a slightly similar but different issue. When trying to get a variable from another class via a "GET" function, the address it returns is not correct. For example, I have an unsigned short array of size 6, when inside the class, the array's pointer value is "0x24001f37". After the "GET" function returns, the return value is, "0x24001f3a". I am not calling this anywhere else, so I can't test if this function call is working in other places. Again, these seems to be an isolated event. Any ideas as to what could be causing all these weird memory issues? Some other important issues to point out: I am also using the Ogre Rendering Engine for my game, the first instance up above with the value not being passed correctly resides in the same dll, and the 2nd case, the pointer that is set is form within an .exe and the function call itself is placed within a .dll. I'm not sure if this is important enough, but it seems that most of the errors are kind of around my Actor class. I can provide the source if you think it would be useful. Src below
const WORD* pExpTable = RPGObject::ActorManager::GetSingletonPointer()->GetHumanPlayer()->GetProfLevelsExp();

const WORD* GetProfLevelsExp() const
{
	return this->m_wProfExp;
}



here is a link to my uploaded uml diagram. maybe this will help? AIPlayer class size is 186 if I remember correctly, and HumanPlayer is 166 if I remember correctly. MY UML design Just trying to provide as much info as I can. [Edited by - tHomahwk on March 10, 2007 3:07:18 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this