Files
EVEngine/src/modules/map/Path.h
T
西风逍遥游 4377e062dd feat: zeroerr parameter validation + Doxygen API documentation
Squashed onto current main. Adds src/engine/common/Assert.h (EV_PARAM_CHECK / EV_ASSERT backed by zeroerr), an EVENGINE_ENABLE_ASSERTS option (non-Debug builds strip ZEROERR_NO_ASSERT unless enabled), parameter checks at key entry points, Doxygen comments across headers, Doxyfile + make docs / CMake docs targets, and Windows setup + code conventions in AGENTS.md.
2026-08-19 09:01:12 +08:00

44 lines
1.1 KiB
C++

#pragma once
#include <vector>
namespace eve::map {
/** @brief Ordered tile-index waypoints from start to goal (inclusive). */
class Path {
public:
/** @brief Clears all waypoints and cost. */
void clear();
/** @brief Appends a waypoint tile. */
void add(int x, int y);
/** @brief Reverses the waypoint order. */
void reverse();
/** @brief Number of waypoints (0 = empty/unreachable). */
int getLength() const;
/** @brief Waypoint tile coordinates. */
int getX(int index) const;
int getY(int index) const;
/** @brief Total path cost (A* heuristic + movement cost). */
float getTotalCost() const;
void setTotalCost(float cost);
/** @brief True when there are no waypoints. */
bool empty() const { return cells_.empty(); }
/** @brief One waypoint. */
struct Cell {
int x = 0;
int y = 0;
};
/** @brief Raw waypoint vector. */
const std::vector<Cell> &cells() const { return cells_; }
private:
std::vector<Cell> cells_;
float totalCost_ = 0.f;
};
} // namespace eve::map