Esempio n. 1
0
Level::Level(Table<PSquare> s, Model* m, vector<Location*> l, const string& message, const string& n,
    Table<CoverInfo> covers) 
    : squares(std::move(s)), oldSquares(squares.getBounds()), locations(l), model(m), entryMessage(message),
      name(n), coverInfo(std::move(covers)), bucketMap(squares.getBounds().getW(), squares.getBounds().getH(),
      FieldOfView::sightRange), lightAmount(squares.getBounds(), 0), lightCapAmount(squares.getBounds(), 1) {
  for (Vec2 pos : squares.getBounds()) {
    squares[pos]->setLevel(this);
    optional<pair<StairDirection, StairKey>> link = squares[pos]->getLandingLink();
    if (link)
      landingSquares[*link].push_back(pos);
  }
  for (Location *l : locations)
    l->setLevel(this);
  for (VisionId vision : ENUM_ALL(VisionId))
    fieldOfView[vision] = FieldOfView(squares, vision);
  for (Vec2 pos : squares.getBounds())
    addLightSource(pos, squares[pos]->getLightEmission(), 1);
  updateSunlightMovement();
}
Esempio n. 2
0
void CreatureAttributes::consumeEffects(const EnumMap<LastingEffect, int>& effects) {
  for (LastingEffect effect : ENUM_ALL(LastingEffect))
    if (effects[effect] > 0 && !isAffectedPermanently(effect) && consumeProb()) {
      addPermanentEffect(effect);
    }
}
Esempio n. 3
0
vector<PItem> Inventory::removeAllItems() {
  itemsCache.clear();
  for (ItemIndex ind : ENUM_ALL(ItemIndex))
    indexes[ind] = none;
  return std::move(items);
}
Esempio n. 4
0
void Options::writeValues(const EnumMap<OptionId, Value>& values) {
  ofstream out(filename);
  for (OptionId id : ENUM_ALL(OptionId))
    out << EnumInfo<OptionId>::getString(id) << "," << values[id] << std::endl;
}
Esempio n. 5
0
void Statistics::clear() {
  for (StatId id : ENUM_ALL(StatId))
    count[id] = 0;
}
Esempio n. 6
0
void Options::writeValues() {
  ofstream out(filename);
  for (OptionId id : ENUM_ALL(OptionId))
    out << EnumInfo<OptionId>::getString(id) << "," << (*values)[id] << std::endl;
}
Esempio n. 7
0
void FXManager::initializeTextureDefs() {
  for (auto name : ENUM_ALL(TextureName)) {
    initializeTextureDef(name, textureDefs[name]);
    textureDefs[name].validate();
  }
}