Jump to content
  • Advertisement
Sign in to follow this  
rpg gamer 17

Hum... Trouble...

This topic is 3319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Programming Language: C++ Compiler: MV C++ 2008 What is an easy safe way to change a location in a list<bool> from true to false? besides:
		for(list<bool>::iterator OpenS = OpenSurface.begin(); OpenS != OpenSurface.end(); OpenS++) {
			if(Num == Number)
			{
				list<bool> temp;
				temp.push_back(false);
				list<bool>::iterator value = temp.begin();
				iter_swap(value, OpenSurface.begin());
			}
			Num++;
		}


Also: Unhandled exception at 0x00d43a00 in GameEngine.exe: 0xC0000005: Access violation reading location 0x00000000. I get this when I run the debugger. It breaks to line 832 in the list header file. The error only happens when I close the program. If I run the exe by itself it stops responding.
 #if _HAS_ITERATOR_DEBUGGING
		this->_Orphan_ptr(*this, 0);
 #endif /* _HAS_ITERATOR_DEBUGGING */

		_Nodeptr _Pnext;
		_Nodeptr _Pnode = _Nextnode(_Myhead); //<-- here
		_Nextnode(_Myhead) = _Myhead;
		_Prevnode(_Myhead) = _Myhead;
		_Mysize = 0;


I only have one list in my program.
class GraphicEngine
{
private:
	SDL_Surface* ReturnImage; //Returned surface for Images
	Surface* Surfaces;
	list<bool> OpenSurface;
...
GraphicEngine::GraphicEngine(short int TOTAL = 50)
{
	Surfaces = new Surface [TOTAL];
	for(int num = 0; num < TOTAL; num++)
	{
		Surfaces[num].X = -1;
		Surfaces[num].Y = -1;
		Surfaces[num].Layer = 0;
		Surfaces[num].TotalFrames = 0;
		Surfaces[num].StartingFrame = -1;
		Surfaces[num].ColorKeyOn = false;
		Surfaces[num].R = 0;
		Surfaces[num].G = 0;
		Surfaces[num].B = 0;
		Surfaces[num].Alpha = SDL_ALPHA_OPAQUE;
		Surfaces[num].Image = NULL;
		Surfaces[num].Text = NULL;
		Surfaces[num].Started = false;
		OpenSurface.push_back(true);
	}
}


Share this post


Link to post
Share on other sites
Advertisement
Short and simple. I like it. Thanks!
Now for the pesky error I'm getting.
Here are a few details on what I have set in the compiler:

Properties->C/C++->Code Generation->Runtime Library->Multi-Threaded DLL (/MD)
Properties->C/C++->Preprocessor->Preprocessor Definitions: WIN32;_CONSOLE
Properties->Linker->Input->Additional Dependencies->SDL.lib SDLmain.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib


I'm pretty sure that's all I've changed. I took out _DEBUG; from the preprocessor because it kept throwing errors with list and SDL.

Share this post


Link to post
Share on other sites
Quote:
Original post by rpg gamer 17
I took out _DEBUG; from the preprocessor because it kept throwing errors with list and SDL.


correct me if im wrong but couldnt you put _NDEBUG instead of deleting it? seems safer to me.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!