mirror of
https://github.com/edubart/otclient.git
synced 2025-12-24 16:57:11 +01:00
Finalizing auto walk enhancements, closes #63, also other fixes:
* Can now auto walk up to 1000 steps! * Re-added sexy topmenu buttons :) * Tooltip for logout/edit will now change * Changed xxStackpos to xxStackPos
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
#include <framework/const.h>
|
||||
#include <framework/util/point.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class Position
|
||||
{
|
||||
public:
|
||||
@@ -122,6 +124,22 @@ public:
|
||||
return angle;
|
||||
}
|
||||
|
||||
std::vector<Position> translatedToDirections(const std::vector<Otc::Direction>& dirs) const {
|
||||
Position lastPos = *this;
|
||||
std::vector<Position> positions;
|
||||
|
||||
positions.push_back(lastPos);
|
||||
|
||||
for(auto dir : dirs) {
|
||||
if(lastPos.isValid()) {
|
||||
positions.push_back(lastPos);
|
||||
}
|
||||
lastPos = lastPos.translatedToDirection(dir);
|
||||
}
|
||||
|
||||
return positions;
|
||||
}
|
||||
|
||||
Otc::Direction getDirectionFromPosition(const Position& position) const {
|
||||
int dx = position.x - x;
|
||||
int dy = position.y - y;
|
||||
|
||||
Reference in New Issue
Block a user