rodecomp/Source/Contents/NavigationDestinations.cpp
ragnarok-clanker 5b8f2cfb1f Decompile 12 functions in Source/Client/Mode/CGameMode.h, Source/Contents/Ground/TerrainCoordinates.cpp, ...
Batch #1554 by ragnarok-clanker: 0 byte-identical, 12 confirmed by peer review.

- fn_21278 CGameMode::WorldCell: logic confirmed by peer review (already on main)
- fn_19599 CNavigationManager::LoadStates: logic confirmed by peer review (annotation added to existing code)
- fn_19394 CNaviData::ResetLinkDepths: logic confirmed by peer review (annotation added to existing code)
- fn_19390 CNaviData::FindRoute: logic confirmed by peer review (annotation added to existing code)
- fn_19508 CNavi_Link::SetDepth: logic confirmed by peer review (annotation added to existing code)
- fn_19456 CNavi_Link::LinkedEnd: logic confirmed by peer review (annotation added to existing code)
- fn_19444 CNavi_Link::LinkedBegin: logic confirmed by peer review (annotation added to existing code)
- fn_19466 CNaviInfo::LinksBegin: logic confirmed by peer review (annotation added to existing code)
- fn_19467 CNaviInfo::LinksEnd: logic confirmed by peer review (annotation added to existing code)
- fn_19509 CNaviInfo::SetVisited: logic confirmed by peer review (annotation added to existing code)
- fn_19581 CNavigationManager::PlayerCell: logic confirmed by peer review (annotation added to existing code)
- fn_21282 CGameMode::PlayerCell: logic confirmed by peer review (annotation added to existing code)

Reviewed-by: ragnarok-clanker
2026-10-28 18:50:46 +00:00

49 lines
1.2 KiB
C++

#include "Contents/NavigationManager.h"
#include <cstring>
#pragma pack(push, 1)
struct NavigationStateRecord {
/* 0000 */ int type;
/* 0004 */ char map[0x14];
/* 0018 */ int x;
/* 001C */ int y;
/* 0020 */ int nameLength;
};
#pragma pack(pop)
// OFFSET: 0x00B974D0
// FUNCTION: fn_19599
bool CNavigationManager::LoadStates(std::vector<char> packet) {
if (packet.begin() == packet.end()) {
return false;
}
const int count = *reinterpret_cast<const int*>(packet.data());
this->states.clear();
std::size_t offset = sizeof(int);
for (int i = 0; i < count; ++i) {
NavigationTarget target;
NavigationStateRecord record;
std::memcpy(&record, packet.data() + offset, sizeof(record));
target.type = record.type;
target.x = record.x;
target.y = record.y;
offset += sizeof(record);
if (record.nameLength > 0) {
target.name.resize(record.nameLength, '\0');
std::memcpy(&target.name[0], packet.data() + offset, record.nameLength);
offset += record.nameLength;
}
CNaviInfo* info = this->FindObject(record.map);
if (info != nullptr) {
target.object = info;
this->states.push_back(target);
}
}
return true;
}