| 574 | #define OBJ_HEIGHT_SOLDIER 0.5 |
| 575 | |
| 576 | void OperField::CreateField(int mask) |
| 577 | { |
| 578 | OperItem* item; |
| 579 | int ix, iz, i; |
| 580 | const float maxWater = -0.5; |
| 581 | for (iz = 0; iz < OperItemRange; iz++) |
| 582 | { |
| 583 | for (ix = 0; ix < OperItemRange; ix++) |
| 584 | { |
| 585 | item = &_items[iz][ix]; |
| 586 | item->_searchID = 0; |
| 587 | item->_type = OITNormal; |
| 588 | item->_typeSoldier = OITNormal; |
| 589 | if (mask & MASK_USE_BUFFER) |
| 590 | { |
| 591 | // sample center of the grid squares |
| 592 | float xt = _x * LandGrid + ix * OperItemGrid + OperItemGrid * 0.5f; |
| 593 | float zt = _z * LandGrid + iz * OperItemGrid + OperItemGrid * 0.5f; |
| 594 | // note: all samples are in the same grid |
| 595 | // SurfaceY may be optimized for contant grid |
| 596 | float yt = GLandscape->SurfaceY(xt, zt); |
| 597 | if (yt < maxWater) |
| 598 | { |
| 599 | item->_typeSoldier = OITWater; |
| 600 | item->_type = OITWater; |
| 601 | } |
| 602 | } |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | Object* obj; |
| 607 | // avoid |
| 608 | for (ix = _x - 1; ix <= _x + 1; ix++) |
| 609 | { |
| 610 | for (iz = _z - 1; iz <= _z + 1; iz++) |
| 611 | { |
| 612 | if (InRange(ix, iz)) |
| 613 | { |
| 614 | const ObjectList& list = GLOB_LAND->GetObjects(iz, ix); |
| 615 | for (i = 0; i < list.Size(); i++) |
| 616 | { |
| 617 | obj = list[i]; |
| 618 | if (obj == nullptr) |
| 619 | { |
| 620 | continue; |
| 621 | } |
| 622 | LODShape* shape = obj->GetShape(); |
| 623 | if (!shape) |
| 624 | { |
| 625 | continue; |
| 626 | } |
| 627 | if (obj->GetMass() < 5.0) |
| 628 | { |
| 629 | continue; |
| 630 | } |
| 631 | if (!obj->HasGeometry()) |
| 632 | { |
| 633 | continue; |
nothing calls this directly
no test coverage detected