MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / setTileNeighbors

Method setTileNeighbors

source/gamemap/TileContainer.cpp:385–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385void TileContainer::setTileNeighbors(Tile *t)
386{
387 for (unsigned int i = 0; i < 2; ++i)
388 {
389 int tempX = t->getX(), tempY = t->getY();
390 switch (i)
391 {
392 case 0:
393 --tempX;
394 break;
395 case 1:
396 --tempY;
397 break;
398
399 default:
400 OD_LOG_ERR("Unknown neighbor index=" + Helper::toString(i));
401 continue;
402 }
403
404 // If the current neigbor tile exists, add the current tile as one of its
405 // neighbors and add it as one of the current tile's neighbors.
406 if (tempX >= 0 && tempY >= 0)
407 {
408 Tile *tempTile = getTile(tempX, tempY);
409 tempTile->addNeighbor(t);
410 t->addNeighbor(tempTile);
411 }
412 }
413}
414
415void TileContainer::tileToPacket(ODPacket& packet, Tile* tile) const
416{

Callers

nothing calls this directly

Calls 4

addNeighborMethod · 0.80
toStringFunction · 0.50
getXMethod · 0.45
getYMethod · 0.45

Tested by

no test coverage detected