MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / blockage

Method blockage

src/Battlescape/TileEngine.cpp:1670–1783  ·  view source on GitHub ↗

* Calculates the amount this certain wall or floor-part of the tile blocks. * @param startTile The tile where the power starts. * @param part The part of the tile the power needs to go through. * @param type The type of power/damage. * @param direction Direction the power travels. * @return Amount of blockage. */

Source from the content-addressed store, hash-verified

1668 * @return Amount of blockage.
1669 */
1670int TileEngine::blockage(Tile *tile, const int part, ItemDamageType type, int direction, bool checkingFromOrigin)
1671{
1672 int blockage = 0;
1673
1674 if (tile == 0) return 0; // probably outside the map here
1675 if (tile->getMapData(part))
1676 {
1677 bool check = true;
1678 int wall = -1;
1679 if (direction != -1)
1680 {
1681 wall = tile->getMapData(MapData::O_OBJECT)->getBigWall();
1682
1683 if (checkingFromOrigin &&
1684 (wall == Pathfinding::BIGWALLNESW ||
1685 wall == Pathfinding::BIGWALLNWSE))
1686 {
1687 check = false;
1688 }
1689 switch (direction)
1690 {
1691 case 0: // north
1692 if (wall == Pathfinding::BIGWALLWEST ||
1693 wall == Pathfinding::BIGWALLEAST ||
1694 wall == Pathfinding::BIGWALLSOUTH ||
1695 wall == Pathfinding::BIGWALLEASTANDSOUTH)
1696 {
1697 check = false;
1698 }
1699 break;
1700 case 1: // north east
1701 if (wall == Pathfinding::BIGWALLWEST ||
1702 wall == Pathfinding::BIGWALLSOUTH)
1703 {
1704 check = false;
1705 }
1706 break;
1707 case 2: // east
1708 if (wall == Pathfinding::BIGWALLNORTH ||
1709 wall == Pathfinding::BIGWALLSOUTH ||
1710 wall == Pathfinding::BIGWALLWEST)
1711 {
1712 check = false;
1713 }
1714 break;
1715 case 3: // south east
1716 if (wall == Pathfinding::BIGWALLNORTH ||
1717 wall == Pathfinding::BIGWALLWEST)
1718 {
1719 check = false;
1720 }
1721 break;
1722 case 4: // south
1723 if (wall == Pathfinding::BIGWALLWEST ||
1724 wall == Pathfinding::BIGWALLEAST ||
1725 wall == Pathfinding::BIGWALLNORTH)
1726 {
1727 check = false;

Callers

nothing calls this directly

Calls 4

getBigWallMethod · 0.80
isUfoDoorOpenMethod · 0.80
getBlockMethod · 0.80
getMapDataMethod · 0.45

Tested by

no test coverage detected