Build: compiles with clang 18 (Store purchase struct, missing includes)
clang refused WorldSession's Optional<ShopPendingPurchase>::emplace() in TokenHandler.cpp: the struct was nested in WorldSession with default member initializers, so where the Optional member is declared the struct is not yet default-constructible, and clang keeps that answer. GCC and MSVC accept it. The struct now sits outside the class. A clang pass over every game source without the precompiled header also found five files that relied on it for an include: StatSystem.cpp (ClassicSpellValue.h), TokenPackets.h (Optional.h), TraitPacketsCommon.cpp (Util.h), ClubMembershipService.cpp (Log.h), RecentAllies.cpp (Packet.h).
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "Packet.h"
|
||||
#include "PacketUtilities.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Optional.h"
|
||||
#include <array>
|
||||
|
||||
namespace WorldPackets
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "DBCEnums.h"
|
||||
#include "PacketOperators.h"
|
||||
#include "UpdateFields.h"
|
||||
#include "Util.h"
|
||||
|
||||
namespace WorldPackets::Traits
|
||||
{
|
||||
|
||||
@@ -1001,6 +1001,20 @@ struct PacketCounter
|
||||
uint32 amountCounter;
|
||||
};
|
||||
|
||||
// Classic 1.60 in-game Store: a purchase waiting for the player's confirmation (WorldSession::_shopPendingPurchase).
|
||||
// Declared outside WorldSession on purpose: a class nested in WorldSession with default member initializers is not yet
|
||||
// default-constructible where Optional<> of it is declared inside WorldSession, and clang caches that answer, so
|
||||
// Optional::emplace() then fails to compile with clang (GCC and MSVC accept it).
|
||||
struct ShopPendingPurchase
|
||||
{
|
||||
uint64 PurchaseID = 0;
|
||||
uint32 ProductID = 0;
|
||||
uint32 ServerToken = 0;
|
||||
ObjectGuid Target;
|
||||
int64 TimeCreated = 0;
|
||||
uint32 TransferRealmAddress = 0; // realm transfer (character service window): destination realm
|
||||
};
|
||||
|
||||
/// Player session in the World
|
||||
class TC_GAME_API WorldSession
|
||||
{
|
||||
@@ -2094,15 +2108,6 @@ class TC_GAME_API WorldSession
|
||||
uint32 _battlenetRequestToken;
|
||||
|
||||
// Classic 1.60 in-game Store: the purchase waiting for the player's confirmation
|
||||
struct ShopPendingPurchase
|
||||
{
|
||||
uint64 PurchaseID = 0;
|
||||
uint32 ProductID = 0;
|
||||
uint32 ServerToken = 0;
|
||||
ObjectGuid Target;
|
||||
int64 TimeCreated = 0;
|
||||
uint32 TransferRealmAddress = 0; // realm transfer (character service window): destination realm
|
||||
};
|
||||
Optional<ShopPendingPurchase> _shopPendingPurchase;
|
||||
Optional<std::pair<ObjectGuid, uint32>> _hardcoreTransferValidated; // character, destination realm address of the token's check
|
||||
void StartShopPurchase(uint32 clientToken, uint32 productId, ObjectGuid target, uint32 transferRealmAddress);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ClubService.h"
|
||||
#include "ClubUtils.h"
|
||||
#include "Guild.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
|
||||
namespace Battlenet::Services
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <mutex>
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Packet.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
Reference in New Issue
Block a user