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

@@ -16,7 +16,7 @@ IUIScene_TradingMenu::IUIScene_TradingMenu()
m_bHasUpdatedOnce = false;
}
shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant()
std::shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant()
{
return m_merchant;
}
@@ -46,11 +46,11 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
switch(iAction)
{
case ACTION_MENU_B:
case ACTION_MENU_B:
ui.ShowTooltip( iPad, eToolTipButtonX, false );
ui.ShowTooltip( iPad, eToolTipButtonB, false );
ui.ShowTooltip( iPad, eToolTipButtonA, false );
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
ui.ShowTooltip( iPad, eToolTipButtonA, false );
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
// kill the crafting xui
//ui.PlayUISFX(eSFX_Back);
ui.CloseUIScenes(iPad);
@@ -70,9 +70,9 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
if(!activeRecipe->isDeprecated())
{
// Do we have the ingredients?
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
int buyAMatches = player->inventory->countMatches(buyAItem);
int buyBMatches = player->inventory->countMatches(buyBItem);
if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) )
@@ -84,7 +84,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
player->inventory->removeResources(buyBItem);
// Add the item we have purchased
shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy();
std::shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy();
if(!player->inventory->add( result ) )
{
player->drop(result);
@@ -92,7 +92,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
// Send a packet to the server
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
player->connection->send( shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
player->connection->send( std::shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
updateDisplay();
}
@@ -149,7 +149,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
ByteArrayOutputStream rawOutput;
DataOutputStream output(&rawOutput);
output.writeInt(actualShopItem);
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
}
}
return handled;
@@ -203,7 +203,7 @@ void IUIScene_TradingMenu::updateDisplay()
ByteArrayOutputStream rawOutput;
DataOutputStream output(&rawOutput);
output.writeInt(firstValidTrade);
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
}
}
@@ -247,9 +247,9 @@ void IUIScene_TradingMenu::updateDisplay()
vector<wstring> unformattedStrings;
wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings);
setOfferDescription(offerDescription, unformattedStrings);
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
setRequest1Item(buyAItem);
setRequest2Item(buyBItem);
@@ -262,7 +262,7 @@ void IUIScene_TradingMenu::updateDisplay()
bool canMake = true;
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
int buyAMatches = player->inventory->countMatches(buyAItem);
if(buyAMatches > 0)
{
@@ -321,10 +321,10 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe)
{
if(recipe->isDeprecated()) return false;
shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem();
shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem();
std::shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem();
std::shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem();
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
int buyAMatches = player->inventory->countMatches(buyAItem);
if(buyAMatches > 0)
{
@@ -349,19 +349,19 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe)
}
void IUIScene_TradingMenu::setRequest1Item(shared_ptr<ItemInstance> item)
void IUIScene_TradingMenu::setRequest1Item(std::shared_ptr<ItemInstance> item)
{
}
void IUIScene_TradingMenu::setRequest2Item(shared_ptr<ItemInstance> item)
void IUIScene_TradingMenu::setRequest2Item(std::shared_ptr<ItemInstance> item)
{
}
void IUIScene_TradingMenu::setTradeItem(int index, shared_ptr<ItemInstance> item)
void IUIScene_TradingMenu::setTradeItem(int index, std::shared_ptr<ItemInstance> item)
{
}
wstring IUIScene_TradingMenu::GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings)
wstring IUIScene_TradingMenu::GetItemDescription(std::shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings)
{
if(item == NULL) return L"";