コード例 #1
0
ファイル: Animal.cpp プロジェクト: Panzerschrek/FREG-3d_2.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
ファイル: Active.cpp プロジェクト: mmaulwurff/FREG
void Active::DamageAround() const {
    const AroundCoordinates arounds(X(), Y(), Z());
    for (const XyzInt& xyz : arounds) {
        TryDestroy(XYZ(xyz));
    }
}