mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Scripts/OutdoorPvp: converted two raw pointers into smart pointers to fix possible memory leaks
(cherry picked from commit 0b842d44d9)
This commit is contained in:
@@ -39,7 +39,6 @@ uint32 const FlightPathEndNodes[FLIGHT_NODES_NUM] = { 104, 106, 108, 110 };
|
||||
OutdoorPvPNA::OutdoorPvPNA(Map* map) : OutdoorPvP(map)
|
||||
{
|
||||
m_TypeId = OUTDOOR_PVP_NA;
|
||||
m_obj = nullptr;
|
||||
ControlZoneHandlers[182210] = std::make_unique<NAControlZoneHandler>(this);
|
||||
}
|
||||
|
||||
@@ -220,7 +219,7 @@ bool OutdoorPvPNA::SetupOutdoorPvP()
|
||||
RegisterZone(NA_BUFF_ZONE);
|
||||
|
||||
// halaa
|
||||
m_obj = new OPvPCapturePointNA(this);
|
||||
m_obj = std::make_unique<OPvPCapturePointNA>(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -190,9 +190,9 @@ class OutdoorPvPNA : public OutdoorPvP
|
||||
void SendRemoveWorldStates(Player* player) override;
|
||||
void HandleKillImpl(Player* player, Unit* killed) override;
|
||||
void SendMapWorldStates(int32 neutral, int32 progressHorde, int32 progressAlliance, int32 capturedHorde, int32 captureAlliance);
|
||||
OPvPCapturePointNA* GetCapturePoint() const { return m_obj; }
|
||||
OPvPCapturePointNA* GetCapturePoint() const { return m_obj.get(); }
|
||||
private:
|
||||
OPvPCapturePointNA* m_obj;
|
||||
std::unique_ptr<OPvPCapturePointNA> m_obj;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -140,7 +140,6 @@ void OutdoorPvPZM::HandlePlayerLeaveZone(Player* player, uint32 zone)
|
||||
OutdoorPvPZM::OutdoorPvPZM(Map* map) : OutdoorPvP(map)
|
||||
{
|
||||
m_TypeId = OUTDOOR_PVP_ZM;
|
||||
m_Graveyard = nullptr;
|
||||
m_AllianceTowersControlled = 0;
|
||||
m_HordeTowersControlled = 0;
|
||||
|
||||
@@ -178,7 +177,7 @@ bool OutdoorPvPZM::SetupOutdoorPvP()
|
||||
for (uint8 i = 0; i < OutdoorPvPZMBuffZonesNum; ++i)
|
||||
RegisterZone(OutdoorPvPZMBuffZones[i]);
|
||||
|
||||
m_Graveyard = new OPvPCapturePointZM_Graveyard(this);
|
||||
m_Graveyard = std::make_unique<OPvPCapturePointZM_Graveyard>(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -193,10 +193,10 @@ class OutdoorPvPZM : public OutdoorPvP
|
||||
uint32 GetHordeTowersControlled() const;
|
||||
void SetHordeTowersControlled(uint32 count);
|
||||
|
||||
OPvPCapturePointZM_Graveyard* GetGraveyard() { return m_Graveyard; }
|
||||
OPvPCapturePointZM_Graveyard* GetGraveyard() { return m_Graveyard.get(); }
|
||||
|
||||
private:
|
||||
OPvPCapturePointZM_Graveyard* m_Graveyard;
|
||||
std::unique_ptr<OPvPCapturePointZM_Graveyard> m_Graveyard;
|
||||
uint32 m_AllianceTowersControlled;
|
||||
uint32 m_HordeTowersControlled;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user