Batch #5195 by eAthena: 0 byte-identical, 2 confirmed by peer review. - fn_17889 CPathFinder::LoadAttr: logic confirmed by peer review - fn_17908 CActorPickNode::AddPickInfo: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, alisonrag, OvoKore Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). Adds to the build: Source/ActorPickNode.cpp
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include "ActorPickNode.h"
|
|
#include "Contents/TerrainPathSearch.h"
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
// OFFSET: 0x00AD9980
|
|
// FUNCTION: fn_17889
|
|
bool CPathFinder::LoadAttr(std::string name) {
|
|
const auto found = this->attrCache.find(name);
|
|
if (found != this->attrCache.end()) {
|
|
this->attr = found->second;
|
|
return true;
|
|
}
|
|
|
|
C3dAttr* attr = new C3dAttr;
|
|
if (attr == nullptr) {
|
|
return false;
|
|
}
|
|
|
|
this->attrCache[name] = attr;
|
|
name += ".gat";
|
|
attr->Load(name.c_str());
|
|
this->attr = attr;
|
|
return true;
|
|
}
|
|
|
|
// OFFSET: 0x00ADA750
|
|
// FUNCTION: fn_17908
|
|
void CActorPickNode::AddPickInfo(ActorPickInfo* info) {
|
|
CActorPickNode* node = this;
|
|
while (node->children[0] != nullptr) {
|
|
const int x = static_cast<int>(info->left);
|
|
const int y = static_cast<int>(info->top);
|
|
const int centerX = node->right / 2;
|
|
const int centerY = node->bottom / 2;
|
|
int quadrant;
|
|
if (x > centerX) {
|
|
quadrant = (y > centerY) + 1;
|
|
} else {
|
|
quadrant = y <= centerY ? 0 : 3;
|
|
}
|
|
|
|
node = node->children[quadrant];
|
|
}
|
|
|
|
node->pickInfos.push_back(info);
|
|
}
|