1
0
forked from 0ad/0ad
0ad/source/graphics/MiniPatch.cpp
janwas a34b759720 . split up lib.h/.cpp, include the remnants from PCH, remove (pretty much universal) include of it.
. timer, config: fix definition of ALLOW_RDTSC
. add movsx_be64 (for whirlpool), revise implementation, move to
byte_order, add test
. MAX -> std::max, remove those macros
. add timestamp to system_info as requested by philip

This was SVN commit r5050.
2007-05-09 21:01:11 +00:00

40 lines
1.1 KiB
C++

/**
* =========================================================================
* File : MiniPatch.cpp
* Project : 0 A.D.
* Description : Definition of a single terrain tile
* =========================================================================
*/
#include "precompiled.h"
#include "Patch.h"
#include "MiniPatch.h"
#include "Terrain.h"
///////////////////////////////////////////////////////////////////////////////
// Constructor
CMiniPatch::CMiniPatch() : Tex1(0), Tex1Priority(0), m_Parent(0)
{
}
///////////////////////////////////////////////////////////////////////////////
// Destructor
CMiniPatch::~CMiniPatch()
{
}
///////////////////////////////////////////////////////////////////////////////
// GetTileIndex: get the index of this tile in the root terrain object;
// on return, parameters x,y contain index in [0,MapSize)
void CMiniPatch::GetTileIndex(u32& x,u32& z)
{
const ptrdiff_t tindex = this - &m_Parent->m_MiniPatches[0][0];
x=(m_Parent->m_X*PATCH_SIZE)+tindex%PATCH_SIZE;
z=(m_Parent->m_Z*PATCH_SIZE)+tindex/PATCH_SIZE;
}