GarageGames / Torque3D

MIT Licensed Open Source version of Torque 3D from GarageGames
http://torque3d.org
MIT License
3.35k stars 1.2k forks source link

Fix for bug in GFXVideoMode::parseFromString() #2265

Closed OTHGMars closed 6 years ago

OTHGMars commented 6 years ago

When testing PR #2264 I discovered that GFXVideoMode::parseFromString() will never assign false to the fullScreen value. That value must be initialized to false going in. I found it hard to believe that that could be the case and not have caused a problem before now, so I dropped:

   GFXVideoMode vmTest = GFXInit::getDesktopResolution();
   vmTest.fullScreen = true;
   vmTest.parseFromString("800 600 false 32 60");
   Con::printf("%s becomes %s", "800 600 false 32 60", vmTest.toString().c_str());

into the end of _GFXInitGetInitialRes() and the output string is: 800 600 false 32 60 becomes 800 600 true 32 60 0

None of the values get assigned by the macro here if their function evaluates to zero or the token is missing from the string. This commit corrects that for the boolean case to only skip the assignment if the string token is not found.

chaigler commented 6 years ago

Good catch!