Пример #1
0
 void Animal::EatGrass() {
     for (int x=X()-1; x<=X()+1; ++x)
     for (int y=Y()-1; y<=Y()+1; ++y) {
         if ( world->InBounds(x, y) &&
                 GREENERY == world->GetBlock(x, y, Z())->Sub() )
         {
             TryDestroy(x, y, Z());
             Eat(GREENERY);
             return;
         }
     }
 }
Пример #2
0
void Active::DamageAround() const {
    const AroundCoordinates arounds(X(), Y(), Z());
    for (const XyzInt& xyz : arounds) {
        TryDestroy(XYZ(xyz));
    }
}