rodecomp/Source/Contents/Party/PartyInvitation.h
ragnarok-clanker 4fd6cd3ad7 Maintenance: Resubmission of batch 9115 rebased onto main (it conflicted with 9108's CommonObject.cpp change, which it already contai
Batch #9132 by ragnarok-clanker: forced by an admin (2 lower score(s), 13 changed function(s)); checked with 22 compiled unit(s), including every includer of Source/Contents/ForbiddenWords.h, Source/Contents/Party/PartyInvitation.h, Source/File/CommonObject.h, Source/UI/Chat/UIChatRoomTitle.h, Source/UI/Guild/UIGuildWnd.h, Source/UI/Party/UIRegisterPartyWnd.h, Source/UI/Window/UIHomunInfoWnd.h, Source/UI/Window/UIPetInfoWnd.h.
2026-11-01 02:10:48 +00:00

42 lines
1.2 KiB
C++

#ifndef RAGNAROK_SOURCE_CONTENTS_PARTY_PARTYINVITATION_H
#define RAGNAROK_SOURCE_CONTENTS_PARTY_PARTYINVITATION_H
#include "Contents/ForbiddenWords.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/WindowManagerWindows.h"
#include <cstdint>
#include <cstring>
#include <string>
class ForbiddenWords;
class WindowManagerWindows;
struct PartyInvitationContext {
ForbiddenWords& words;
WindowManagerWindows& windows;
std::string& pendingName;
};
void ReceivePartyInvitation(const void* packet, PartyInvitationContext& context);
// INLINED
inline void ReceivePartyInvitation(const void* packet, PartyInvitationContext& context) {
const auto* bytes = static_cast<const unsigned char*>(packet);
char name[25];
std::strncpy(name, reinterpret_cast<const char*>(bytes + 6), 24);
name[24] = '\0';
if (g_forbiddenWords.Contains(name)) {
std::string unused;
g_forbiddenWords.Mask(name, &unused);
}
context.pendingName.assign(name, std::strlen(name));
UIWindow* window = context.windows.EnsureWindow(35);
std::uint32_t identity;
std::memcpy(&identity, bytes + 2, sizeof(identity));
window->SendMsg(nullptr, 56, identity, reinterpret_cast<std::intptr_t>(name), 0, 0);
}
#endif