Jump to content

  • Log In with Google      Sign In   
  • Create Account

visual c++ version runs differently than the exe in explorer!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 tashaklikedi   Members   -  Reputation: 218

Like
0Likes
Like

Posted 10 April 2013 - 04:54 PM

Hello everyone, I have a strange issue ( noob programmer here )

Some of my game's collisions do not work when I click on the exe that is located in the "release" folder from windows explorer, but they work when I do "build and compile" from visual c++. I made sure I compiled in release mode, and the data folder is copy paste in both folders. 

I really don't understand. 



Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 14248

Like
0Likes
Like

Posted 10 April 2013 - 07:49 PM

That is because the working directory is different when you run from the debugger (it goes to the path of the solution).

You have 2 options:

1: Change the debugger settings to set the working directory to be the same as the executable‘s directory and then move all of your resources respectively.

2: Force the working directory for your executable to be that of the executable’s at run-time via SetCurrentDirectory() and then move all of your resources respectively.

 

 

L. Spiro


Edited by L. Spiro, 10 April 2013 - 07:49 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#3 tashaklikedi   Members   -  Reputation: 218

Like
0Likes
Like

Posted 11 April 2013 - 12:46 AM

I tried 1- and it didn't work.

the weird thing is, there is a defaults.sav file which holds all the default settings, which includes an entity which is an electric wire, which is supposed to be a solid body. It loads its sprite as it should, but it does not load its collisions... from the same file



#4 tashaklikedi   Members   -  Reputation: 218

Like
0Likes
Like

Posted 11 April 2013 - 01:08 AM

I found the problem: there is a bitwise flag that does not work in the actual exe:

 

it goes like: 

 

if(CEntityManager::currentMapEntities[i]->flags & ENTITY_GAIA) 

 

this condition is always negative in the original exe, but it works in debug mode. Why could this happen?



#5 L. Spiro   Crossbones+   -  Reputation: 14248

Like
3Likes
Like

Posted 11 April 2013 - 04:23 AM

If the problem is related to differences between release mode and debug mode, it is often related to uninitialized variables.

Check that it is initialized properly in all modes.

 

 

L. Spiro


It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#6 Grafalgar   Members   -  Reputation: 548

Like
0Likes
Like

Posted 11 April 2013 - 09:54 AM

Debug builds automatically initialize (or zero out) your variables for you, while Release builds retain whatever garbage value is presently set at that location in memory your variables refer to.

 

Whenever you create a new map entity object, set flags = 0 in the constructor.  That should do it.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS