mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-22 22:13:35 +02:00
82501dc553
Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
/*
|
|
* RmgPath.h, part of VCMI engine
|
|
*
|
|
* Authors: listed in file AUTHORS in main folder
|
|
*
|
|
* License: GNU General Public License v2.0 or later
|
|
* Full text of license available in license.txt file, in main folder
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "../GameConstants.h"
|
|
#include "../int3.h"
|
|
#include "RmgArea.h"
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
namespace rmg
|
|
{
|
|
class Path
|
|
{
|
|
public:
|
|
using MoveCostFunction = std::function<float(const int3 &, const int3 &)>;
|
|
const static MoveCostFunction DEFAULT_MOVEMENT_FUNCTION;
|
|
|
|
Path(const Area & area);
|
|
Path(const Area & area, const int3 & src);
|
|
Path(const Path & path) = default;
|
|
Path & operator= (const Path & path);
|
|
bool valid() const;
|
|
|
|
Path search(const Tileset & dst, bool straight, std::function<float(const int3 &, const int3 &)> moveCostFunction = DEFAULT_MOVEMENT_FUNCTION) const;
|
|
Path search(const int3 & dst, bool straight, std::function<float(const int3 &, const int3 &)> moveCostFunction = DEFAULT_MOVEMENT_FUNCTION) const;
|
|
Path search(const Area & dst, bool straight, std::function<float(const int3 &, const int3 &)> moveCostFunction = DEFAULT_MOVEMENT_FUNCTION) const;
|
|
Path search(const Path & dst, bool straight, std::function<float(const int3 &, const int3 &)> moveCostFunction = DEFAULT_MOVEMENT_FUNCTION) const;
|
|
|
|
void connect(const Path & path);
|
|
void connect(const int3 & path); //TODO: force connection?
|
|
void connect(const Area & path); //TODO: force connection?
|
|
void connect(const Tileset & path); //TODO: force connection?
|
|
|
|
const Area & getPathArea() const;
|
|
|
|
static Path invalid();
|
|
static MoveCostFunction createCurvedCostFunction(const Area & border);
|
|
|
|
private:
|
|
|
|
const Area * dArea = nullptr;
|
|
Area dPath;
|
|
};
|
|
}
|
|
|
|
VCMI_LIB_NAMESPACE_END
|