A small script to calculate total units of distance between two vector entities. Especially useful in games and grid snaps, inventory snaps etc..
typedef struct COORD
{
int X, Y;
} coord;
int get_dist (coord entity1, coord entity2)
{
int minuendX = max(entity1.X, entity2.X);
int minuendY = max(entity2.Y, entity2.Y);
int subtrahendX = min(entity1.X, entity2.X);
int subtrahendY = min(entity2.Y, entity2.Y);
return (minuendX - subtrahendX) + (minuendY - subtrahendY);
}