Skip to content

Commit

Permalink
Remove some unused coordinate_conversion functions
Browse files Browse the repository at this point in the history
Remove all the ones taking separate int arguments and returning a new
point.

Callers of these have all been converted to use the point versions, so
these can now be removed.

Except that the point versions were still written in terms of them, so
those needed tweaking.
  • Loading branch information
jbytheway committed Apr 18, 2020
1 parent 85e550c commit b0060fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 58 deletions.
32 changes: 16 additions & 16 deletions src/coordinate_conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ static int divide( int v, int m, int &r )
return result;
}

point omt_to_om_copy( int x, int y )
point omt_to_om_copy( const point &p )
{
return point( divide( x, OMAPX ), divide( y, OMAPY ) );
return point( divide( p.x, OMAPX ), divide( p.y, OMAPY ) );
}

tripoint omt_to_om_copy( const tripoint &p )
Expand All @@ -43,9 +43,9 @@ point om_to_omt_copy( const point &p )
return point( p.x * OMAPX, p.y * OMAPY );
}

point sm_to_omt_copy( int x, int y )
point sm_to_omt_copy( const point &p )
{
return point( divide( x, 2 ), divide( y, 2 ) );
return point( divide( p.x, 2 ), divide( p.y, 2 ) );
}

tripoint sm_to_omt_copy( const tripoint &p )
Expand All @@ -64,9 +64,9 @@ point sm_to_omt_remain( int &x, int &y )
return point( divide( x, 2, x ), divide( y, 2, y ) );
}

point sm_to_om_copy( int x, int y )
point sm_to_om_copy( const point &p )
{
return point( divide( x, 2 * OMAPX ), divide( y, 2 * OMAPY ) );
return point( divide( p.x, 2 * OMAPX ), divide( p.y, 2 * OMAPY ) );
}

tripoint sm_to_om_copy( const tripoint &p )
Expand All @@ -90,9 +90,9 @@ point omt_to_ms_copy( const point &p )
return point( p.x * 2 * SEEX, p.y * 2 * SEEY );
}

point omt_to_sm_copy( int x, int y )
point omt_to_sm_copy( const point &p )
{
return point( x * 2, y * 2 );
return point( p.x * 2, p.y * 2 );
}

tripoint omt_to_sm_copy( const tripoint &p )
Expand All @@ -106,9 +106,9 @@ void omt_to_sm( int &x, int &y )
y *= 2;
}

point om_to_sm_copy( int x, int y )
point om_to_sm_copy( const point &p )
{
return point( x * 2 * OMAPX, y * 2 * OMAPX );
return point( p.x * 2 * OMAPX, p.y * 2 * OMAPX );
}

tripoint om_to_sm_copy( const tripoint &p )
Expand All @@ -122,9 +122,9 @@ void om_to_sm( int &x, int &y )
y *= 2 * OMAPY;
}

point ms_to_sm_copy( int x, int y )
point ms_to_sm_copy( const point &p )
{
return point( divide( x, SEEX ), divide( y, SEEY ) );
return point( divide( p.x, SEEX ), divide( p.y, SEEY ) );
}

tripoint ms_to_sm_copy( const tripoint &p )
Expand All @@ -143,9 +143,9 @@ point ms_to_sm_remain( int &x, int &y )
return point( divide( x, SEEX, x ), divide( y, SEEY, y ) );
}

point sm_to_ms_copy( int x, int y )
point sm_to_ms_copy( const point &p )
{
return point( x * SEEX, y * SEEY );
return point( p.x * SEEX, p.y * SEEY );
}

tripoint sm_to_ms_copy( const tripoint &p )
Expand All @@ -159,9 +159,9 @@ void sm_to_ms( int &x, int &y )
y *= SEEY;
}

point ms_to_omt_copy( int x, int y )
point ms_to_omt_copy( const point &p )
{
return point( divide( x, SEEX * 2 ), divide( y, SEEY * 2 ) );
return point( divide( p.x, SEEX * 2 ), divide( p.y, SEEY * 2 ) );
}

tripoint ms_to_omt_copy( const tripoint &p )
Expand Down
50 changes: 8 additions & 42 deletions src/coordinate_conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@
*/

// overmap terrain to overmap
point omt_to_om_copy( int x, int y );
inline point omt_to_om_copy( const point &p )
{
return omt_to_om_copy( p.x, p.y );
}
point omt_to_om_copy( const point &p );
tripoint omt_to_om_copy( const tripoint &p );
void omt_to_om( int &x, int &y );
inline void omt_to_om( point &p )
Expand All @@ -77,11 +73,7 @@ inline point omt_to_om_remain( point &p )
// overmap to overmap terrain
point om_to_omt_copy( const point &p );
// submap to overmap terrain
point sm_to_omt_copy( int x, int y );
inline point sm_to_omt_copy( const point &p )
{
return sm_to_omt_copy( p.x, p.y );
}
point sm_to_omt_copy( const point &p );
tripoint sm_to_omt_copy( const tripoint &p );
void sm_to_omt( int &x, int &y );
inline void sm_to_omt( point &p )
Expand All @@ -98,11 +90,7 @@ inline point sm_to_omt_remain( point &p )
return sm_to_omt_remain( p.x, p.y );
}
// submap to overmap, basically: x / (OMAPX * 2)
point sm_to_om_copy( int x, int y );
inline point sm_to_om_copy( const point &p )
{
return sm_to_om_copy( p.x, p.y );
}
point sm_to_om_copy( const point &p );
tripoint sm_to_om_copy( const tripoint &p );
void sm_to_om( int &x, int &y );
inline void sm_to_om( point &p )
Expand All @@ -119,17 +107,11 @@ inline point sm_to_om_remain( point &p )
return sm_to_om_remain( p.x, p.y );
}
// overmap terrain to submap, basically: x *= 2
point omt_to_sm_copy( int x, int y );

inline int omt_to_sm_copy( int a )
{
return 2 * a;
}

inline point omt_to_sm_copy( const point &p )
{
return omt_to_sm_copy( p.x, p.y );
}
point omt_to_sm_copy( const point &p );
tripoint omt_to_sm_copy( const tripoint &p );
void omt_to_sm( int &x, int &y );
inline void omt_to_sm( point &p )
Expand All @@ -143,11 +125,7 @@ inline void omt_to_sm( tripoint &p )
// overmap terrain to map square
point omt_to_ms_copy( const point &p );
// overmap to submap, basically: x *= 2 * OMAPX
point om_to_sm_copy( int x, int y );
inline point om_to_sm_copy( const point &p )
{
return om_to_sm_copy( p.x, p.y );
}
point om_to_sm_copy( const point &p );
tripoint om_to_sm_copy( const tripoint &p );
void om_to_sm( int &x, int &y );
inline void om_to_sm( point &p )
Expand All @@ -159,11 +137,7 @@ inline void om_to_sm( tripoint &p )
om_to_sm( p.x, p.y );
}
// map squares to submap, basically: x /= SEEX
point ms_to_sm_copy( int x, int y );
inline point ms_to_sm_copy( const point &p )
{
return ms_to_sm_copy( p.x, p.y );
}
point ms_to_sm_copy( const point &p );
tripoint ms_to_sm_copy( const tripoint &p );
void ms_to_sm( int &x, int &y );
inline void ms_to_sm( point &p )
Expand All @@ -186,11 +160,7 @@ inline tripoint ms_to_sm_remain( tripoint &p )
// submap back to map squares, basically: x *= SEEX
// Note: this gives you the map square coordinates of the top-left corner
// of the given submap.
point sm_to_ms_copy( int x, int y );
inline point sm_to_ms_copy( const point &p )
{
return sm_to_ms_copy( p.x, p.y );
}
point sm_to_ms_copy( const point &p );
tripoint sm_to_ms_copy( const tripoint &p );
void sm_to_ms( int &x, int &y );
inline void sm_to_ms( point &p )
Expand All @@ -202,11 +172,7 @@ inline void sm_to_ms( tripoint &p )
sm_to_ms( p.x, p.y );
}
// map squares to overmap terrain, basically: x /= SEEX * 2
point ms_to_omt_copy( int x, int y );
inline point ms_to_omt_copy( const point &p )
{
return ms_to_omt_copy( p.x, p.y );
}
point ms_to_omt_copy( const point &p );
tripoint ms_to_omt_copy( const tripoint &p );
void ms_to_omt( int &x, int &y );
inline void ms_to_omt( point &p )
Expand Down

0 comments on commit b0060fa

Please sign in to comment.