From c879e42e512820ee5f7d2df6b4e29f7ce183aea9 Mon Sep 17 00:00:00 2001 From: Segfault <5221072+Segfaultd@users.noreply.github.com> Date: Mon, 15 Jun 2026 15:01:45 +0200 Subject: [PATCH] feat: canonical type aliases over legacy RakNet names (#14) Add Source/include/mafianet/aliases.h introducing canonical MafiaNet aliases over the existing RakNet-named public types: RakPeerInterface -> PeerInterface RakNetGUID -> Guid RakNetStatistics -> Statistics UNASSIGNED_RAKNET_GUID -> UnassignedGuid These are 'using' aliases (and a reference for the sentinel), so each canonical name denotes the exact same type/object as its legacy counterpart and the two interoperate freely. The legacy declarations are left untouched and un-deprecated. The new header is pulled into the umbrella header (mafianet.h). --- Source/include/mafianet/aliases.h | 45 ++++++++++++++++++++++++++++++ Source/include/mafianet/mafianet.h | 1 + 2 files changed, 46 insertions(+) create mode 100644 Source/include/mafianet/aliases.h diff --git a/Source/include/mafianet/aliases.h b/Source/include/mafianet/aliases.h new file mode 100644 index 000000000..af8a5322a --- /dev/null +++ b/Source/include/mafianet/aliases.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019, SLikeSoft UG (haftungsbeschraenkt) + * + * This source code is licensed under the MIT-style license found in the license.txt + * file in the root directory of this source tree. + */ + +/// \file aliases.h +/// \brief Canonical MafiaNet type aliases over the legacy RakNet names. +/// +/// The library lives in the `MafiaNet` namespace, but many public types still +/// carry their historical RakNet names. This header introduces clean, canonical +/// aliases so callers can write idiomatic MafiaNet code: +/// \code +/// MafiaNet::PeerInterface* peer = MafiaNet::PeerInterface::GetInstance(); +/// \endcode +/// +/// These are `using` aliases (not subclasses): each canonical name denotes the +/// exact same type as its legacy counterpart, so the two interoperate freely. +/// +/// \note Aliases only — the legacy declarations are intentionally left untouched +/// and un-deprecated. A `[[deprecated]]` pass is a separate, later task. + +#pragma once + +#include "mafianet/peerinterface.h" // RakPeerInterface +#include "mafianet/types.h" // RakNetGUID, UNASSIGNED_RAKNET_GUID +#include "mafianet/statistics.h" // RakNetStatistics + +namespace MafiaNet { + +/// Canonical name for the main entry point, RakPeerInterface. +using PeerInterface = RakPeerInterface; + +/// Canonical name for a peer's globally unique identifier, RakNetGUID. +using Guid = RakNetGUID; + +/// Canonical name for the connection statistics struct, RakNetStatistics. +using Statistics = RakNetStatistics; + +/// Canonical name for the unassigned-GUID sentinel, UNASSIGNED_RAKNET_GUID. +/// Bound by reference so it remains the same object as the legacy sentinel. +inline const Guid& UnassignedGuid = UNASSIGNED_RAKNET_GUID; + +} // namespace MafiaNet diff --git a/Source/include/mafianet/mafianet.h b/Source/include/mafianet/mafianet.h index 938727fea..b952c8d2f 100644 --- a/Source/include/mafianet/mafianet.h +++ b/Source/include/mafianet/mafianet.h @@ -30,3 +30,4 @@ #include "mafianet/BitStream.h" // binary serialization #include "mafianet/GetTime.h" // MafiaNet::GetTime / TimeMS #include "mafianet/guid_util.h" // MafiaNet::to_string / connected_address +#include "mafianet/aliases.h" // canonical aliases: PeerInterface, Guid, Statistics