diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/public/disp_vertindex.h | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/public/disp_vertindex.h')
| -rw-r--r-- | mp/src/public/disp_vertindex.h | 300 |
1 files changed, 150 insertions, 150 deletions
diff --git a/mp/src/public/disp_vertindex.h b/mp/src/public/disp_vertindex.h index 42e26961..4d82cf25 100644 --- a/mp/src/public/disp_vertindex.h +++ b/mp/src/public/disp_vertindex.h @@ -1,150 +1,150 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-
-#ifndef DISP_VERTINDEX_H
-#define DISP_VERTINDEX_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-
-#include "tier0/dbg.h"
-
-
-// ------------------------------------------------------------------------ //
-// Helper class used for indexing vertices in the 2D grid.
-// ------------------------------------------------------------------------ //
-
-class CVertIndex
-{
-public:
- CVertIndex();
- CVertIndex( short ix, short iy );
-
- void Init( short ix, short iy );
-
- short& operator[]( short i );
- short const& operator[]( short i ) const;
- void operator+=( CVertIndex const &other );
- void operator-=( CVertIndex const &other );
- CVertIndex operator+( CVertIndex const &other ) const;
- CVertIndex operator-( CVertIndex const &other ) const;
- void operator<<=( int shift );
- void operator>>=( int shift );
- bool operator==( CVertIndex const &other ) const;
- bool operator!=( CVertIndex const &other ) const;
-
-
-public:
-
- short x, y;
-};
-
-
-// ------------------------------------------------------------------ //
-// Helper functions.
-// ------------------------------------------------------------------ //
-
-inline CVertIndex BuildOffsetVertIndex(
- CVertIndex const &nodeIndex,
- CVertIndex const &offset,
- int mul )
-{
- return CVertIndex( nodeIndex.x + offset.x * mul, nodeIndex.y + offset.y * mul );
-}
-
-
-// ------------------------------------------------------------------ //
-// CVertIndex inlines.
-// ------------------------------------------------------------------ //
-
-inline CVertIndex::CVertIndex()
-{
-}
-
-
-inline CVertIndex::CVertIndex( short ix, short iy )
-{
- x = ix;
- y = iy;
-}
-
-
-inline void CVertIndex::Init( short ix, short iy )
-{
- x = ix;
- y = iy;
-}
-
-
-inline short& CVertIndex::operator[]( short i )
-{
- Assert( i >= 0 && i <= 1 );
- return ((short*)this)[i];
-}
-
-
-inline short const& CVertIndex::operator[]( short i ) const
-{
- Assert( i >= 0 && i <= 1 );
- return ((short*)this)[i];
-}
-
-
-inline void CVertIndex::operator+=( CVertIndex const &other )
-{
- x += other.x;
- y += other.y;
-}
-
-
-inline void CVertIndex::operator-=( CVertIndex const &other )
-{
- x -= other.x;
- y -= other.y;
-}
-
-
-inline CVertIndex CVertIndex::operator+( CVertIndex const &other ) const
-{
- return CVertIndex( x + other.x, y + other.y );
-}
-
-
-inline CVertIndex CVertIndex::operator-( CVertIndex const &other ) const
-{
- return CVertIndex( x - other.x, y - other.y );
-}
-
-
-inline void CVertIndex::operator<<=( int shift )
-{
- x <<= shift;
- y <<= shift;
-}
-
-
-inline void CVertIndex::operator>>=( int shift )
-{
- x >>= shift;
- y >>= shift;
-}
-
-
-inline bool CVertIndex::operator==( CVertIndex const &other ) const
-{
- return x==other.x && y==other.y;
-}
-
-
-inline bool CVertIndex::operator!=( CVertIndex const &other ) const
-{
- return x!=other.x || y!=other.y;
-}
-
-
-#endif // DISP_VERTINDEX_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef DISP_VERTINDEX_H +#define DISP_VERTINDEX_H +#ifdef _WIN32 +#pragma once +#endif + + +#include "tier0/dbg.h" + + +// ------------------------------------------------------------------------ // +// Helper class used for indexing vertices in the 2D grid. +// ------------------------------------------------------------------------ // + +class CVertIndex +{ +public: + CVertIndex(); + CVertIndex( short ix, short iy ); + + void Init( short ix, short iy ); + + short& operator[]( short i ); + short const& operator[]( short i ) const; + void operator+=( CVertIndex const &other ); + void operator-=( CVertIndex const &other ); + CVertIndex operator+( CVertIndex const &other ) const; + CVertIndex operator-( CVertIndex const &other ) const; + void operator<<=( int shift ); + void operator>>=( int shift ); + bool operator==( CVertIndex const &other ) const; + bool operator!=( CVertIndex const &other ) const; + + +public: + + short x, y; +}; + + +// ------------------------------------------------------------------ // +// Helper functions. +// ------------------------------------------------------------------ // + +inline CVertIndex BuildOffsetVertIndex( + CVertIndex const &nodeIndex, + CVertIndex const &offset, + int mul ) +{ + return CVertIndex( nodeIndex.x + offset.x * mul, nodeIndex.y + offset.y * mul ); +} + + +// ------------------------------------------------------------------ // +// CVertIndex inlines. +// ------------------------------------------------------------------ // + +inline CVertIndex::CVertIndex() +{ +} + + +inline CVertIndex::CVertIndex( short ix, short iy ) +{ + x = ix; + y = iy; +} + + +inline void CVertIndex::Init( short ix, short iy ) +{ + x = ix; + y = iy; +} + + +inline short& CVertIndex::operator[]( short i ) +{ + Assert( i >= 0 && i <= 1 ); + return ((short*)this)[i]; +} + + +inline short const& CVertIndex::operator[]( short i ) const +{ + Assert( i >= 0 && i <= 1 ); + return ((short*)this)[i]; +} + + +inline void CVertIndex::operator+=( CVertIndex const &other ) +{ + x += other.x; + y += other.y; +} + + +inline void CVertIndex::operator-=( CVertIndex const &other ) +{ + x -= other.x; + y -= other.y; +} + + +inline CVertIndex CVertIndex::operator+( CVertIndex const &other ) const +{ + return CVertIndex( x + other.x, y + other.y ); +} + + +inline CVertIndex CVertIndex::operator-( CVertIndex const &other ) const +{ + return CVertIndex( x - other.x, y - other.y ); +} + + +inline void CVertIndex::operator<<=( int shift ) +{ + x <<= shift; + y <<= shift; +} + + +inline void CVertIndex::operator>>=( int shift ) +{ + x >>= shift; + y >>= shift; +} + + +inline bool CVertIndex::operator==( CVertIndex const &other ) const +{ + return x==other.x && y==other.y; +} + + +inline bool CVertIndex::operator!=( CVertIndex const &other ) const +{ + return x!=other.x || y!=other.y; +} + + +#endif // DISP_VERTINDEX_H |