mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-11-21 23:13:53 +01:00
Added sorting of blocks.
This commit is contained in:
parent
0b9adc95b7
commit
231f48c529
@ -235,9 +235,22 @@ void TileGenerator::renderMap()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::list<int> zlist = getZValueList();
|
std::list<int> zlist = getZValueList();
|
||||||
for (std::list<int>::iterator position = zlist.begin(); position != zlist.end(); ++position) {
|
for (std::list<int>::iterator zPosition = zlist.begin(); zPosition != zlist.end(); ++zPosition) {
|
||||||
int zPos = *position;
|
int zPos = *zPosition;
|
||||||
getBlocksOnZ(zPos, statement);
|
map<int, BlockList> blocks = getBlocksOnZ(zPos, statement);
|
||||||
|
for (std::list<std::pair<int, int> >::const_iterator position = m_positions.begin(); position != m_positions.end(); ++position) {
|
||||||
|
if (position->second != zPos) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int xPos = position->first;
|
||||||
|
blocks[xPos].sort();
|
||||||
|
const BlockList &blockStack = blocks[xPos];
|
||||||
|
for (BlockList::const_iterator it = blockStack.begin(); it != blockStack.end(); ++it) {
|
||||||
|
std::cout << it->first.y << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << "---" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,28 @@ struct BlockPos {
|
|||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
int z;
|
int z;
|
||||||
|
bool operator<(const BlockPos& p) const
|
||||||
|
{
|
||||||
|
if (z > p.z) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (z < p.z) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (y > p.y) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (y < p.y) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x > p.x) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (x < p.x) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DbError {
|
class DbError {
|
||||||
|
Loading…
Reference in New Issue
Block a user