diff options
| author | void_17 <heroerror3@gmail.com> | 2026-03-02 15:58:20 +0700 |
|---|---|---|
| committer | void_17 <heroerror3@gmail.com> | 2026-03-02 15:58:20 +0700 |
| commit | 7074f35e4ba831e358117842b99ee35b87f85ae5 (patch) | |
| tree | 7d440d23473196af3056bf2ff4c59d9e740a06f5 /Minecraft.World/DamageSource.cpp | |
| parent | d63f79325f85e014361eb8cf1e41eaebedb1ae71 (diff) | |
shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
Diffstat (limited to 'Minecraft.World/DamageSource.cpp')
| -rw-r--r-- | Minecraft.World/DamageSource.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Minecraft.World/DamageSource.cpp b/Minecraft.World/DamageSource.cpp index 29ea727e..2b075e0e 100644 --- a/Minecraft.World/DamageSource.cpp +++ b/Minecraft.World/DamageSource.cpp @@ -24,22 +24,22 @@ DamageSource *DamageSource::wither = (new DamageSource(ChatPacket::e_ChatDeathWi DamageSource *DamageSource::anvil = (new DamageSource(ChatPacket::e_ChatDeathAnvil)); DamageSource *DamageSource::fallingBlock = (new DamageSource(ChatPacket::e_ChatDeathFallingBlock)); -DamageSource *DamageSource::mobAttack(shared_ptr<Mob> mob) +DamageSource *DamageSource::mobAttack(std::shared_ptr<Mob> mob) { return new EntityDamageSource(ChatPacket::e_ChatDeathMob, mob); } -DamageSource *DamageSource::playerAttack(shared_ptr<Player> player) +DamageSource *DamageSource::playerAttack(std::shared_ptr<Player> player) { return new EntityDamageSource(ChatPacket::e_ChatDeathPlayer, player); } -DamageSource *DamageSource::arrow(shared_ptr<Arrow> arrow, shared_ptr<Entity> owner) +DamageSource *DamageSource::arrow(std::shared_ptr<Arrow> arrow, std::shared_ptr<Entity> owner) { return (new IndirectEntityDamageSource(ChatPacket::e_ChatDeathArrow, arrow, owner))->setProjectile(); } -DamageSource *DamageSource::fireball(shared_ptr<Fireball> fireball, shared_ptr<Entity> owner) +DamageSource *DamageSource::fireball(std::shared_ptr<Fireball> fireball, std::shared_ptr<Entity> owner) { if (owner == NULL) { @@ -48,17 +48,17 @@ DamageSource *DamageSource::fireball(shared_ptr<Fireball> fireball, shared_ptr<E return (new IndirectEntityDamageSource(ChatPacket::e_ChatDeathFireball, fireball, owner))->setIsFire()->setProjectile(); } -DamageSource *DamageSource::thrown(shared_ptr<Entity> entity, shared_ptr<Entity> owner) +DamageSource *DamageSource::thrown(std::shared_ptr<Entity> entity, std::shared_ptr<Entity> owner) { return (new IndirectEntityDamageSource(ChatPacket::e_ChatDeathThrown, entity, owner))->setProjectile(); } -DamageSource *DamageSource::indirectMagic(shared_ptr<Entity> entity, shared_ptr<Entity> owner) +DamageSource *DamageSource::indirectMagic(std::shared_ptr<Entity> entity, std::shared_ptr<Entity> owner) { return (new IndirectEntityDamageSource(ChatPacket::e_ChatDeathIndirectMagic, entity, owner) )->bypassArmor()->setMagic();; } -DamageSource *DamageSource::thorns(shared_ptr<Entity> source) +DamageSource *DamageSource::thorns(std::shared_ptr<Entity> source) { return (new EntityDamageSource(ChatPacket::e_ChatDeathThorns, source))->setMagic(); } @@ -106,14 +106,14 @@ DamageSource::DamageSource(ChatPacket::EChatPacketMessage msgId) m_msgId = msgId; } -shared_ptr<Entity> DamageSource::getDirectEntity() +std::shared_ptr<Entity> DamageSource::getDirectEntity() { return getEntity(); } -shared_ptr<Entity> DamageSource::getEntity() +std::shared_ptr<Entity> DamageSource::getEntity() { - return shared_ptr<Entity>(); + return std::shared_ptr<Entity>(); } DamageSource *DamageSource::bypassArmor() @@ -158,15 +158,15 @@ DamageSource *DamageSource::setMagic() return this; } -//wstring DamageSource::getLocalizedDeathMessage(shared_ptr<Player> player) +//wstring DamageSource::getLocalizedDeathMessage(std::shared_ptr<Player> player) //{ // return L"death." + msgId + player->name; // //return I18n.get(L"death." + msgId, player.name); //} -shared_ptr<ChatPacket> DamageSource::getDeathMessagePacket(shared_ptr<Player> player) +std::shared_ptr<ChatPacket> DamageSource::getDeathMessagePacket(std::shared_ptr<Player> player) { - return shared_ptr<ChatPacket>( new ChatPacket(player->name, m_msgId ) ); + return std::shared_ptr<ChatPacket>( new ChatPacket(player->name, m_msgId ) ); } bool DamageSource::isFire() |
