Level::Level(Table<PSquare> s, Model* m, vector<Location*> l, const string& message, const string& n) : squares(std::move(s)), locations(l), model(m), entryMessage(message), name(n) { 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); fieldOfView.emplace_back(squares, VisionInfo::ELF); fieldOfView.emplace_back(squares, VisionInfo::NORMAL); }
Level::Level(Table<PSquare> s, Model* m, vector<Location*> l, const string& message, const string& n, Table<CoverInfo> covers) : squares(std::move(s)), 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) { 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 (Vision* vision : Vision::getAll()) fieldOfView.emplace(vision, FieldOfView(squares, vision)); for (Vec2 pos : squares.getBounds()) addLightSource(pos, squares[pos]->getLightEmission(), 1); }
Level::Level(Table<PSquare> s, Model* m, vector<Location*> l, const string& message, const string& n, Table<CoverInfo> covers, int id) : 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), levelId(id) { for (Vec2 pos : squares.getBounds()) { squares[pos]->setLevel(this); optional<StairKey> link = squares[pos]->getLandingLink(); if (link) landingSquares[*link].push_back(Position(pos, this)); } 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(); }