kora-bot/Source/CMap.cpp

18 lines
600 B
C++
Raw Normal View History

2023-04-10 23:31:02 +00:00
#include "CMap.h"
namespace { auto & map = BWEM::Map::Instance(); }
// gets the TilePosition of the center of an area
TilePosition CMap::getAreaAverage(const BWEM::Area* area)
{
int xAverage = (area->TopLeft().x + area->BottomRight().x) / 2;
int yAverage = (area->TopLeft().y + area->BottomRight().y) / 2;
return TilePosition(xAverage, yAverage);
}
TilePosition CMap::getAreaAverage(const BWEM::Area area)
{
int xAverage = (area.TopLeft().x + area.BottomRight().x) / 2;
int yAverage = (area.TopLeft().y + area.BottomRight().y) / 2;
return TilePosition(xAverage, yAverage);
}