mirror of
https://github.com/minetest/minetestmapper.git
synced 2025-07-28 13:30:19 +02:00
Add a test case for --drawplayers
(also fixes off-by-one error in clipping players to draw)
This commit is contained in:
@ -859,8 +859,8 @@ void TileGenerator::renderPlayers(const std::string &input_path)
|
||||
|
||||
PlayerAttributes players(input);
|
||||
for (auto &player : players) {
|
||||
if (player.x < m_xMin * 16 || player.x > m_xMax * 16 ||
|
||||
player.z < m_zMin * 16 || player.z > m_zMax * 16)
|
||||
if (player.x < m_xMin * 16 || player.x >= (m_xMax+1) * 16 ||
|
||||
player.z < m_zMin * 16 || player.z >= (m_zMax+1) * 16)
|
||||
continue;
|
||||
if (player.y < m_yMin || player.y > m_yMax)
|
||||
continue;
|
||||
@ -869,6 +869,7 @@ void TileGenerator::renderPlayers(const std::string &input_path)
|
||||
|
||||
m_image->drawFilledRect(imageX - 1, imageY, 3, 1, m_playerColor);
|
||||
m_image->drawFilledRect(imageX, imageY - 1, 1, 3, m_playerColor);
|
||||
assert(!player.name.empty());
|
||||
m_image->drawText(imageX + 2, imageY, player.name, m_playerColor);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user