Jump to content
  • Advertisement
Sign in to follow this  
Mybowlcut

Function not getting entered

This topic is 4079 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

Sorry about bad subject/title. My problem is that the function below (//HERE) is not getting entered:
RETURN_CODE game(Draw_Engine& DE, SDL_Event& event_)
{
	Board board(DE, 8, 8);

	Image menu(true, BUTTON_SHEET_FN, M.x, M.y);
	menu.Set_Clip(M_OFF);
	DE.Load_Image(menu);
	DE.Blit_Image(menu);

	while(true) {
		if(!DE.Draw_Screen()) { //HERE
			DE.Free_Image(menu);
			board.CleanUp(DE);
			return EXIT_GAME;
		}
		if(board.DrawBoard(DE) == EXIT_GAME) {
			DE.Free_Image(menu);
			board.CleanUp(DE);
			return EXIT_GAME;
		}
		while(SDL_PollEvent(&event_)) {
			if(event_.type == SDL_QUIT) {
				DE.Free_Image(menu);
				board.CleanUp(DE);
				return EXIT_GAME;
			}
		}
	}
}



The functions definition looks like this:
bool Draw_Engine::Draw_Screen() {
	return(SDL_Flip(screen) != -1);
}



When I'm debugging, and I try to step into the function (F11 with Visual Studio 2005 Version 8), it skips to the next line in the code. This also happens in another function:
RETURN_CODE Board::DrawBoard(Draw_Engine& DE)
{
	/*
		.O.O.O.O
		O.O.O.O.
		.O.O.O.O
		 . . . .
		. . . . 
		X.X.X.X.
		.X.X.X.X
		X.X.X.X.
	*/

	DE.Blit_Image(board_image);

	for(i = 0; i < p_pieces.size(); ++i) {
		DE.Blit_Image(p_pieces.image);
	}

	for(i = 0; i < c_pieces.size(); ++i) {
		DE.Blit_Image(c_pieces.image);
	}

	if(!DE.Draw_Screen()) { //HERE
		return EXIT_GAME;
	}

	return SUCCESSFUL;
}



I'm clueless as to why this is happening. I questioned the return line in Draw_Screen, but it seems to be right. Can anyone shed some light? :D

Share this post


Link to post
Share on other sites
Advertisement
Are you compiling in Debug mode or Release mode? I'd guess the latter, in which case, the debugger lies in Release mode about where in your code the execution is happening because of code optimization.

-me

Share this post


Link to post
Share on other sites
Oh, god. Thanks for that!

Only problem is, I get this error:
Error	1	error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: class Piece & __thiscall std::vector<class Piece,class std::allocator<class Piece> >::operator[](unsigned int)" (??A?$vector@VPiece@@V?$allocator@VPiece@@@std@@@std@@QAEAAVPiece@@I@Z)	Board.obj



Which I also had problems with in this thread:
http://www.gamedev.net/community/forums/topic.asp?topic_id=456465. I gotta read that guy's replies... I haven't seen those replies yet.

Share this post


Link to post
Share on other sites
In debug mode, you need to link with debug libraries. I don't know what graphics library you are using, but it comes with debug libraries, so set up the configuration to use them.

-me

Share this post


Link to post
Share on other sites
The solution to the problem was:

Project > Properties > Configuration Properties > C/C++ > Code Generation > Runtime Library > Multi-threaded Debug DLL (/MDd)

and

Project > Properties > Configuration Properties > Linker > Input > Additional Dependencies > msvcrtd.lib

and

Project > Properties > Configuration Properties > Linker > Input > Ignore Specific Library > msvcrt.lib

Thanks.

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!