rodecomp/Source/Contents/NavigationCandidates.cpp
ragnarok-clanker 2b755e795a Maintenance: [forced, user-approved] Family F6 (closes family F): delete the four headers left empty or orphaned by F1-F5. WindowDial
Batch #10239 by ragnarok-clanker: forced by an admin (0 lower score(s), 0 changed function(s)); checked with 494 compiled unit(s), including every includer of Source/UI/GameSettings/GameSettingsUI.h, Source/UI/RuneSystem/UIRuneSystemWnd.h, Source/UI/Window/UINewMakeCharWnd.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/WindowDialogs.h, Source/Client/Mode/ModeTooltip.h, Source/Client/Mode/ModeCursor.h, Source/UI/Window/WindowRegistration.h.
Deletes: Source/UI/Window/WindowDialogs.h, Source/Client/Mode/ModeTooltip.h, Source/Client/Mode/ModeCursor.h, Source/UI/Window/WindowRegistration.h
2026-11-03 11:10:29 +00:00

57 lines
1.8 KiB
C++

#include "Contents/NavigationManager.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/ModeMgr.h"
#include "Client/Session.h"
#include "Contents/MessageTable.h"
#include "Resource/ResourceMgr.h"
#include "UI/Window/UIWindowMgr.h"
#include <string>
#include <vector>
// OFFSET: 0x00BA0870
// FUNCTION: fn_19634
bool CNavigationManager::CollectStartLinks() {
CNaviInfo* info = this->FindObject(g_session.m_navigationPlayerMap);
if (info == nullptr) {
const std::string resolved = ResourceMgr::Instance().aliases.ResolveMapName(g_session.m_navigationPlayerMap);
info = this->FindObject(resolved.c_str());
if (info == nullptr) {
g_windowMgr.Confirm(LookupMessage(2293), 0, true, false, 0, "Message", 280, 120, 0);
return false;
}
}
if (info->LinkCount() == 0) {
return false;
}
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
if (mode == nullptr) {
return false;
}
int column;
int row;
mode->PlayerCell(&column, &row);
this->UpdateGround();
MovementRouteInterpolation route;
this->data.startLinks.clear();
for (std::vector<CNavi_Link*>::iterator it = info->LinksBegin(); it != info->LinksEnd(); ++it) {
NaviCell linkCell;
NaviCell linkRowCell;
if ((*it)->GetCell(&linkCell)->x == column && (*it)->GetCell(&linkRowCell)->y == row) {
this->data.startLinks.push_back(NaviLink{*it, 1});
} else {
NaviCell targetRowCell;
NaviCell targetCell;
if (this->pathFinder.FindPath(1, column, row, 8, 8, (*it)->GetCell(&targetCell)->x, (*it)->GetCell(&targetRowCell)->y, 10, route, 15)) {
this->data.startLinks.push_back(NaviLink{*it, static_cast<int>(route.points.size())});
}
this->pathFinder.Reset();
}
}
return !this->data.startLinks.empty();
}