| 1187 | |
| 1188 | |
| 1189 | bool Tile::addEntity(GameEntity *entity) |
| 1190 | { |
| 1191 | if(std::find(mEntitiesInTile.begin(), mEntitiesInTile.end(), entity) != mEntitiesInTile.end()) |
| 1192 | { |
| 1193 | OD_LOG_ERR(getGameMap()->serverStr() + "Trying to insert twice entity=" + entity->getName() + " on tile=" + Tile::displayAsString(this)); |
| 1194 | return false; |
| 1195 | } |
| 1196 | |
| 1197 | mEntitiesInTile.push_back(entity); |
| 1198 | if(!getGameMap()->isServerGameMap()) |
| 1199 | { |
| 1200 | // On client side, we cull any movable entity that walks over a |
| 1201 | // culled tile (or show it if it was previously culled and walks |
| 1202 | // over a non culled tile) |
| 1203 | entity->setParentNodeDetachFlags( |
| 1204 | EntityParentNodeAttach::DETACH_CULLING, mTileCulling == CullingType::HIDE); |
| 1205 | } |
| 1206 | fireTileStateChanged(); |
| 1207 | return true; |
| 1208 | } |
| 1209 | |
| 1210 | void Tile::removeEntity(GameEntity *entity) |
| 1211 | { |
no test coverage detected