| 401 | |
| 402 | template <typename GetTileFunction> |
| 403 | pair<TileModificationList, TileModificationList> splitTileModifications(EntityMapPtr const& entityMap, TileModificationList const& modificationList, |
| 404 | bool allowEntityOverlap, GetTileFunction& getTile, function<bool(Vec2I pos, TileModification modification)> extraCheck) { |
| 405 | TileModificationList success; |
| 406 | TileModificationList unknown; |
| 407 | TileModificationList failures; |
| 408 | for (auto const& pair : modificationList) { |
| 409 | |
| 410 | bool good = false, perhaps = false; |
| 411 | if (!extraCheck || extraCheck(pair.first, pair.second)) |
| 412 | std::tie(good, perhaps) = validateTileModification(entityMap, pair.first, pair.second, allowEntityOverlap, getTile); |
| 413 | |
| 414 | if (good) |
| 415 | success.append(pair); |
| 416 | else if (perhaps) |
| 417 | unknown.append(pair); |
| 418 | else |
| 419 | failures.append(pair); |
| 420 | } |
| 421 | |
| 422 | if (!success.empty()) |
| 423 | success.appendAll(unknown); |
| 424 | else |
| 425 | failures.appendAll(unknown); |
| 426 | |
| 427 | return {success, failures}; |
| 428 | } |
| 429 | |
| 430 | template <typename TileSectorArray> |
| 431 | float windLevel(shared_ptr<TileSectorArray> const& tileSectorArray, Vec2F const& position, float weatherWindLevel) { |
no test coverage detected