rodecomp/Source/Contents/Navigation/NavigationDestinations.cpp
ragnarok-clanker 55d37a7071 Maintenance: Forced resubmit of 17189, rebased on 7ea84b3b3 (main had added 25 more copies of the same lines, now converted too). Sha
Batch #17225 by ragnarok-clanker: forced by an admin (0 lower score(s), 1 changed function(s)); checked with 75 compiled unit(s), including every includer of Source/Utility/StdIntVectorCopy.h, Source/Utility/StdStringConcat.h, Source/Utility/StdStringCopy.h, Source/Utility/StdStringInsert.h, Source/Utility/StdStringMoveAssign.h, Source/Utility/StdStringVectorDestroy.h, Source/Utility/StdTraitsEqual.h, Source/Utility/StdTraitsFind.h, Source/Utility/StdWindowListEmplace.h.
2026-11-11 15:11:07 +00:00

48 lines
1.4 KiB
C++

#include "Contents/Navigation/NavigationManager.h"
#include <cstring>
#include "Utility/StdStringCopy.h"
// 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());
std::size_t offset = sizeof(int);
char map[0x14] = {};
this->states.clear();
for (int i = 0; i < count; ++i) {
NavigationTarget target;
std::memcpy(&target.type, packet.data() + offset, sizeof(target.type));
offset += sizeof(target.type);
std::memset(map, 0, sizeof(map));
std::memcpy(map, packet.data() + offset, sizeof(map));
offset += sizeof(map);
std::memcpy(&target.x, packet.data() + offset, sizeof(target.x));
offset += sizeof(target.x);
std::memcpy(&target.y, packet.data() + offset, sizeof(target.y));
offset += sizeof(target.y);
int nameLength;
std::memcpy(&nameLength, packet.data() + offset, sizeof(nameLength));
offset += sizeof(nameLength);
if (nameLength > 0) {
target.name.resize(nameLength, '\0');
std::memcpy(&target.name[0], packet.data() + offset, nameLength);
offset += nameLength;
}
CNaviInfo* info = this->FindObject(map);
if (info != nullptr) {
target.object = info;
this->states.push_back(target);
}
}
return true;
}