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

Method tryDrop

source/entities/Creature.cpp:2157–2180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2155}
2156
2157bool Creature::tryDrop(Seat* seat, Tile* tile)
2158{
2159 // check whether the tile is a ground tile ...
2160 if(tile->isFullTile())
2161 return false;
2162
2163 // In editor mode, we allow creatures to be dropped anywhere they can walk
2164 if(getGameMap()->isInEditorMode() && canGoThroughTile(tile))
2165 return true;
2166
2167 // we cannot drop a creature on a tile we don't see
2168 if(!seat->hasVisionOnTile(tile))
2169 return false;
2170
2171 // If it is a worker, he can be dropped on dirt
2172 if (getDefinition()->isWorker() && (tile->getTileVisual() == TileVisual::dirtGround || tile->getTileVisual() == TileVisual::goldGround))
2173 return true;
2174
2175 // Every creature can be dropped on allied claimed tiles
2176 if(tile->isClaimedForSeat(seat))
2177 return true;
2178
2179 return false;
2180}
2181
2182void Creature::drop(const Ogre::Vector3& v)
2183{

Callers

nothing calls this directly

Calls 6

isFullTileMethod · 0.80
isInEditorModeMethod · 0.80
hasVisionOnTileMethod · 0.80
isWorkerMethod · 0.80
getTileVisualMethod · 0.80
isClaimedForSeatMethod · 0.80

Tested by

no test coverage detected