| 477 | } |
| 478 | |
| 479 | void Terrain::AddPatch(const Int2& patchCoord) |
| 480 | { |
| 481 | auto patch = GetPatch(patchCoord); |
| 482 | if (patch != nullptr) |
| 483 | { |
| 484 | LOG(Warning, "Cannot add patch at {0}x{1}. The patch at the given location already exists.", patchCoord.X, patchCoord.Y); |
| 485 | return; |
| 486 | } |
| 487 | PROFILE_MEM(LevelTerrain); |
| 488 | if (_chunkSize == 0) |
| 489 | Setup(); |
| 490 | |
| 491 | patch = ::New<TerrainPatch>(); |
| 492 | patch->Init(this, patchCoord.X, patchCoord.Y); |
| 493 | _patches.Add(patch); |
| 494 | |
| 495 | CacheNeighbors(); |
| 496 | |
| 497 | if (IsDuringPlay()) |
| 498 | { |
| 499 | patch->UpdateTransform(); |
| 500 | patch->CreateCollision(); |
| 501 | UpdateLayerBits(); |
| 502 | } |
| 503 | |
| 504 | UpdateBounds(); |
| 505 | } |
| 506 | |
| 507 | void Terrain::RemovePatch(const Int2& patchCoord) |
| 508 | { |
nothing calls this directly
no test coverage detected