Integer precision in GuiRTSTSCtrl::onMouseDown script callback
by Andrew Haydn Grant · in RTS Starter Kit · 05/24/2005 (4:14 pm) · 0 replies
In GuiRTSTSCtrl::on3DMouseDown(), and several other similar functions, the C++ code calls a similar GuiRTSTSCtrl script handler with information about *where* (in world space) the object was clicked. The data is garnered through a raycast, and seems pretty precise. However, when passing the ray collision data down to script, the code calls Con::getIntArg() instead of Con::getFloatArg() for the coordinates. These calls result in a loss of precision on the script side.
This is pretty minor, and easily fixed by replacing getIntArg with getFloatArg.
This fix could, however, change some RTS behaviors in code that currently uses this information with the lower precision.
This is pretty minor, and easily fixed by replacing getIntArg with getFloatArg.
This fix could, however, change some RTS behaviors in code that currently uses this information with the lower precision.
About the author