MCPcopy Create free account
hub / github.com/SimHacker/micropolis / canDriveOn

Method canDriveOn

MicropolisCore/src/MicropolisEngine/src/sprite.cpp:1621–1641  ·  view source on GitHub ↗

* Can one drive at the specified tile? * @param x X coordinate at map. * @param y Y coordinate at map. * @return 0 if not, 1 if you can, -1 otherwise */

Source from the content-addressed store, hash-verified

1619 * @return 0 if not, 1 if you can, -1 otherwise
1620 */
1621int Micropolis::canDriveOn(int x, int y)
1622{
1623 int tile;
1624
1625 if (!testBounds(x, y)) {
1626 return 0;
1627 }
1628
1629 tile = map[x][y] & LOMASK;
1630
1631 if ((tile >= ROADBASE && tile <= LASTROAD && tile != BRWH && tile != BRWV)
1632 || tile == HRAILROAD || tile == VRAILROAD) {
1633 return 1;
1634 }
1635
1636 if (tile == DIRT || tally(tile)) {
1637 return -1;
1638 }
1639
1640 return 0;
1641}
1642
1643
1644/**

Callers

nothing calls this directly

Calls 2

testBoundsFunction · 0.85
tallyFunction · 0.85

Tested by

no test coverage detected