Core/Units: moved spell cast request includes out of unit class and use unique_ptr instead of optionals
This commit is contained in:
1 parent
b49f95e1e9
commit
faa78b9e07
4 files changed
+54
-38
No files matched your search
@@ -68,6 +68,7 @@ struct FactionTemplateEntry;
|
||||
struct LiquidData;
|
||||
struct LiquidTypeEntry;
|
||||
struct MountCapabilityEntry;
|
||||
struct PendingSpellCastRequest;
|
||||
struct SpellValue;
|
||||
|
||||
class Aura;
|
||||
@@ -772,29 +773,6 @@ struct PositionUpdateInfo
|
||||
bool Turned = false;
|
||||
};
|
||||
|
||||
struct SpellCastRequestItemData
|
||||
{
|
||||
SpellCastRequestItemData(uint8 bagSlot, uint8 slot, ObjectGuid castItem) :
|
||||
BagSlot(bagSlot), Slot(slot), CastItem(castItem)
|
||||
{
|
||||
}
|
||||
|
||||
uint8 BagSlot = 0;
|
||||
uint8 Slot = 0;
|
||||
ObjectGuid CastItem;
|
||||
};
|
||||
|
||||
struct PendingSpellCastRequest
|
||||
{
|
||||
PendingSpellCastRequest(WorldPackets::Spells::SpellCastRequest&& castRequest, Optional<SpellCastRequestItemData> castItemData = {}) :
|
||||
CastRequest(castRequest), CastItemData(castItemData)
|
||||
{
|
||||
}
|
||||
|
||||
WorldPackets::Spells::SpellCastRequest CastRequest;
|
||||
Optional<SpellCastRequestItemData> CastItemData;
|
||||
};
|
||||
|
||||
// delay time next attack to prevent client attack animation problems
|
||||
#define ATTACK_DISPLAY_DELAY 200
|
||||
#define MAX_PLAYER_STEALTH_DETECT_RANGE 30.0f // max distance for detection targets by player
|
||||
@@ -1804,7 +1782,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void SetIgnoringCombat(bool apply) { _isIgnoringCombat = apply; }
|
||||
|
||||
// Queues up a spell cast request that has been received via packet and processes it whenever possible.
|
||||
void RequestSpellCast(PendingSpellCastRequest castRequest, SpellInfo const* spellInfo);
|
||||
void RequestSpellCast(std::unique_ptr<PendingSpellCastRequest> castRequest, SpellInfo const* spellInfo);
|
||||
void CancelPendingCastRequest();
|
||||
bool CanRequestSpellCast(SpellInfo const* spell) const;
|
||||
|
||||
@@ -1957,7 +1935,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
|
||||
bool _isIgnoringCombat;
|
||||
|
||||
Optional<PendingSpellCastRequest> _pendingSpellCastRequest;
|
||||
std::unique_ptr<PendingSpellCastRequest> _pendingSpellCastRequest;
|
||||
void ProcessPendingSpellCastRequest();
|
||||
void ProcessItemCast(PendingSpellCastRequest const& castRequest, SpellCastTargets const& targets);
|
||||
bool CanExecutePendingSpellCastRequest(SpellInfo const* spellInfo) const;
|
||||
|
||||
Reference in new issue
Block a user