Exemple #1
0
void MapTests::makeVisionBlockerArray(const coord& origin, bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS], const int MAX_VISION_RANMGE) {
  const int X0 = max(0, origin.x - MAX_VISION_RANMGE - 1);
  const int Y0 = max(0, origin.y - MAX_VISION_RANMGE - 1);
  const int X1 = min(MAP_X_CELLS - 1, origin.x + MAX_VISION_RANMGE + 1);
  const int Y1 = min(MAP_Y_CELLS - 1, origin.y + MAX_VISION_RANMGE + 1);

  for(int y = Y0; y <= Y1; y++) {
    for(int x = X0; x <= X1; x++) {
      arrayToFill[x][y] = eng->map->featuresStatic[x][y]->isVisionPassable() == false;
    }
  }

  const unsigned int FEATURE_MOBS_SIZE = eng->gameTime->getFeatureMobsSize();
  int x = 0;
  int y = 0;
  FeatureMob* f = NULL;
  for(unsigned int i = 0; i < FEATURE_MOBS_SIZE; i++) {
    f = eng->gameTime->getFeatureMobAt(i);
    x = f->getX();
    y = f->getY();
    if(arrayToFill[x][y] == false) {
      arrayToFill[x][y] = f->isVisionPassable() == false;
    }
  }
}
Exemple #2
0
bool BlocksVision::check(const FeatureMob& f) const {
  return f.isVisionPassable() == false;
}