Prototype/Source/Prototype/Private/Task_UpdateMap.cpp
/* Utility function to help translate coordinate to a grid.
*
*   @param pt Number to Snap.
*   @return Number Snaped to the nearest GRID_SIZE
*/
Utility function to help translate coordinate to a grid.
Utility function to help translate coordinate to a grid .
float SnapToGrid(float pt) {
    int tmpPt = static_cast<int>(pt);
    if (pt > 0) {
        return static_cast<float>(tmpPt - tmpPt % GRID_SIZE);
    }
    else if (pt < 0) {
        return static_cast<float>(tmpPt - (GRID_SIZE - abs(tmpPt) % GRID_SIZE));
    }
    else {
        return 0;
    }
}
float SnapToGrid ( float pt ) { int tmpPt = static_cast < int > ( pt ) ; if ( pt > 0 ) { return static_cast < float > ( tmpPt - tmpPt % GRID_SIZE ) ; } else if ( pt < 0 ) { return static_cast < float > ( tmpPt - ( GRID_SIZE - abs ( tmpPt ) % GRID_SIZE ) ) ; } else { return 0 ; } }
Utility function to help translate coordinate to a grid.
Utility function to help translate coordinate to a grid .