FreeFalcon / freefalcon-central

A campaign based, multiplayer, open source flight simulator.
http://freefalcon.org/
BSD 2-Clause "Simplified" License
153 stars 98 forks source link

Strange program behavior in "Renderow" class and it's father and son classes #21

Closed PlutoniumHeart closed 11 years ago

PlutoniumHeart commented 11 years ago

Assignment operations to it's member variables are not done correctly, some of the variables are not even showing up in the debug watch. Never seem anything like this before, not sure if it's compiler's error or there's something wrong with the code, not sure how to fix.

PeterMeyer commented 11 years ago

Can you just provide an Codeline wich Members are not shown in the Watchlist? Is there an $IFDEF Block who behaves other in Debug as in the Release build?

PlutoniumHeart commented 11 years ago

@PeterMeyer I am not sure how to cite a line of code here, but you can start your VS 2010 debugger and go to the line "viewpoint = vp" in "void RenderOTW::Setup(ImageBuffer imageBuffer, RViewPoint vp)" inside file "OTW.cpp" you can see that the assignment failed silently, without any warning error, it just ran right pass it with appearently nothing done. If you declare some test code in this class, and try to initialize it in the constructor or assign it some value, the best thing can happen is that you don't see the variable show up in the watch, or see it showing up with a wrong value. The worst thing is that your test variable won't be correctly assigned anything just like the "viewpoint". This is not just happening in this specific class, I have also seem it in it's father classes.

vinnydiehl commented 11 years ago

@PlutoniumHeart To share a line of code, just browse to it on GitHub, click the line number that you want, and it'll highlight the line and add something like #L32 to the location bar. You can copy that URL and share it. To highlight a range of lines, you can make it something like, for example, #L32-35.

Instead of browsing directly on the develop branch, I'd recommend browsing the code of the latest commit for it, that way if we look back on these issues in the future, the file won't have changed, making the line number reference incorrect.

PlutoniumHeart commented 11 years ago

@PeterMeyer @gbchaosmaster OK, see this line of code, this is the part that things starting to get weird, well, actually it starts to go wrong from the constructor, but this should give you the idea any way. Check here

PlutoniumHeart commented 11 years ago

OK, I figure it out! It was the Struct Member Alignment problem, for the project "Weather" it was set to use "4 Byte", change it to "Default" solves the problem.

If you changed that the current code can give you a version of FF that allows you to enter the 3D world after ignoring a dozen assertion failures, and in the 3D world, you can see the terrain, but not the cockpit, and "ESC" button does not work either.

Reference

vinnydiehl commented 11 years ago

Reopening this for now, push your fix to a feature branch and I'll close this from a merge commit, that way everything is documented.

PlutoniumHeart commented 11 years ago

@gbchaosmaster Can this VS configuration change be pushed to the GIT?

vinnydiehl commented 11 years ago

Yep, it worked.

PeterMeyer commented 11 years ago

Hmm strange. I set this Param because in the old Code it was 4 Bytes to. I hope this will not brake any cross Subproject references who using EXTERNAL Anyway. It seems it works for now.