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.
This commit is contained in:
void_17
2026-03-02 15:58:20 +07:00
parent d63f79325f
commit 7074f35e4b
1373 changed files with 12054 additions and 12054 deletions

View File

@@ -235,9 +235,9 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z)
int t = level->getTile(x, y, z);
int data = level->getData(x, y, z);
level->levelEvent(player, LevelEvent::PARTICLES_DESTROY_BLOCK, x, y, z, t + (level->getData(x, y, z) << Tile::TILE_NUM_SHIFT));
// 4J - In creative mode, the point where we need to tell the renderer that we are about to destroy a tile via destroyingTileAt is quite complicated.
// If the player being told is remote, then we always want the client to do it as it does the final update. If the player being told is local,
// then we need to update the renderer Here if we are sharing data between host & client as this is the final point where the original data is still intact.
@@ -272,7 +272,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z)
if (isCreative())
{
shared_ptr<TileUpdatePacket> tup = shared_ptr<TileUpdatePacket>( new TileUpdatePacket(x, y, z, level) );
std::shared_ptr<TileUpdatePacket> tup = std::shared_ptr<TileUpdatePacket>( new TileUpdatePacket(x, y, z, level) );
// 4J - a bit of a hack here, but if we want to tell the client that it needs to inform the renderer of a block being destroyed, then send a block 255 instead of a 0. This is handled in ClientConnection::handleTileUpdate
if( tup->block == 0 )
{
@@ -280,9 +280,9 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z)
}
player->connection->send( tup );
}
else
else
{
shared_ptr<ItemInstance> item = player->getSelectedItem();
std::shared_ptr<ItemInstance> item = player->getSelectedItem();
bool canDestroy = player->canDestroy(Tile::tiles[t]);
if (item != NULL)
{
@@ -301,13 +301,13 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z)
}
bool ServerPlayerGameMode::useItem(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, bool bTestUseOnly)
bool ServerPlayerGameMode::useItem(std::shared_ptr<Player> player, Level *level, std::shared_ptr<ItemInstance> item, bool bTestUseOnly)
{
if(!player->isAllowedToUse(item)) return false;
int oldCount = item->count;
int oldAux = item->getAuxValue();
shared_ptr<ItemInstance> itemInstance = item->use(level, player);
std::shared_ptr<ItemInstance> itemInstance = item->use(level, player);
if ((itemInstance != NULL && itemInstance != item) || (itemInstance != NULL && itemInstance->count != oldCount) || (itemInstance != NULL && itemInstance->getUseDuration() > 0))
{
player->inventory->items[player->inventory->selected] = itemInstance;
@@ -326,7 +326,7 @@ bool ServerPlayerGameMode::useItem(shared_ptr<Player> player, Level *level, shar
}
bool ServerPlayerGameMode::useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly, bool *pbUsedItem)
bool ServerPlayerGameMode::useItemOn(std::shared_ptr<Player> player, Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly, bool *pbUsedItem)
{
// 4J-PB - Adding a test only version to allow tooltips to be displayed
int t = level->getTile(x, y, z);
@@ -336,7 +336,7 @@ bool ServerPlayerGameMode::useItemOn(shared_ptr<Player> player, Level *level, sh
{
if (Tile::tiles[t]->TestUse()) return true;
}
else
else
{
if (Tile::tiles[t]->use(level, x, y, z, player, face, clickX, clickY, clickZ))
{
@@ -345,7 +345,7 @@ bool ServerPlayerGameMode::useItemOn(shared_ptr<Player> player, Level *level, sh
}
}
}
if (item == NULL || !player->isAllowedToUse(item)) return false;
if (isCreative())
{