Need help creating some sort of chunk/tile get feature.



using ChunkXY = std::pair< int, int >;

ChunkXY GetChunkXYFromLocation(int pos_x, int pos_y)
{
   ChunkXY result;
   result.first = ( pos_x < 0 ? ( pos_x >= -ChunkSize ? -1 : pos_x / ChunkSize - 1 ) : ( pos_x < ChunkSize ? 1 : pos_x / ChunkSize + 1 ) );
   result.second = ( pos_y < 0 ? ( pos_y >= -ChunkSize ? -1 : pos_y / ChunkSize - 1 ) : ( pos_y < ChunkSize ? 1 : pos_y / ChunkSize + 1 ) );
   return result;
}


BTW Using signed ints and omitting 0 is not the best idea.