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

Method tryDrop

source/entities/TreasuryObject.cpp:151–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151bool TreasuryObject::tryDrop(Seat* seat, Tile* tile)
152{
153 if (tile->isFullTile())
154 return false;
155
156 // In editor mode, we allow to drop an object in dirt, claimed or gold tiles
157 if(getGameMap()->isInEditorMode() &&
158 (tile->getTileVisual() == TileVisual::dirtGround || tile->getTileVisual() == TileVisual::goldGround || tile->getTileVisual() == TileVisual::rockGround))
159 {
160 return true;
161 }
162
163 // we cannot drop an object on a tile we don't see
164 if(!seat->hasVisionOnTile(tile))
165 return false;
166
167 // Otherwise, we allow to drop an object only on allied claimed tiles
168 if(tile->isClaimedForSeat(seat))
169 return true;
170
171 return false;
172}
173
174void TreasuryObject::addEntityToPositionTile()
175{

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected