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

@@ -73,7 +73,7 @@ void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu*
m_iCurrSlotX = 0;
m_iCurrSlotY = 0;
#endif // TAP_DETECTION
//
//
// for(int i=0;i<XUSER_MAX_COUNT;i++)
// {
// m_bFirstTouchStored[i]=false;
@@ -101,7 +101,7 @@ int IUIScene_AbstractContainerMenu::GetSectionDimensions( ESceneSection eSection
*piNumRows = 0;
*piNumColumns = 0;
}
return( ( *piNumRows ) * ( *piNumColumns ) );
return( ( *piNumRows ) * ( *piNumColumns ) );
}
void IUIScene_AbstractContainerMenu::updateSlotPosition( ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection, int *piTargetX, int *piTargetY, int xOffset )
@@ -205,7 +205,7 @@ void IUIScene_AbstractContainerMenu::SetToolTip( EToolTipButton eButton, EToolTi
void IUIScene_AbstractContainerMenu::UpdateTooltips()
{
// Table gives us text id for tooltip.
static const DWORD kaToolTipextIds[ eNumToolTips ] =
static const DWORD kaToolTipextIds[ eNumToolTips ] =
{
IDS_TOOLTIPS_PICKUPPLACE, //eToolTipPickupPlace_OLD
IDS_TOOLTIPS_EXIT, // eToolTipExit
@@ -307,7 +307,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
float fNewX=(((float)pTouchPadData->touch[0].x)-m_oldvTouchPos.x) * m_fTouchPadMulX;
float fNewY=(((float)pTouchPadData->touch[0].y)-m_oldvTouchPos.y) * m_fTouchPadMulY;
// relative positions - needs a deadzone
// relative positions - needs a deadzone
if(fNewX>m_fTouchPadDeadZoneX)
{
@@ -320,11 +320,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(fNewY>m_fTouchPadDeadZoneY)
{
vPointerPos.y=m_oldvPointerPos.y+((fNewY-m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f));
vPointerPos.y=m_oldvPointerPos.y+((fNewY-m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f));
}
else if(fNewY<-m_fTouchPadDeadZoneY)
{
vPointerPos.y=m_oldvPointerPos.y+((fNewY+m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f));
vPointerPos.y=m_oldvPointerPos.y+((fNewY+m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f));
}
// Clamp to pointer extents.
@@ -334,7 +334,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY;
bStickInput = true;
m_eCurrTapState=eTapStateNoInput;
m_eCurrTapState=eTapStateNoInput;
}
else
{
@@ -408,7 +408,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
fInputX *= fInputScale;
fInputY *= fInputScale;
#ifdef USE_POINTER_ACCEL
#ifdef USE_POINTER_ACCEL
m_fPointerAccelX += fInputX / 50.0f;
m_fPointerAccelY += fInputY / 50.0f;
@@ -451,12 +451,12 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else
{
m_iConsectiveInputTicks = 0;
#ifdef USE_POINTER_ACCEL
#ifdef USE_POINTER_ACCEL
m_fPointerVelX = 0.0f;
m_fPointerVelY = 0.0f;
m_fPointerAccelX = 0.0f;
m_fPointerAccelY = 0.0f;
#endif
#endif
}
#ifdef __ORBIS__
@@ -501,7 +501,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
( vPointerPos.y >= sectionPos.y ) && ( vPointerPos.y <= itemMax.y ) )
{
// Pointer is over this control!
eSectionUnderPointer = eSection;
eSectionUnderPointer = eSection;
vSnapPos.x = itemPos.x + ( itemSize.x / 2.0f );
vSnapPos.y = itemPos.y + ( itemSize.y / 2.0f );
@@ -590,7 +590,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
}
// If we are not over any slot, set focus elsewhere.
if ( eSectionUnderPointer == eSectionNone )
if ( eSectionUnderPointer == eSectionNone )
{
setFocusToPointer( getPad() );
#ifdef TAP_DETECTION
@@ -704,11 +704,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
// Determine appropriate context sensitive tool tips, based on what is carried on the pointer and what is under the pointer.
// What are we carrying on pointer.
shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
shared_ptr<ItemInstance> carriedItem = nullptr;
std::shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
std::shared_ptr<ItemInstance> carriedItem = nullptr;
if(player != NULL) carriedItem = player->inventory->getCarried();
shared_ptr<ItemInstance> slotItem = nullptr;
std::shared_ptr<ItemInstance> slotItem = nullptr;
Slot *slot = NULL;
int slotIndex = 0;
if(bPointerIsOverSlot)
@@ -790,7 +790,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if ( bSlotHasItem )
{
// Item in hand and item in slot ... is item in slot the same as in out hand? If so, can we stack on to it?
if ( bCarriedIsSameAsSlot )
if ( bCarriedIsSameAsSlot )
{
// Can we stack more into this slot?
if ( iSlotStackSizeRemaining == 0 )
@@ -889,7 +889,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if((eSectionUnderPointer==eSectionInventoryUsing)||(eSectionUnderPointer==eSectionInventoryInventory))
{
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(item->id);
if(eArmourType==ArmorRecipes::eArmorType_None)
@@ -919,7 +919,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else
{
buttonY = eToolTipQuickMove;
}
}
break;
case ArmorRecipes::eArmorType_Leggings:
if(isSlotEmpty(eSectionInventoryArmor,2))
@@ -952,7 +952,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else if((eSectionUnderPointer==eSectionFurnaceUsing)||(eSectionUnderPointer==eSectionFurnaceInventory))
{
// Get the info on this item.
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
bool bValidFuel = FurnaceTileEntity::isFuel(item);
bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL;
@@ -962,7 +962,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(!isSlotEmpty(eSectionFurnaceIngredient,0))
{
// is it the same as this item
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
if(IngredientItem->id == item->id)
{
buttonY = eToolTipQuickMoveIngredient;
@@ -991,7 +991,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(!isSlotEmpty(eSectionFurnaceFuel,0))
{
// is it the same as this item
shared_ptr<ItemInstance> fuelItem = getSlotItem(eSectionFurnaceFuel,0);
std::shared_ptr<ItemInstance> fuelItem = getSlotItem(eSectionFurnaceFuel,0);
if(fuelItem->id == item->id)
{
buttonY = eToolTipQuickMoveFuel;
@@ -1002,7 +1002,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(!isSlotEmpty(eSectionFurnaceIngredient,0))
{
// is it the same as this item
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
if(IngredientItem->id == item->id)
{
buttonY = eToolTipQuickMoveIngredient;
@@ -1044,7 +1044,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else if((eSectionUnderPointer==eSectionBrewingUsing)||(eSectionUnderPointer==eSectionBrewingInventory))
{
// Get the info on this item.
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
int iId=item->id;
// valid ingredient?
@@ -1062,7 +1062,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(!isSlotEmpty(eSectionBrewingIngredient,0))
{
// is it the same as this item
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionBrewingIngredient,0);
std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionBrewingIngredient,0);
if(IngredientItem->id == item->id)
{
buttonY = eToolTipQuickMoveIngredient;
@@ -1077,15 +1077,15 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
// ingredient slot empty
buttonY = eToolTipQuickMoveIngredient;
}
}
}
else
{
// valid potion? Glass bottle with water in it is a 'potion' too.
if(iId==Item::potion_Id)
{
// space available?
if(isSlotEmpty(eSectionBrewingBottle1,0) ||
isSlotEmpty(eSectionBrewingBottle2,0) ||
if(isSlotEmpty(eSectionBrewingBottle1,0) ||
isSlotEmpty(eSectionBrewingBottle2,0) ||
isSlotEmpty(eSectionBrewingBottle3,0))
{
buttonY = eToolTipQuickMoveIngredient;
@@ -1104,7 +1104,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else if((eSectionUnderPointer==eSectionEnchantUsing)||(eSectionUnderPointer==eSectionEnchantInventory))
{
// Get the info on this item.
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
int iId=item->id;
// valid enchantable tool?
@@ -1112,8 +1112,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
{
// is there already something in the ingredient slot?
if(isSlotEmpty(eSectionEnchantSlot,0))
{
// tool slot empty
{
// tool slot empty
switch(iId)
{
case Item::bow_Id:
@@ -1155,7 +1155,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
buttonY = eToolTipQuickMove;
break;
default:
buttonY=eToolTipQuickMoveTool;
buttonY=eToolTipQuickMoveTool;
break;
}
}
@@ -1163,10 +1163,10 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
{
buttonY = eToolTipQuickMove;
}
}
}
else
{
buttonY=eToolTipQuickMove;
buttonY=eToolTipQuickMove;
}
}
else
@@ -1199,7 +1199,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
SetPointerOutsideMenu( false );
}
shared_ptr<ItemInstance> item = nullptr;
std::shared_ptr<ItemInstance> item = nullptr;
if(bPointerIsOverSlot && bSlotHasItem) item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, buttonX, buttonY, buttonRT);
@@ -1358,7 +1358,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
}
else
{
ui.CloseUIScenes(iPad);
ui.CloseUIScenes(iPad);
}
bHandled = true;
@@ -1410,7 +1410,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex);
if ( bSlotHasItem )
{
shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
std::shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
if( Minecraft::GetInstance()->localgameModes[iPad] != NULL )
{
Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails;
@@ -1456,7 +1456,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
{
handleOutsideClicked(iPad, buttonNum, quickKeyHeld);
}
else //
else //
{
// over empty space or something else???
handleOtherClicked(iPad,m_eCurrSection,buttonNum,quickKeyHeld?true:false);
@@ -1569,7 +1569,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection)
return currentIndex + getSectionStartOffset(eSection);
}
bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB)
bool IUIScene_AbstractContainerMenu::IsSameItemAs(std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB)
{
if(itemA == NULL || itemB == NULL) return false;
@@ -1583,7 +1583,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot)
if(slot != NULL && slot->hasItem())
{
shared_ptr<ItemInstance> item = slot->getItem();
std::shared_ptr<ItemInstance> item = slot->getItem();
if ( item->isStackable() )
{
int iCount = item->GetCount();
@@ -1614,7 +1614,7 @@ wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, vector<ws
}
else
{
firstLine = false;
firstLine = false;
wchar_t formatted[256];
eMinecraftColour rarityColour = slot->getItem()->getRarity()->color;
int colour = app.GetHTMLColour(rarityColour);
@@ -1624,7 +1624,7 @@ wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, vector<ws
colour = app.GetHTMLColour(eTextColor_RenamedItemTitle);
}
swprintf(formatted, 256, L"<font color=\"#%08x\">%ls</font>",colour,thisString.c_str());
swprintf(formatted, 256, L"<font color=\"#%08x\">%ls</font>",colour,thisString.c_str());
thisString = formatted;
}
desc.append( thisString );

View File

@@ -10,7 +10,7 @@
// Uncomment to enable acceleration on pointer input.
//#define USE_POINTER_ACCEL
#define POINTER_INPUT_TIMER_ID (0) // Arbitrary timer ID.
#define POINTER_INPUT_TIMER_ID (0) // Arbitrary timer ID.
#define POINTER_SPEED_FACTOR (13.0f) // Speed of pointer.
//#define POINTER_PANEL_OVER_REACH (42.0f) // Amount beyond edge of panel which pointer can go over to drop items. - comes from the pointer size in the scene
@@ -32,19 +32,19 @@ protected:
eSectionContainerInventory,
eSectionContainerChest,
eSectionContainerMax,
eSectionFurnaceUsing,
eSectionFurnaceInventory,
eSectionFurnaceIngredient,
eSectionFurnaceFuel,
eSectionFurnaceResult,
eSectionFurnaceMax,
eSectionInventoryUsing,
eSectionInventoryInventory,
eSectionInventoryArmor,
eSectionInventoryMax,
eSectionTrapUsing,
eSectionTrapInventory,
eSectionTrapTrap,
@@ -64,7 +64,7 @@ protected:
eSectionInventoryCreativeSlider,
#endif
eSectionInventoryCreativeMax,
eSectionEnchantUsing,
eSectionEnchantInventory,
eSectionEnchantSlot,
@@ -151,7 +151,7 @@ protected:
// 4J - WESTY - Added for pointer prototype.
// Current tooltip settings.
EToolTipItem m_aeToolTipSettings[ eToolTipNumButtons ];
// 4J - WESTY - Added for pointer prototype.
// Indicates if pointer is outside UI window (used to drop items).
bool m_bPointerOutsideMenu;
@@ -159,7 +159,7 @@ protected:
bool m_bSplitscreen;
bool m_bNavigateBack; // should we exit the xuiscenes or just navigate back on exit?
virtual bool IsSectionSlotList( ESceneSection eSection ) { return eSection != eSectionNone; }
virtual bool CanHaveFocus( ESceneSection eSection ) { return true; }
int GetSectionDimensions( ESceneSection eSection, int* piNumColumns, int* piNumRows );
@@ -180,7 +180,7 @@ protected:
// 4J - WESTY - Added for pointer prototype.
void SetPointerOutsideMenu( bool bOutside ) { m_bPointerOutsideMenu = bOutside; }
void Initialize(int m_iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack=FALSE);
virtual void PlatformInitialize(int iPad, int startIndex) = 0;
virtual void InitDataAssociations(int iPad, AbstractContainerMenu *menu, int startIndex = 0) = 0;
@@ -201,15 +201,15 @@ protected:
virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y) = 0;
virtual void setFocusToPointer(int iPad) = 0;
virtual void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot) = 0;
virtual shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot) = 0;
virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot) = 0;
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0;
virtual void adjustPointerForSafeZone() = 0;
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; }
private:
bool IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB);
bool IsSameItemAs(std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB);
int GetEmptyStackSpace(Slot *slot);
wstring GetItemDescription(Slot *slot, vector<wstring> &unformattedStrings);

View File

@@ -245,15 +245,15 @@ void IUIScene_AnvilMenu::updateItemName()
ByteArrayOutputStream baos;
DataOutputStream dos(&baos);
dos.writeUTF(m_itemName);
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
}
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items)
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<std::shared_ptr<ItemInstance> > *items)
{
slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem());
}
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr<ItemInstance> item)
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item)
{
if (slotIndex == RepairMenu::INPUT_SLOT)
{

View File

@@ -16,7 +16,7 @@ class RepairMenu;
class IUIScene_AnvilMenu : public virtual IUIScene_AbstractContainerMenu, public net_minecraft_world_inventory::ContainerListener
{
protected:
shared_ptr<Inventory> m_inventory;
std::shared_ptr<Inventory> m_inventory;
RepairMenu *m_repairMenu;
wstring m_itemName;
@@ -24,7 +24,7 @@ protected:
IUIScene_AnvilMenu();
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
int getSectionStartOffset(ESceneSection eSection);
int getSectionStartOffset(ESceneSection eSection);
virtual void handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey);
bool IsSectionSlotList( ESceneSection eSection );
@@ -39,7 +39,7 @@ protected:
void updateItemName();
// ContainerListenr
void refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items);
void slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr<ItemInstance> item);
void refreshContainer(AbstractContainerMenu *container, vector<std::shared_ptr<ItemInstance> > *items);
void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item);
void setContainerData(AbstractContainerMenu *container, int id, int value);
};

View File

@@ -91,7 +91,7 @@ IUIScene_CraftingMenu::_eGroupTab IUIScene_CraftingMenu::m_GroupTabBkgMapping3x3
// eBaseItemType_bow,
// eBaseItemType_pockettool,
// eBaseItemType_utensil,
//
//
// }
// eBaseItemType;
@@ -180,11 +180,11 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
UpdateTooltips();
break;
case ACTION_MENU_PAUSEMENU:
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);
@@ -197,18 +197,18 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
#endif
// Do some crafting!
if(m_pPlayer && m_pPlayer->inventory)
{
{
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
// Force a make if the debug is on
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
{
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
{
{
int iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
if( pMinecraft->localgameModes[iPad] != NULL)
@@ -244,7 +244,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
iSlot=0;
}
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
if( pMinecraft->localgameModes[iPad] != NULL )
@@ -256,7 +256,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
}
}
if(pRecipeIngredientsRequired[iRecipe].bCanMake[iPad])
if(pRecipeIngredientsRequired[iRecipe].bCanMake[iPad])
{
pTempItemInst->onCraftedBy(m_pPlayer->level, dynamic_pointer_cast<Player>( m_pPlayer->shared_from_this() ), pTempItemInst->count );
// TODO 4J Stu - handleCraftItem should do a lot more than what it does, loads of the "can we craft" code should also probably be
@@ -272,7 +272,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
{
for(int j=0;j<pRecipeIngredientsRequired[iRecipe].iIngValA[i];j++)
{
shared_ptr<ItemInstance> ingItemInst = nullptr;
std::shared_ptr<ItemInstance> ingItemInst = nullptr;
// do we need to remove a specific aux value?
if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE)
{
@@ -291,7 +291,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
if (ingItemInst->getItem()->hasCraftingRemainingItem())
{
// replace item with remaining result
m_pPlayer->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
m_pPlayer->inventory->add( std::shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
}
}
@@ -337,7 +337,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
break;
case ACTION_MENU_LEFT_SCROLL:
// turn off the old group tab
// turn off the old group tab
showTabHighlight(m_iGroupIndex,false);
if(m_iGroupIndex==0)
@@ -431,7 +431,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
// clear the indices
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
iVSlotIndexA[1]=0;
iVSlotIndexA[2]=1;
iVSlotIndexA[2]=1;
UpdateVerticalSlots();
UpdateHighlight();
@@ -482,13 +482,13 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
else
{
iVSlotIndexA[1]--;
}
}
ui.PlayUISFX(eSFX_Focus);
}
else
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>2)
{
{
{
if(m_iCurrentSlotVIndex!=0)
{
// just move the highlight
@@ -496,11 +496,11 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
ui.PlayUISFX(eSFX_Focus);
}
else
{
{
//move the slots
iVSlotIndexA[2]=iVSlotIndexA[1];
iVSlotIndexA[1]=iVSlotIndexA[0];
// on 0 and went up, so cycle the values
// on 0 and went up, so cycle the values
if(iVSlotIndexA[0]==0)
{
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
@@ -533,7 +533,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
{
if(bNoScrollSlots)
{
{
if(iVSlotIndexA[1]==(CanBeMadeA[m_iCurrentSlotHIndex].iCount-1))
{
iVSlotIndexA[1]=0;
@@ -574,7 +574,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
{
m_iCurrentSlotVIndex++;
ui.PlayUISFX(eSFX_Focus);
}
}
}
UpdateVerticalSlots();
UpdateHighlight();
@@ -624,11 +624,11 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
// for (int i = 0; i < iRecipeC; i++)
// {
// shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL);
// std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL);
// if (pTempItemInst != NULL)
// {
// wstring itemstring=pTempItemInst->toString();
//
//
// printf("Recipe [%d] = ",i);
// OutputDebugStringW(itemstring.c_str());
// if(pTempItemInst->id!=0)
@@ -642,7 +642,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
// {
// printf("ID\t%d\tAux val\t%d\tBase type\t%d\tMaterial\t%d Count=%d\n",pTempItemInst->id, pTempItemInst->getAuxValue(),pTempItemInst->getItem()->getBaseItemType(),pTempItemInst->getItem()->getMaterial(),pTempItemInst->GetCount());
// }
//
//
// }
// }
// }
@@ -683,9 +683,9 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
if (m_pPlayer->inventory->items[k] != NULL)
{
// do they have the ingredient, and the aux value matches, and enough off it?
if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) &&
if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) &&
// check if the ingredient required doesn't care about the aux value, or if it does, does the inventory item aux match it
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) || (pRecipeIngredientsRequired[i].iIngAuxValA[j]==m_pPlayer->inventory->items[k]->getAuxValue()))
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) || (pRecipeIngredientsRequired[i].iIngAuxValA[j]==m_pPlayer->inventory->items[k]->getAuxValue()))
)
{
// do they have enough? We need to check the whole inventory, since they may have enough in different slots (milk isn't milkx3, but milk,milk,milk)
@@ -721,18 +721,18 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
// 4J Stu - TU-1 hotfix
// Fix for #13143 - Players are able to craft items they do not have enough ingredients for if they store the ingredients in multiple, smaller stacks
break;
}
}
}
}
// if bFoundA[j] is false, then we didn't have enough of the ingredient required by the recipe, so mark the grid items we're short of
if(bFoundA[j]==false)
{
{
int iMissing = pRecipeIngredientsRequired[i].iIngValA[j]-iTotalCount;
int iGridIndex=0;
while(iMissing!=0)
{
// need to check if there is an aux val and match that
if(((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0x00FFFFFF)==pRecipeIngredientsRequired[i].iIngIDA[j]) &&
if(((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0x00FFFFFF)==pRecipeIngredientsRequired[i].iIngIDA[j]) &&
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) ||(pRecipeIngredientsRequired[i].iIngAuxValA[j]== ((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0xFF000000)>>24))) )
{
// this grid entry is the ingredient we don't have enough of
@@ -761,7 +761,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
if(iHSlotBrushControl<=m_iCraftablesMaxHSlotC)
{
bool bFound=false;
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr);
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr);
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
int iID=pTempItemInst->getItem()->id;
int iBaseType;
@@ -777,7 +777,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
// ignore for the misc base type - these have not been placed in a base type group
if(iBaseType!=Item::eBaseItemType_undefined)
{
{
for(int k=0;k<iHSlotBrushControl;k++)
{
// if the item base type is the same as one already in, then add it to that list
@@ -801,7 +801,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
if(!bFound)
{
if(iHSlotBrushControl<m_iCraftablesMaxHSlotC)
{
{
// add to the list
CanBeMadeA[iHSlotBrushControl].iItemBaseType=iBaseType;
CanBeMadeA[iHSlotBrushControl].iRecipeA[CanBeMadeA[iHSlotBrushControl].iCount++]=i;
@@ -824,7 +824,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
}
delete [] bFoundA;
itRecipe++;
itRecipe++;
}
}
@@ -835,7 +835,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
while((iIndex<m_iCraftablesMaxHSlotC) && CanBeMadeA[iIndex].iCount!=0)
{
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr);
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr);
assert(pTempItemInst->id!=0);
unsigned int uiAlpha;
@@ -844,7 +844,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
uiAlpha = 31;
}
else
{
{
if(pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].bCanMake[getPad()])
{
uiAlpha = 31;
@@ -903,7 +903,7 @@ void IUIScene_CraftingMenu::UpdateHighlight()
{
iSlot=0;
}
shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
std::shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
// special case for the torch coal/charcoal
int id=pTempItemInstAdditional->getDescriptionId();
@@ -933,10 +933,10 @@ void IUIScene_CraftingMenu::UpdateHighlight()
{
itemstring=app.GetString( IDS_ITEM_FIREBALLCOAL );
}
}
}
break;
default:
itemstring=app.GetString(id );
itemstring=app.GetString(id );
break;
}
@@ -991,7 +991,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots()
{
if(i!=1) continue;
}
shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr);
std::shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr);
assert(pTempItemInstAdditional->id!=0);
unsigned int uiAlpha;
@@ -1001,7 +1001,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots()
uiAlpha = 31;
}
else
{
{
if(pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].bCanMake[getPad()])
{
uiAlpha = 31;
@@ -1040,7 +1040,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
hideAllIngredientsSlots();
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
{
{
int iSlot,iRecipy;
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
{
@@ -1057,7 +1057,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
int iBoxWidth=(m_iContainerType==RECIPE_TYPE_2x2)?2:3;
int iRecipe=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
bool bCanMakeRecipe = pRecipeIngredientsRequired[iRecipe].bCanMake[getPad()];
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
m_iIngredientsC=pRecipeIngredientsRequired[iRecipe].iIngC;
@@ -1077,7 +1077,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
iAuxVal = 0xFF;
}
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal));
std::shared_ptr<ItemInstance> itemInst= std::shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal));
setIngredientDescriptionItem(getPad(),i,itemInst);
setIngredientDescriptionRedBox(i,false);
@@ -1124,13 +1124,13 @@ void IUIScene_CraftingMenu::DisplayIngredients()
}
}
for (int x = 0; x < iBoxWidth; x++)
for (int x = 0; x < iBoxWidth; x++)
{
for (int y = 0; y < iBoxWidth; y++)
for (int y = 0; y < iBoxWidth; y++)
{
int index = x+y*iBoxWidth;
if(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]!=0)
{
{
int id=pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0x00FFFFFF;
assert(id!=0);
int iAuxVal=(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0xFF000000)>>24;
@@ -1141,7 +1141,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
{
iAuxVal = 0xFF;
}
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
std::shared_ptr<ItemInstance> itemInst= std::shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
setIngredientSlotItem(getPad(),index,itemInst);
// show the ingredients we don't have if we can't make the recipe
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
@@ -1149,7 +1149,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
setIngredientSlotRedBox(index, false);
}
else
{
{
if((pRecipeIngredientsRequired[iRecipy].usBitmaskMissingGridIngredients[getPad()]&(1<<(x+y*3)))!=0)
{
setIngredientSlotRedBox(index, true);
@@ -1164,7 +1164,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
{
setIngredientSlotRedBox(index, false);
setIngredientSlotItem(getPad(),index,nullptr);
}
}
}
}
}
@@ -1188,7 +1188,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
{
setIngredientSlotRedBox(i, false);
setIngredientSlotItem(getPad(),i,nullptr);
}
}
}
}
@@ -1205,7 +1205,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
if(bCanBeMade)
{
{
int iSlot;//,iRecipy;
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
{
@@ -1218,7 +1218,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
//iRecipy=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[0];
}
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
int iID=pTempItemInst->getItem()->id;
int iAuxVal=pTempItemInst->getAuxValue();
int iBaseType;
@@ -1278,13 +1278,13 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
#ifdef _DEBUG
setDescriptionText(L"This is some placeholder description text about the craftable item.");
#else
setDescriptionText(L"");
setDescriptionText(L"");
#endif
}
}
}
else
{
setDescriptionText(L"");
setDescriptionText(L"");
}
}
@@ -1308,7 +1308,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
{
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
}
else
else
{
iSlot=0;
}
@@ -1348,7 +1348,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
{
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
}
else
else
{
iSlot=0;
}
@@ -1372,7 +1372,7 @@ bool IUIScene_CraftingMenu::isItemSelected(int itemId)
{
bool isSelected = false;
if(m_pPlayer && m_pPlayer->inventory)
{
{
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();

View File

@@ -22,7 +22,7 @@ protected:
static const int m_iMaxHSlotC = 12;
static const int m_iMaxHCraftingSlotC = 10;
static const int m_iMaxVSlotC = 17;
static const int m_iMaxVSlotC = 17;
static const int m_iMaxDisplayedVSlotC = 3;
static const int m_iIngredients3x3SlotC = 9;
static const int m_iIngredients2x2SlotC = 4;
@@ -35,7 +35,7 @@ protected:
static int m_iBaseTypeMapA[Item::eBaseItemType_MAXTYPES];
typedef struct
typedef struct
{
int iCount;
int iItemBaseType;
@@ -49,7 +49,7 @@ protected:
int m_iCurrentSlotVIndex;
int m_iRecipeC;
int m_iContainerType; // 2x2 or 3x3
shared_ptr<LocalPlayer> m_pPlayer;
std::shared_ptr<LocalPlayer> m_pPlayer;
int m_iGroupIndex;
int iVSlotIndexA[3]; // index of the v slots currently displayed
@@ -59,7 +59,7 @@ protected:
static Recipy::_eGroupType m_GroupTypeMapping9GridA[m_iMaxGroup3x3];
Recipy::_eGroupType *m_pGroupA;
static LPCWSTR m_GroupTabNameA[3];
static LPCWSTR m_GroupTabNameA[3];
static _eGroupTab m_GroupTabBkgMapping2x2A[m_iMaxGroup2x2];
static _eGroupTab m_GroupTabBkgMapping3x3A[m_iMaxGroup3x3];
_eGroupTab *m_pGroupTabA;
@@ -96,13 +96,13 @@ protected:
virtual void hideAllHSlots() = 0;
virtual void hideAllVSlots() = 0;
virtual void hideAllIngredientsSlots() = 0;
virtual void setCraftHSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
virtual void setCraftVSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
virtual void setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item) = 0;
virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item) = 0;
virtual void setCraftingOutputSlotRedBox(bool show) = 0;
virtual void setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item) = 0;
virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
virtual void setIngredientSlotRedBox(int index, bool show) = 0;
virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item) = 0;
virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
virtual void setIngredientDescriptionRedBox(int index, bool show) = 0;
virtual void setIngredientDescriptionText(int index, LPCWSTR text) = 0;
virtual void setShowCraftHSlot(int iIndex, bool show) = 0;

View File

@@ -12,16 +12,16 @@
// 4J JEV - Images for each tab.
IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = NULL;
vector< shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount];
vector< std::shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount];
#define ITEM(id) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0)) );
#define ITEM_AUX(id, aux) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) );
#define ITEM(id) list->push_back( std::shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0)) );
#define ITEM_AUX(id, aux) list->push_back( std::shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) );
#define DEF(index) list = &categoryGroups[index];
void IUIScene_CreativeMenu::staticCtor()
{
vector< shared_ptr<ItemInstance> > *list;
vector< std::shared_ptr<ItemInstance> > *list;
// Building Blocks
@@ -56,7 +56,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM_AUX(Tile::treeTrunk_Id, 0)
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::DARK_TRUNK)
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::BIRCH_TRUNK)
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::JUNGLE_TRUNK)
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::JUNGLE_TRUNK)
ITEM(Tile::gravel_Id)
ITEM(Tile::redBrick_Id)
ITEM(Tile::mossStone_Id)
@@ -118,7 +118,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM(Tile::sponge_Id)
ITEM(Tile::melon_Id)
ITEM(Tile::pumpkin_Id)
ITEM(Tile::litPumpkin_Id)
ITEM(Tile::litPumpkin_Id)
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_DEFAULT)
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_EVERGREEN)
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_BIRCH)
@@ -232,7 +232,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM_AUX(Tile::cobbleWall_Id, WallTile::TYPE_MOSSY)
ITEM(Item::bed_Id)
ITEM(Item::bucket_empty_Id)
ITEM(Item::bucket_lava_Id)
ITEM(Item::bucket_lava_Id)
ITEM(Item::bucket_water_Id)
ITEM(Item::milk_Id)
ITEM(Item::cauldron_Id)
@@ -292,7 +292,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM(Item::beef_cooked_Id)
ITEM(Item::beef_raw_Id)
ITEM(Item::chicken_raw_Id)
ITEM(Item::chicken_cooked_Id)
ITEM(Item::chicken_cooked_Id)
ITEM(Item::rotten_flesh_Id)
ITEM(Item::spiderEye_Id)
ITEM(Item::potato_Id)
@@ -314,7 +314,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM(Item::pickAxe_wood_Id)
ITEM(Item::hatchet_wood_Id)
ITEM(Item::hoe_wood_Id)
ITEM(Item::map_Id)
ITEM(Item::helmet_chain_Id)
ITEM(Item::chestplate_chain_Id)
@@ -325,7 +325,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM(Item::pickAxe_stone_Id)
ITEM(Item::hatchet_stone_Id)
ITEM(Item::hoe_stone_Id)
ITEM(Item::bow_Id)
ITEM(Item::helmet_iron_Id)
ITEM(Item::chestplate_iron_Id)
@@ -336,7 +336,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM(Item::pickAxe_iron_Id)
ITEM(Item::hatchet_iron_Id)
ITEM(Item::hoe_iron_Id)
ITEM(Item::arrow_Id)
ITEM(Item::helmet_gold_Id)
ITEM(Item::chestplate_gold_Id)
@@ -384,7 +384,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM(Item::brick_Id)
ITEM(Item::netherbrick_Id)
ITEM(Item::stick_Id)
ITEM(Item::bowl_Id)
ITEM(Item::bowl_Id)
ITEM(Item::bone_Id)
ITEM(Item::string_Id)
ITEM(Item::feather_Id)
@@ -393,13 +393,13 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM(Item::sulphur_Id)
ITEM(Item::clay_Id)
ITEM(Item::yellowDust_Id)
ITEM(Item::seeds_wheat_Id)
ITEM(Item::seeds_wheat_Id)
ITEM(Item::seeds_melon_Id)
ITEM(Item::seeds_pumpkin_Id)
ITEM(Item::wheat_Id)
ITEM(Item::reeds_Id)
ITEM(Item::egg_Id)
ITEM(Item::sugar_Id)
ITEM(Item::sugar_Id)
ITEM(Item::slimeBall_Id)
ITEM(Item::blazeRod_Id)
ITEM(Item::goldNugget_Id)
@@ -432,7 +432,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM(Item::magmaCream_Id)
ITEM(Item::speckledMelon_Id)
ITEM(Item::glassBottle_Id)
ITEM_AUX(Item::potion_Id,0) // Water bottle
ITEM_AUX(Item::potion_Id,0) // Water bottle
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_TYPE_AWKWARD)) // Awkward Potion
@@ -464,7 +464,7 @@ void IUIScene_CreativeMenu::staticCtor()
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTHEALTH))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_NIGHTVISION))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INVISIBILITY))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_WEAKNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_STRENGTH))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_SLOWNESS))
@@ -579,7 +579,7 @@ IUIScene_CreativeMenu::IUIScene_CreativeMenu()
m_creativeSlotX = m_creativeSlotY = m_inventorySlotX = m_inventorySlotY = 0;
// 4J JEV - Settup Tabs
for (int i = 0; i < eCreativeInventoryTab_COUNT; i++)
for (int i = 0; i < eCreativeInventoryTab_COUNT; i++)
{
m_tabDynamicPos[i] = 0;
m_tabPage[i] = 0;
@@ -594,7 +594,7 @@ void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab)
if(tab != m_curTab) updateTabHighlightAndText(tab);
m_curTab = tab;
updateScrollCurrentPage(m_tabPage[m_curTab] + 1, specs[m_curTab]->getPageCount());
specs[tab]->populateMenu(itemPickerMenu,m_tabDynamicPos[m_curTab], m_tabPage[m_curTab]);
@@ -605,7 +605,7 @@ void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab)
IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups)
: m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount)
{
m_pages = 0;
m_staticGroupsA = NULL;
@@ -708,10 +708,10 @@ unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount()
// 4J JEV - Item Picker Menu
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContainer> smp, shared_ptr<Inventory> inv ) : AbstractContainerMenu()
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( std::shared_ptr<SimpleContainer> smp, std::shared_ptr<Inventory> inv ) : AbstractContainerMenu()
{
inventory = inv;
creativeContainer = smp;
creativeContainer = smp;
//int startLength = slots->size();
@@ -734,7 +734,7 @@ IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContaine
containerId = CONTAINER_ID_CREATIVE;
}
bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(shared_ptr<Player> player)
bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(std::shared_ptr<Player> player)
{
return true;
}
@@ -752,7 +752,7 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_CreativeMenu::GetSectionA
switch( eSection )
{
case eSectionInventoryCreativeSelector:
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryCreativeUsing;
}
@@ -794,7 +794,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu
Minecraft *pMinecraft = Minecraft::GetInstance();
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
{
shared_ptr<ItemInstance> newItem = m_menu->getSlot(i)->getItem();
std::shared_ptr<ItemInstance> newItem = m_menu->getSlot(i)->getItem();
if(newItem != NULL)
{
@@ -813,7 +813,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q
// Drop items.
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[iPad]->inventory;
std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[iPad]->inventory;
if (playerInventory->getCarried() != NULL)
{
if (buttonNum == 0)
@@ -823,7 +823,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q
}
if (buttonNum == 1)
{
shared_ptr<ItemInstance> removedItem = playerInventory->getCarried()->remove(1);
std::shared_ptr<ItemInstance> removedItem = playerInventory->getCarried()->remove(1);
pMinecraft->localgameModes[iPad]->handleCreativeModeItemDrop(removedItem);
if (playerInventory->getCarried()->count == 0) playerInventory->setCarried(nullptr);
}
@@ -841,7 +841,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
dir = -1;
// Fall through intentional
case ACTION_MENU_RIGHT_SCROLL:
{
{
ECreativeInventoryTabs tab = (ECreativeInventoryTabs)(m_curTab + dir);
if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1);
if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks;
@@ -894,9 +894,9 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
if (buttonNum == 0)
{
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
shared_ptr<ItemInstance> carried = playerInventory->getCarried();
shared_ptr<ItemInstance> clicked = m_menu->getSlot(currentIndex)->getItem();
std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
std::shared_ptr<ItemInstance> carried = playerInventory->getCarried();
std::shared_ptr<ItemInstance> clicked = m_menu->getSlot(currentIndex)->getItem();
if (clicked != NULL)
{
playerInventory->setCarried(ItemInstance::clone(clicked));
@@ -928,7 +928,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
quickKeyHeld = FALSE;
}
m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]);
shared_ptr<ItemInstance> newItem = m_menu->getSlot(currentIndex)->getItem();
std::shared_ptr<ItemInstance> newItem = m_menu->getSlot(currentIndex)->getItem();
// call this function to synchronize multiplayer item bar
pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - (int)m_menu->slots->size() + 9 + InventoryMenu::USE_ROW_SLOT_START);
@@ -941,7 +941,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
m_iCurrSlotX = m_creativeSlotX;
m_iCurrSlotY = m_creativeSlotY;
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
playerInventory->setCarried(nullptr);
m_bCarryingCreativeItem = false;
}
@@ -970,14 +970,14 @@ bool IUIScene_CreativeMenu::CanHaveFocus( ESceneSection eSection )
return false;
}
bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX)
bool IUIScene_CreativeMenu::getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int &slotX)
{
bool sameItemFound = false;
bool emptySlotFound = false;
// Jump to the slot with this item already on it, if we can stack more
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
{
shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
std::shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
if( slotItem != NULL && slotItem->sameItem(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() ))
{
sameItemFound = true;
@@ -1020,7 +1020,7 @@ int IUIScene_CreativeMenu::getSectionStartOffset(ESceneSection eSection)
return offset;
}
bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT)
{
bool _override = false;

View File

@@ -74,21 +74,21 @@ public:
class ItemPickerMenu : public AbstractContainerMenu
{
protected:
shared_ptr<SimpleContainer> creativeContainer;
shared_ptr<Inventory> inventory;
std::shared_ptr<SimpleContainer> creativeContainer;
std::shared_ptr<Inventory> inventory;
public:
ItemPickerMenu( shared_ptr<SimpleContainer> creativeContainer, shared_ptr<Inventory> inventory );
ItemPickerMenu( std::shared_ptr<SimpleContainer> creativeContainer, std::shared_ptr<Inventory> inventory );
virtual bool stillValid(shared_ptr<Player> player);
virtual bool stillValid(std::shared_ptr<Player> player);
bool isOverrideResultClick(int slotNum, int buttonNum);
protected:
// 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr<Player> player) { } // do nothing
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr<Player> player) { } // do nothing
} *itemPickerMenu;
protected:
static vector< shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount];
static vector< std::shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount];
// 4J JEV - Tabs
static TabSpec **specs;
@@ -112,11 +112,11 @@ protected:
virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld);
virtual void handleAdditionalKeyPress(int iAction);
virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld);
bool getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX);
bool getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int &slotX);
int getSectionStartOffset(ESceneSection eSection);
virtual bool IsSectionSlotList( ESceneSection eSection );
virtual bool CanHaveFocus( ESceneSection eSection );
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT);
};

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"";

View File

@@ -7,7 +7,7 @@ class IUIScene_TradingMenu
{
protected:
MerchantMenu *m_menu;
shared_ptr<Merchant> m_merchant;
std::shared_ptr<Merchant> m_merchant;
vector< pair<MerchantRecipe *,int> > m_activeOffers;
int m_validOffersCount;
@@ -39,20 +39,20 @@ protected:
virtual void setRequest1RedBox(bool show) = 0;
virtual void setRequest2RedBox(bool show) = 0;
virtual void setTradeRedBox(int index, bool show) = 0;
virtual void setOfferDescription(const wstring &name, vector<wstring> &unformattedStrings) = 0;
virtual void setRequest1Item(shared_ptr<ItemInstance> item);
virtual void setRequest2Item(shared_ptr<ItemInstance> item);
virtual void setTradeItem(int index, shared_ptr<ItemInstance> item);
virtual void setRequest1Item(std::shared_ptr<ItemInstance> item);
virtual void setRequest2Item(std::shared_ptr<ItemInstance> item);
virtual void setTradeItem(int index, std::shared_ptr<ItemInstance> item);
private:
void updateDisplay();
bool canMake(MerchantRecipe *recipe);
wstring GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings);
wstring GetItemDescription(std::shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings);
public:
shared_ptr<Merchant> getMerchant();
std::shared_ptr<Merchant> getMerchant();
virtual int getPad() = 0;
};

View File

@@ -126,7 +126,7 @@ void UIComponent_TutorialPopup::handleTimerComplete(int id)
}
void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const wstring &desc, const wstring &title, bool allowFade, bool isReminder)
{
{
m_interactScene = interactScene;
app.DebugPrintf("Setting m_interactScene to %08x\n", m_interactScene);
if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL;
@@ -204,12 +204,12 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
wstring temp(desc);
bool isFixedIcon = false;
m_iconIsFoil = isFoil;
if( icon != TUTORIAL_NO_ICON )
{
m_iconIsFoil = false;
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal));
}
else
{
@@ -238,72 +238,72 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
{
iAuxVal = 0;
}
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal));
temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L"");
}
}
// remove any icon text
else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0));
}
else if(temp.find(L"{*SticksIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0));
}
else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0));
}
else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0));
}
else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0));
}
else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0));
}
else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0));
}
else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0));
}
else if(temp.find(L"{*TorchIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0));
}
else if(temp.find(L"{*BoatIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0));
}
else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0));
}
else if(temp.find(L"{*FishIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0));
}
else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0));
}
else if(temp.find(L"{*RailIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0));
}
else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0));
}
else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos)
{
@@ -317,7 +317,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
}
else if(temp.find(L"{*StoneIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0));
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0));
}
else
{
@@ -358,7 +358,7 @@ wstring UIComponent_TutorialPopup::_SetImage(wstring &desc)
// hide the icon slot
m_image.SetShow( FALSE );
}
BOOL imageShowAtEnd = m_image.IsShown();
if(imageShowAtStart != imageShowAtEnd)
{

View File

@@ -15,7 +15,7 @@ private:
bool m_lastSceneMovedLeft;
bool m_bAllowFade;
Tutorial *m_tutorial;
shared_ptr<ItemInstance> m_iconItem;
std::shared_ptr<ItemInstance> m_iconItem;
bool m_iconIsFoil;
//int m_iLocalPlayerC;

View File

@@ -100,7 +100,7 @@ void UIControl_EnchantmentBook::tickBook()
{
UIScene_EnchantingMenu *m_containerScene = (UIScene_EnchantingMenu *)m_parentScene;
EnchantmentMenu *menu = m_containerScene->getMenu();
shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
std::shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
if (!ItemInstance::matches(current, last))
{
last = current;
@@ -122,7 +122,7 @@ void UIControl_EnchantmentBook::tickBook()
{
shouldBeOpen = true;
}
}
}
if (shouldBeOpen) open += 0.2f;
else open -= 0.2f;

View File

@@ -19,7 +19,7 @@ private:
//BOOL m_bDirty;
//float m_fScale,m_fAlpha;
//int m_iPad;
shared_ptr<ItemInstance> last;
std::shared_ptr<ItemInstance> last;
//float m_fScreenWidth,m_fScreenHeight;
//float m_fRawWidth,m_fRawHeight;

View File

@@ -597,7 +597,7 @@ void UIScene::customDraw(IggyCustomDrawCallbackRegion *region)
app.DebugPrintf("Handling custom draw for scene with no override!\n");
}
void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations)
void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations)
{
if (item!= NULL)
{
@@ -608,7 +608,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
//Make sure that pMinecraft->player is the correct player so that player specific rendering
// eg clock and compass, are rendered correctly
Minecraft *pMinecraft=Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
std::shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad];
// Setup GDraw, normal game render states and matrices
@@ -688,7 +688,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
//Make sure that pMinecraft->player is the correct player so that player specific rendering
// eg clock and compass, are rendered correctly
shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
std::shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad];
_customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, false);
@@ -701,7 +701,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
}
}
void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer)
void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer)
{
Minecraft *pMinecraft=Minecraft::GetInstance();

View File

@@ -187,7 +187,7 @@ public:
protected:
//void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations);
void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations);
void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations);
bool m_cacheSlotRenders;
bool m_needsCacheRendered;
@@ -196,14 +196,14 @@ private:
typedef struct _CachedSlotDrawData
{
CustomDrawData *customDrawRegion;
shared_ptr<ItemInstance> item;
std::shared_ptr<ItemInstance> item;
float fAlpha;
bool isFoil;
bool bDecorations;
} CachedSlotDrawData;
vector<CachedSlotDrawData *> m_cachedSlotDraw;
void _customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer);
void _customDrawSlotControl(CustomDrawData *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer);
public:
// INPUT

View File

@@ -49,7 +49,7 @@ void UIScene_AbstractContainerMenu::handleDestroy()
}
// 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss.
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
if(pMinecraft->localplayers[m_iPad] != NULL) pMinecraft->localplayers[m_iPad]->closeContainer();
ui.OverrideSFX(m_iPad,ACTION_MENU_A,false);
@@ -90,7 +90,7 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
// We may have varying depths of controls here, so base off the pointers parent
#if TO_BE_IMPLEMENTED
HXUIOBJ parent;
XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight );
XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight );
#else
fPointerWidth = 50;
fPointerHeight = 50;
@@ -103,7 +103,7 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
// Get size of pointer
m_fPointerImageOffsetX = 0; //floor(fPointerWidth/2.0f);
m_fPointerImageOffsetY = 0; //floor(fPointerHeight/2.0f);
m_fPanelMinX = fPanelX;
m_fPanelMaxX = fPanelX + fPanelWidth;
m_fPanelMinY = fPanelY;
@@ -111,9 +111,9 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
#ifdef __ORBIS__
// we need to map the touchpad rectangle to the UI rectangle. While it works great for the creative menu, it is much too sensitive for the smaller menus.
//X coordinate of the touch point (0 to 1919)
//Y coordinate of the touch point (0 to 941: DUALSHOCK<43>4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation<6F>4 development tool,
//0 to 753: JDX-1000x series controllers for the PlayStation<6F>4 development tool,)
//X coordinate of the touch point (0 to 1919)
//Y coordinate of the touch point (0 to 941: DUALSHOCK<43>4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation<6F>4 development tool,
//0 to 753: JDX-1000x series controllers for the PlayStation<6F>4 development tool,)
m_fTouchPadMulX=fPanelWidth/1919.0f;
m_fTouchPadMulY=fPanelHeight/941.0f;
m_fTouchPadDeadZoneX=15.0f*m_fTouchPadMulX;
@@ -161,13 +161,13 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
S32 width, height;
m_parentLayer->getRenderDimensions(width, height);
S32 x = m_pointerPos.x*((float)width/m_movieWidth);
S32 y = m_pointerPos.y*((float)height/m_movieHeight);
S32 y = m_pointerPos.y*((float)height/m_movieHeight);
IggyMakeEventMouseMove( &mouseEvent, x, y);
IggyEventResult result;
IggyPlayerDispatchEventRS ( getMovie() , &mouseEvent , &result );
#ifdef USE_POINTER_ACCEL
#ifdef USE_POINTER_ACCEL
m_fPointerVelX = 0.0f;
m_fPointerVelY = 0.0f;
m_fPointerAccelX = 0.0f;
@@ -332,9 +332,9 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
shared_ptr<ItemInstance> item = nullptr;
std::shared_ptr<ItemInstance> item = nullptr;
if(wcscmp((wchar_t *)region->name,L"pointerIcon")==0)
{
{
m_cacheSlotRenders = false;
item = pMinecraft->localplayers[m_iPad]->inventory->getCarried();
}
@@ -347,7 +347,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
app.DebugPrintf("This is not the control we are looking for\n");
}
else
{
{
m_cacheSlotRenders = true;
Slot *slot = m_menu->getSlot(slotId);
item = slot->getItem();
@@ -398,7 +398,7 @@ void UIScene_AbstractContainerMenu::setFocusToPointer(int iPad)
m_focusSection = eSectionNone;
}
shared_ptr<ItemInstance> UIScene_AbstractContainerMenu::getSlotItem(ESceneSection eSection, int iSlot)
std::shared_ptr<ItemInstance> UIScene_AbstractContainerMenu::getSlotItem(ESceneSection eSection, int iSlot)
{
Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot );
if(slot) return slot->getItem();

View File

@@ -31,7 +31,7 @@ protected:
UI_MAP_ELEMENT( m_labelInventory, "inventoryLabel")
UI_END_MAP_CHILD_ELEMENTS()
UI_END_MAP_ELEMENTS_AND_NAMES()
public:
UIScene_AbstractContainerMenu(int iPad, UILayer *parentLayer);
~UIScene_AbstractContainerMenu();
@@ -49,7 +49,7 @@ protected:
virtual void setSectionFocus(ESceneSection eSection, int iPad);
void setFocusToPointer(int iPad);
void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot);
virtual shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot);
virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot);
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot);
virtual void adjustPointerForSafeZone();
@@ -57,7 +57,7 @@ protected:
public:
virtual void tick();
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewpBort);
virtual void customDraw(IggyCustomDrawCallbackRegion *region);

View File

@@ -8,7 +8,7 @@ class InventoryMenu;
class UIScene_BrewingStandMenu : public UIScene_AbstractContainerMenu, public IUIScene_BrewingMenu
{
private:
shared_ptr<BrewingStandTileEntity> m_brewingStand;
std::shared_ptr<BrewingStandTileEntity> m_brewingStand;
public:
UIScene_BrewingStandMenu(int iPad, void *initData, UILayer *parentLayer);

View File

@@ -51,7 +51,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p
// if we are in splitscreen, then we need to figure out if we want to move this scene
if(m_bSplitscreen)
{
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
}
XuiElementSetShow(m_hGrid,TRUE);
@@ -76,7 +76,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p
#if TO_BE_IMPLEMENTED
// display the first group tab
// display the first group tab
m_hTabGroupA[m_iGroupIndex].SetShow(TRUE);
// store the slot 0 position
@@ -196,7 +196,7 @@ void UIScene_CraftingMenu::handleDestroy()
if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
}
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
ui.OverrideSFX(m_iPad,ACTION_MENU_A,false);
@@ -297,7 +297,7 @@ void UIScene_CraftingMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
else
{
iVSlotIndexA[1]--;
}
}
ui.PlayUISFX(eSFX_Focus);
UpdateVerticalSlots();
@@ -349,7 +349,7 @@ void UIScene_CraftingMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
// clear the indices
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
iVSlotIndexA[1]=0;
iVSlotIndexA[2]=1;
iVSlotIndexA[2]=1;
UpdateVerticalSlots();
UpdateHighlight();
@@ -435,7 +435,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region)
Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
shared_ptr<ItemInstance> item = nullptr;
std::shared_ptr<ItemInstance> item = nullptr;
int slotId = -1;
float alpha = 1.0f;
bool decorations = true;
@@ -606,21 +606,21 @@ void UIScene_CraftingMenu::hideAllIngredientsSlots()
}
}
void UIScene_CraftingMenu::setCraftHSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha)
void UIScene_CraftingMenu::setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha)
{
m_hSlotsInfo[iIndex].item = item;
m_hSlotsInfo[iIndex].alpha = uiAlpha;
m_hSlotsInfo[iIndex].show = true;
}
void UIScene_CraftingMenu::setCraftVSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha)
void UIScene_CraftingMenu::setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha)
{
m_vSlotsInfo[iIndex].item = item;
m_vSlotsInfo[iIndex].alpha = uiAlpha;
m_vSlotsInfo[iIndex].show = true;
}
void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item)
void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item)
{
m_craftingOutputSlotInfo.item = item;
m_craftingOutputSlotInfo.alpha = 31;
@@ -632,7 +632,7 @@ void UIScene_CraftingMenu::setCraftingOutputSlotRedBox(bool show)
m_slotListCraftingOutput.showSlotRedBox(0,show);
}
void UIScene_CraftingMenu::setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item)
void UIScene_CraftingMenu::setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item)
{
m_ingredientsSlotsInfo[index].item = item;
m_ingredientsSlotsInfo[index].alpha = 31;
@@ -644,7 +644,7 @@ void UIScene_CraftingMenu::setIngredientSlotRedBox(int index, bool show)
m_slotListIngredientsLayout.showSlotRedBox(index,show);
}
void UIScene_CraftingMenu::setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item)
void UIScene_CraftingMenu::setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item)
{
m_ingredientsInfo[index].item = item;
m_ingredientsInfo[index].alpha = 31;
@@ -680,7 +680,7 @@ void UIScene_CraftingMenu::setShowCraftHSlot(int iIndex, bool show)
void UIScene_CraftingMenu::showTabHighlight(int iIndex, bool show)
{
if(show)
{
{
IggyDataValue result;
IggyDataValue value[1];
@@ -729,7 +729,7 @@ void UIScene_CraftingMenu::scrollDescriptionDown()
void UIScene_CraftingMenu::updateHighlightAndScrollPositions()
{
{
{
IggyDataValue result;
IggyDataValue value[2];

View File

@@ -32,7 +32,7 @@ class UIScene_CraftingMenu : public UIScene, public IUIScene_CraftingMenu
private:
typedef struct _SlotInfo
{
shared_ptr<ItemInstance> item;
std::shared_ptr<ItemInstance> item;
unsigned int alpha;
bool show;
@@ -97,7 +97,7 @@ protected:
ETouchInput_TouchPanel_5,
ETouchInput_TouchPanel_6,
ETouchInput_CraftingHSlots,
ETouchInput_Count,
};
UIControl_Touch m_TouchInput[ETouchInput_Count];
@@ -182,13 +182,13 @@ protected:
virtual void hideAllHSlots();
virtual void hideAllVSlots();
virtual void hideAllIngredientsSlots();
virtual void setCraftHSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha);
virtual void setCraftVSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha);
virtual void setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item);
virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha);
virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha);
virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item);
virtual void setCraftingOutputSlotRedBox(bool show);
virtual void setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item);
virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item);
virtual void setIngredientSlotRedBox(int index, bool show);
virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item);
virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item);
virtual void setIngredientDescriptionRedBox(int index, bool show);
virtual void setIngredientDescriptionText(int index, LPCWSTR text);
virtual void setShowCraftHSlot(int iIndex, bool show);

View File

@@ -21,7 +21,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p
InventoryScreenInput *initData = (InventoryScreenInput *)_initData;
shared_ptr<SimpleContainer> creativeContainer = shared_ptr<SimpleContainer>(new SimpleContainer( 0, TabSpec::MAX_SIZE ));
std::shared_ptr<SimpleContainer> creativeContainer = std::shared_ptr<SimpleContainer>(new SimpleContainer( 0, TabSpec::MAX_SIZE ));
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack);
@@ -96,7 +96,7 @@ void UIScene_CreativeMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
{
// calculate relative touch position on slider
float fPosition = ((float)y - (float)m_TouchInput[ETouchInput_TouchSlider].getYPos() - m_controlMainPanel.getYPos()) / (float)m_TouchInput[ETouchInput_TouchSlider].getHeight();
// clamp
if(fPosition > 1)
fPosition = 1.0f;
@@ -105,7 +105,7 @@ void UIScene_CreativeMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
// calculate page position according to page count
int iCurrentPage = Math::round(fPosition * (specs[m_curTab]->getPageCount() - 1));
// set tab page
m_tabPage[m_curTab] = iCurrentPage;
@@ -208,7 +208,7 @@ void UIScene_CreativeMenu::handleInput(int iPad, int key, bool repeat, bool pres
dir = -1;
// Fall through intentional
case VK_PAD_RSHOULDER:
{
{
ECreativeInventoryTabs tab = (ECreativeInventoryTabs)(m_curTab + dir);
if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1);
if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks;

View File

@@ -127,7 +127,7 @@ void UIScene_DebugOverlay::customDraw(IggyCustomDrawCallbackRegion *region)
}
else
{
shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>( new ItemInstance(itemId,1,0) );
std::shared_ptr<ItemInstance> item = std::shared_ptr<ItemInstance>( new ItemInstance(itemId,1,0) );
if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,false,false);
}
}
@@ -176,7 +176,7 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId)
{
int id = childId;
if(id<m_mobFactories.size())
{
{
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_SpawnMob,(void *)m_mobFactories[id]);
}
}

View File

@@ -8,7 +8,7 @@ class InventoryMenu;
class UIScene_FurnaceMenu : public UIScene_AbstractContainerMenu, public IUIScene_FurnaceMenu
{
private:
shared_ptr<FurnaceTileEntity> m_furnace;
std::shared_ptr<FurnaceTileEntity> m_furnace;
public:
UIScene_FurnaceMenu(int iPad, void *initData, UILayer *parentLayer);

View File

@@ -161,7 +161,7 @@ void UIScene_HUD::tick()
}
else
{
shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
std::shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
// 4J Stu - Don't clear this here as it's wiped for other players
//EnderDragonRenderer::bossInstance = nullptr;
m_ticksWithNoBoss = 0;
@@ -191,7 +191,7 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region)
else
{
Slot *invSlot = pMinecraft->localplayers[m_iPad]->inventoryMenu->getSlot(InventoryMenu::USE_ROW_SLOT_START + slot);
shared_ptr<ItemInstance> item = invSlot->getItem();
std::shared_ptr<ItemInstance> item = invSlot->getItem();
if(item != NULL)
{
unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity);
@@ -265,7 +265,7 @@ void UIScene_HUD::handleReload()
}
m_labelJukebox.init(L"");
int iGuiScale;
int iGuiScale;
Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@@ -629,7 +629,7 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor
}
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
m_renderWidth = tileWidth;
m_renderHeight = tileHeight;
@@ -639,7 +639,7 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor
tileYStart ,
tileXStart + tileWidth ,
tileYStart + tileHeight ,
0 );
0 );
IggyPlayerDrawTilesEnd ( getMovie() );
}
else
@@ -651,7 +651,7 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor
void UIScene_HUD::handleTimerComplete(int id)
{
Minecraft *pMinecraft = Minecraft::GetInstance();
bool anyVisible = false;
if(pMinecraft->localplayers[m_iPad]!= NULL)
{
@@ -735,7 +735,7 @@ void UIScene_HUD::SetDisplayName(const wstring &displayName)
if(displayName.compare(m_displayName) != 0)
{
m_displayName = displayName;
IggyDataValue result;
IggyDataValue value[1];
IggyStringUTF16 stringVal;
@@ -775,7 +775,7 @@ void UIScene_HUD::handleGameTick()
}
m_parentLayer->showComponent(m_iPad, eUIScene_HUD,true);
int iGuiScale;
int iGuiScale;
if(pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@@ -788,7 +788,7 @@ void UIScene_HUD::handleGameTick()
SetHudSize(iGuiScale);
SetDisplayName(ProfileManager.GetDisplayName(m_iPad));
SetTooltipsEnabled(((ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) || (app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_Tooltips) != 0)));
#if TO_BE_IMPLEMENTED
@@ -797,8 +797,8 @@ void UIScene_HUD::handleGameTick()
{
int iTooltipsYOffset = 0;
// if tooltips are off, set the y offset to zero
if(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)==0)
{
if(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)==0)
{
switch(iGuiScale)
{
case 0:
@@ -987,11 +987,11 @@ void UIScene_HUD::handleGameTick()
bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(m_iPad) && !(app.GetXuiAction(m_iPad)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)!=0;
if(bDisplayGui && pMinecraft->localplayers[m_iPad] != NULL)
{
setVisible(true);
setVisible(true);
}
else
{
setVisible(false);
setVisible(false);
}
}
}

View File

@@ -65,11 +65,11 @@ void UIScene_InGameHostOptionsMenu::handleInput(int iPad, int key, bool repeat,
// Send update settings packet to server
if(hostOptions != app.GetGameHostOption(eGameHostOption_All) )
{
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
Minecraft *pMinecraft = Minecraft::GetInstance();
std::shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
if(player->connection)
{
player->connection->send( shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) );
player->connection->send( std::shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) );
}
}

View File

@@ -67,7 +67,7 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer
m_playersVoiceState[i] = voiceStatus;
m_playersColourState[i] = app.GetPlayerColour( m_players[i] );
m_playerNames[i] = playerName;
m_playerList.addItem( playerName, app.GetPlayerColour( m_players[i] ), voiceStatus);
m_playerList.addItem( playerName, app.GetPlayerColour( m_players[i] ), voiceStatus);
}
}
@@ -78,7 +78,7 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer
if(thisPlayer != NULL) m_isHostPlayer = thisPlayer->IsHost() == TRUE;
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
std::shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
if(!m_isHostPlayer && !localPlayer->isModerator() )
{
removeControl( &m_buttonGameOptions, false );
@@ -131,7 +131,7 @@ void UIScene_InGameInfoMenu::updateTooltips()
int keyA = -1;
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
std::shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
bool isOp = m_isHostPlayer || localPlayer->isModerator();
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
@@ -161,7 +161,7 @@ void UIScene_InGameInfoMenu::updateTooltips()
}
}
}
#if defined(__PS3__) || defined(__ORBIS__)
if(m_iPad == ProfileManager.GetPrimaryPad() ) ikeyY = IDS_TOOLTIPS_GAME_INVITES;
#else
@@ -243,7 +243,7 @@ void UIScene_InGameInfoMenu::handleReload()
m_playersVoiceState[i] = voiceStatus;
m_playersColourState[i] = app.GetPlayerColour( m_players[i] );
m_playerNames[i] = playerName;
m_playerList.addItem( playerName, app.GetPlayerColour( m_players[i] ), voiceStatus);
m_playerList.addItem( playerName, app.GetPlayerColour( m_players[i] ), voiceStatus);
}
}
@@ -252,7 +252,7 @@ void UIScene_InGameInfoMenu::handleReload()
if(thisPlayer != NULL) m_isHostPlayer = thisPlayer->IsHost() == TRUE;
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
std::shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
if(!m_isHostPlayer && !localPlayer->isModerator() )
{
removeControl( &m_buttonGameOptions, false );
@@ -367,7 +367,7 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr
#else // __PS3__
int ret = sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID);
app.DebugPrintf("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret);
#endif
#endif
}
}
#else
@@ -397,7 +397,7 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr
if(pressed && !repeat && !g_NetworkManager.IsLocalGame() )
{
#ifdef __PSVITA__
if(CGameNetworkManager::usingAdhocMode() == false)
if(CGameNetworkManager::usingAdhocMode() == false)
g_NetworkManager.SendInviteGUI(iPad);
#else
g_NetworkManager.SendInviteGUI(iPad);
@@ -431,7 +431,7 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId)
INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId( m_players[ currentSelection ] );
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
std::shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
bool isOp = m_isHostPlayer || localPlayer->isModerator();
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
@@ -544,7 +544,7 @@ void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer
}
}
scene->m_playerList.addItem( playerName, app.GetPlayerColour( scene->m_players[scene->m_playersCount - 1] ), voiceStatus);
scene->m_playerList.addItem( playerName, app.GetPlayerColour( scene->m_players[scene->m_playersCount - 1] ), voiceStatus);
}
}
@@ -554,12 +554,12 @@ int UIScene_InGameInfoMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage:
delete pParam;
if(result==C4JStorage::EMessage_ResultAccept)
{
{
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
std::shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
if(localPlayer->connection)
{
localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
localPlayer->connection->send( std::shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
}
}
@@ -571,7 +571,7 @@ int UIScene_InGameInfoMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStora
{
UIScene_InGameInfoMenu* pClass = (UIScene_InGameInfoMenu*)pParam;
if(result==C4JStorage::EMessage_ResultAccept)
if(result==C4JStorage::EMessage_ResultAccept)
{
#ifdef __PS3__
SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_InGameInfoMenu::ViewInvites_SignInReturned, pClass);

View File

@@ -66,7 +66,7 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void
#else
m_checkboxes[eControl_Op].init(L"DEBUG: Creative",eControl_Op,Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode));
#endif
removeControl( &m_buttonKick, true );
removeControl( &m_checkboxes[eControl_CheatTeleport], true );
@@ -129,7 +129,7 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void
m_checkboxes[eControl_HostHunger].SetEnable(true);
checked = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanToggleClassicHunger)!=0;
m_checkboxes[eControl_HostHunger].init( app.GetString(IDS_CAN_DISABLE_EXHAUSTION), eControl_HostHunger, checked);
checked = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanTeleport)!=0;
m_checkboxes[eControl_CheatTeleport].init(app.GetString(IDS_ENABLE_TELEPORT),eControl_CheatTeleport,checked);
}
@@ -315,11 +315,11 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
if(originalPrivileges != m_playerPrivileges)
{
// Send update settings packet to server
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
Minecraft *pMinecraft = Minecraft::GetInstance();
std::shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
if(player->connection)
{
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) );
player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) );
}
}
navigateBack();
@@ -364,12 +364,12 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4
delete pParam;
if(result==C4JStorage::EMessage_ResultAccept)
{
{
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
std::shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
if(localPlayer->connection)
{
localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
localPlayer->connection->send( std::shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
}
// Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game.
@@ -405,7 +405,7 @@ void UIScene_InGamePlayerOptionsMenu::resetCheatCheckboxes()
m_checkboxes[eControl_HostInvisible].SetEnable(isModerator);
m_checkboxes[eControl_HostFly].SetEnable(isModerator);
m_checkboxes[eControl_HostHunger].SetEnable(isModerator);
m_checkboxes[eControl_CheatTeleport].SetEnable(isModerator);
m_checkboxes[eControl_CheatTeleport].SetEnable(isModerator);
}
}

View File

@@ -32,7 +32,7 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Inventory_Menu, this);
}
InventoryMenu *menu = (InventoryMenu *)initData->player->inventoryMenu;
initData->player->awardStat(GenericStats::openInventory(),GenericStats::param_openInventory());
@@ -251,7 +251,7 @@ void UIScene_InventoryMenu::updateEffectsDisplay()
{
// Update with the current effects
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
std::shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
if(player == NULL) return;
@@ -262,7 +262,7 @@ void UIScene_InventoryMenu::updateEffectsDisplay()
IggyDataValue *UpdateValue = new IggyDataValue[activeEffects->size()*2];
for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it)
{
{
MobEffectInstance *effect = *it;
if(effect->getDuration() >= m_bEffectTime[effect->getId()])

View File

@@ -9,7 +9,7 @@
#define PLAYER_ONLINE_TIMER_TIME 100
// if the value is greater than 32000, it's an xzp icon that needs displayed, rather than the game icon
const int UIScene_LeaderboardsMenu::TitleIcons[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] =
const int UIScene_LeaderboardsMenu::TitleIcons[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] =
{
{ UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, NULL },
{ Tile::dirt_Id, Tile::stoneBrick_Id, Tile::sand_Id, Tile::rock_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id },
@@ -36,7 +36,7 @@ const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu::
UIScene_LeaderboardsMenu::LeaderboardDescriptor( 6, false, IDS_LEADERBOARD_FARMING_HARD), // Farming Hard
},
{
UIScene_LeaderboardsMenu::LeaderboardDescriptor( 0, false, -1), //
UIScene_LeaderboardsMenu::LeaderboardDescriptor( 0, false, -1), //
UIScene_LeaderboardsMenu::LeaderboardDescriptor( 7, false, IDS_LEADERBOARD_KILLS_EASY), // Kills Easy
UIScene_LeaderboardsMenu::LeaderboardDescriptor( 7, false, IDS_LEADERBOARD_KILLS_NORMAL), // Kills Normal
UIScene_LeaderboardsMenu::LeaderboardDescriptor( 7, false, IDS_LEADERBOARD_KILLS_HARD), // Kills Hard
@@ -132,7 +132,7 @@ void UIScene_LeaderboardsMenu::updateTooltips()
selection < (GetEntryStartIndex() + m_leaderboard.m_entries.size()) )
{
#ifdef _XBOX
if( (m_leaderboard.m_entries[selection - (m_leaderboard.m_entryStartIndex-1)].m_bFriend==false)
if( (m_leaderboard.m_entries[selection - (m_leaderboard.m_entryStartIndex-1)].m_bFriend==false)
&& (m_leaderboard.m_entries[selection - (m_leaderboard.m_entryStartIndex-1)].m_bRequestedFriend==false))
#endif
{
@@ -267,7 +267,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, bool
SetLeaderboardHeader();
ReadStats(-1);
ReadStats(-1);
ui.PlayUISFX(eSFX_Press);
}
handled = true;
@@ -284,7 +284,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, bool
if( m_leaderboard.m_totalEntryCount <= 10 )
break;
sendInputToMovie(key, repeat, pressed, released);
#if 0
@@ -441,7 +441,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex)
}
//app.DebugPrintf("Requesting stats read %d - %d - %d\n", m_currentLeaderboard, startIndex == -1 ? m_currentFilter : LeaderboardManager::eFM_TopRank, m_currentDifficulty);
LeaderboardManager::EFilterMode filtermode;
if ( m_currentFilter == LeaderboardManager::eFM_MyScore
|| m_currentFilter == LeaderboardManager::eFM_TopRank )
@@ -457,8 +457,8 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex)
switch (filtermode)
{
case LeaderboardManager::eFM_TopRank:
LeaderboardManager::Instance()->ReadStats_TopRank( this,
m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard,
LeaderboardManager::Instance()->ReadStats_TopRank( this,
m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard,
m_newEntryIndex, m_newReadSize
);
break;
@@ -529,7 +529,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats()
{
m_leaderboard.m_totalEntryCount = NUM_ENTRIES;
m_leaderboard.m_numColumns = LEADERBOARD_DESCRIPTORS[m_currentLeaderboard][m_currentDifficulty].m_columnCount;
//For each entry in the leaderboard
for(unsigned int entryIndex=0; entryIndex < NUM_ENTRIES; entryIndex++)
{
@@ -539,7 +539,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats()
m_leaderboard.m_entries[entryIndex].m_row = entryIndex;
m_leaderboard.m_entries[entryIndex].m_rank = entryIndex+1;
swprintf(m_leaderboard.m_entries[entryIndex].m_wcRank, 12, L"12345678");//(int)m_leaderboard.m_entries[entryIndex].m_rank);
swprintf(m_leaderboard.m_entries[entryIndex].m_gamerTag, 17, L"WWWWWWWWWWWWWWWW");
//m_leaderboard.m_entries[entryIndex].m_locale = (entryIndex % 37) + 1;
@@ -598,7 +598,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats()
//LeaderboardManager::Instance()->SetStatsRetrieved(false);
return false;
}
m_leaderboard.m_numColumns = m_stats.m_queries[0].m_statsSize;
for( unsigned int entryIndex=0 ; entryIndex < m_newEntriesCount; ++entryIndex )
@@ -676,7 +676,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats()
insertPosition++;
}
if (deleteFront)
{
// Delete front x entries
@@ -865,7 +865,7 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard(LeaderboardManager::eStatsRet
m_labelInfo.setVisible( false );
m_listEntries.initLeaderboard(m_newSel, m_leaderboard.m_totalEntryCount, LEADERBOARD_DESCRIPTORS[m_currentLeaderboard][m_currentDifficulty].m_columnCount);
int startIndex = m_newEntryIndex;
int entryCount = m_newEntriesCount;
@@ -874,7 +874,7 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard(LeaderboardManager::eStatsRet
bool isLast = i == ((startIndex + entryCount) - 1);
int idsErrorMessage = m_leaderboard.m_entries[i].m_idsErrorMessage;
if (idsErrorMessage > 0)
{
m_listEntries.addDataSet(
@@ -882,7 +882,7 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard(LeaderboardManager::eStatsRet
m_leaderboard.m_entries[i].m_row,
m_leaderboard.m_entries[i].m_rank,
m_leaderboard.m_entries[i].m_gamerTag,
true, // 4J-JEV: Has error message to display.
app.GetString(idsErrorMessage),
@@ -896,9 +896,9 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard(LeaderboardManager::eStatsRet
m_leaderboard.m_entries[i].m_row,
m_leaderboard.m_entries[i].m_rank,
m_leaderboard.m_entries[i].m_gamerTag,
// 4J-TomK | The bDisplayMessage Flag defines if Leaderboard Data should be
// displayed (false) or if a specific message (true - when data is private for example)
// 4J-TomK | The bDisplayMessage Flag defines if Leaderboard Data should be
// displayed (false) or if a specific message (true - when data is private for example)
// should be displayed. The message itself should be passed on in col0!
false,
@@ -955,7 +955,7 @@ int UIScene_LeaderboardsMenu::SetLeaderboardTitleIcons()
m_listEntries.setColumnIcon(i,TitleIcons[m_currentLeaderboard][i]);
}
}
return iValidIcons;
}
@@ -969,7 +969,7 @@ void UIScene_LeaderboardsMenu::customDraw(IggyCustomDrawCallbackRegion *region)
}
else
{
shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>( new ItemInstance(TitleIcons[m_currentLeaderboard][slotId], 1, 0) );
std::shared_ptr<ItemInstance> item = std::shared_ptr<ItemInstance>( new ItemInstance(TitleIcons[m_currentLeaderboard][slotId], 1, 0) );
customDrawSlotControl(region,m_iPad,item,1.0f,false,false);
}
}

View File

@@ -85,7 +85,7 @@ void UIScene_SignEntryMenu::tick()
for(int i=0;i<4;i++)
{
wstring temp=m_textInputLines[i].getLabel();
m_sign->SetMessage(i,temp);
m_sign->SetMessage(i,temp);
}
m_sign->setChanged();
@@ -94,10 +94,10 @@ void UIScene_SignEntryMenu::tick()
// need to send the new data
if (pMinecraft->level->isClientSide)
{
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
std::shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
if(player != NULL && player->connection && player->connection->isStarted())
{
player->connection->send( shared_ptr<SignUpdatePacket>( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) );
player->connection->send( std::shared_ptr<SignUpdatePacket>( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) );
}
}
ui.CloseUIScenes(m_iPad);

View File

@@ -17,7 +17,7 @@ private:
eControl_Confirm
};
shared_ptr<SignTileEntity> m_sign;
std::shared_ptr<SignTileEntity> m_sign;
int m_iEditingLine;
bool m_bConfirmed;
bool m_bIgnoreInput;

View File

@@ -11,13 +11,13 @@ UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void *initData, UILayer *pa
{
// Setup all the Iggy references we need for this scene
initialiseMovie();
TeleportMenuInitData *initParam = (TeleportMenuInitData *)initData;
m_teleportToPlayer = initParam->teleportToPlayer;
delete initParam;
if(m_teleportToPlayer)
{
m_labelTitle.init(app.GetString(IDS_TELEPORT_TO_PLAYER));
@@ -81,7 +81,7 @@ UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void *initData, UILayer *pa
m_playersVoiceState[m_playersCount] = voiceStatus;
m_playersColourState[m_playersCount] = app.GetPlayerColour( m_players[m_playersCount] );
m_playerNames[m_playersCount] = playerName;
m_playerList.addItem( playerName, app.GetPlayerColour( m_players[m_playersCount] ), voiceStatus);
m_playerList.addItem( playerName, app.GetPlayerColour( m_players[m_playersCount] ), voiceStatus);
}
}
@@ -171,7 +171,7 @@ void UIScene_TeleportMenu::handleReload()
m_playersVoiceState[m_playersCount] = voiceStatus;
m_playersColourState[m_playersCount] = app.GetPlayerColour( m_players[m_playersCount] );
m_playerNames[m_playersCount] = playerName;
m_playerList.addItem( playerName, app.GetPlayerColour( m_players[m_playersCount] ), voiceStatus);
m_playerList.addItem( playerName, app.GetPlayerColour( m_players[m_playersCount] ), voiceStatus);
}
}
@@ -257,8 +257,8 @@ void UIScene_TeleportMenu::handlePress(F64 controlId, F64 childId)
int currentSelection = (int)childId;
INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId( m_players[ currentSelection ] );
INetworkPlayer *thisPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(m_iPad);
shared_ptr<GameCommandPacket> packet;
std::shared_ptr<GameCommandPacket> packet;
if(m_teleportToPlayer)
{
packet = TeleportCommand::preparePacket(thisPlayer->GetUID(),selectedPlayer->GetUID());
@@ -339,6 +339,6 @@ void UIScene_TeleportMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer *
}
}
scene->m_playerList.addItem( playerName, app.GetPlayerColour( scene->m_players[scene->m_playersCount - 1] ), voiceStatus);
scene->m_playerList.addItem( playerName, app.GetPlayerColour( scene->m_players[scene->m_playersCount - 1] ), voiceStatus);
}
}

View File

@@ -11,7 +11,7 @@ UIScene_TradingMenu::UIScene_TradingMenu(int iPad, void *_initData, UILayer *par
{
// Setup all the Iggy references we need for this scene
initialiseMovie();
m_showingLeftArrow = true;
m_showingRightArrow = true;
@@ -36,7 +36,7 @@ UIScene_TradingMenu::UIScene_TradingMenu(int iPad, void *_initData, UILayer *par
}
m_menu = new MerchantMenu( initData->inventory, initData->trader, initData->level );
Minecraft::GetInstance()->localplayers[iPad]->containerMenu = m_menu;
m_slotListRequest1.addSlots(BUY_A,1);
@@ -93,7 +93,7 @@ void UIScene_TradingMenu::handleDestroy()
}
// 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss.
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
if(pMinecraft->localplayers[m_iPad] != NULL) pMinecraft->localplayers[m_iPad]->closeContainer();
ui.OverrideSFX(m_iPad,ACTION_MENU_A,false);
@@ -147,12 +147,12 @@ void UIScene_TradingMenu::customDraw(IggyCustomDrawCallbackRegion *region)
Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
shared_ptr<ItemInstance> item = nullptr;
std::shared_ptr<ItemInstance> item = nullptr;
int slotId = -1;
swscanf((wchar_t*)region->name,L"slot_%d",&slotId);
if(slotId < MerchantMenu::USE_ROW_SLOT_END)
{
{
Slot *slot = m_menu->getSlot(slotId);
item = slot->getItem();
}

View File

@@ -31,8 +31,8 @@ typedef struct _UIVec2D
// Brewing
typedef struct _BrewingScreenInput
{
shared_ptr<Inventory> inventory;
shared_ptr<BrewingStandTileEntity> brewingStand;
std::shared_ptr<Inventory> inventory;
std::shared_ptr<BrewingStandTileEntity> brewingStand;
int iPad;
bool bSplitscreen;
} BrewingScreenInput;
@@ -40,8 +40,8 @@ typedef struct _BrewingScreenInput
// Chest
typedef struct _ContainerScreenInput
{
shared_ptr<Container> inventory;
shared_ptr<Container> container;
std::shared_ptr<Container> inventory;
std::shared_ptr<Container> container;
int iPad;
bool bSplitscreen;
} ContainerScreenInput;
@@ -49,8 +49,8 @@ typedef struct _ContainerScreenInput
// Dispenser
typedef struct _TrapScreenInput
{
shared_ptr<Container> inventory;
shared_ptr<DispenserTileEntity> trap;
std::shared_ptr<Container> inventory;
std::shared_ptr<DispenserTileEntity> trap;
int iPad;
bool bSplitscreen;
} TrapScreenInput;
@@ -58,16 +58,16 @@ typedef struct _TrapScreenInput
// Inventory and creative inventory
typedef struct _InventoryScreenInput
{
shared_ptr<LocalPlayer> player;
std::shared_ptr<LocalPlayer> player;
bool bNavigateBack; // If we came here from the crafting screen, go back to it, rather than closing the xui menus
int iPad;
bool bSplitscreen;
} InventoryScreenInput;
// Enchanting
// Enchanting
typedef struct _EnchantingScreenInput
{
shared_ptr<Inventory> inventory;
std::shared_ptr<Inventory> inventory;
Level *level;
int x;
int y;
@@ -79,8 +79,8 @@ typedef struct _EnchantingScreenInput
// Furnace
typedef struct _FurnaceScreenInput
{
shared_ptr<Inventory> inventory;
shared_ptr<FurnaceTileEntity> furnace;
std::shared_ptr<Inventory> inventory;
std::shared_ptr<FurnaceTileEntity> furnace;
int iPad;
bool bSplitscreen;
} FurnaceScreenInput;
@@ -88,21 +88,21 @@ typedef struct _FurnaceScreenInput
// Crafting
typedef struct _CraftingPanelScreenInput
{
shared_ptr<LocalPlayer> player;
std::shared_ptr<LocalPlayer> player;
int iContainerType; // RECIPE_TYPE_2x2 or RECIPE_TYPE_3x3
bool bSplitscreen;
int iPad;
int x;
int y;
int z;
}
}
CraftingPanelScreenInput;
// Trading
typedef struct _TradingScreenInput
{
shared_ptr<Inventory> inventory;
shared_ptr<Merchant> trader;
std::shared_ptr<Inventory> inventory;
std::shared_ptr<Merchant> trader;
Level *level;
int iPad;
bool bSplitscreen;
@@ -112,7 +112,7 @@ TradingScreenInput;
// Anvil
typedef struct _AnvilScreenInput
{
shared_ptr<Inventory> inventory;
std::shared_ptr<Inventory> inventory;
Level *level;
int x;
int y;
@@ -125,7 +125,7 @@ AnvilScreenInput;
// Sign
typedef struct _SignEntryScreenInput
{
shared_ptr<SignTileEntity> sign;
std::shared_ptr<SignTileEntity> sign;
int iPad;
} SignEntryScreenInput;
@@ -179,7 +179,7 @@ typedef struct _CreateWorldMenuInitData
BOOL bOnline;
BOOL bIsPrivate;
int iPad;
}
}
CreateWorldMenuInitData;
// Join/Load saves list
@@ -223,7 +223,7 @@ typedef struct _LoadMenuInitData
int iSaveGameInfoIndex;
LevelGenerationOptions *levelGen;
SaveListDetails *saveDetails;
}
}
LoadMenuInitData;
// Join Games
@@ -276,7 +276,7 @@ typedef struct _LaunchMoreOptionsMenuInitData
seed = L"";
bDisableSaving = false;
}
}
}
LaunchMoreOptionsMenuInitData;
typedef struct _LoadingInputParams
@@ -352,7 +352,7 @@ typedef struct _SignInInfo
} SignInInfo;
// Credits
typedef struct
typedef struct
{
LPCWSTR m_Text; // Should contain string, optionally with %s to add in translated string ... e.g. "Andy West - %s"
int m_iStringID[2]; // May be NO_TRANSLATED_STRING if we do not require to add any translated string.
@@ -379,8 +379,8 @@ typedef struct _DLCOffersParam
{
int iPad;
int iOfferC;
int iType;
}
int iType;
}
DLCOffersParam;
typedef struct _InGamePlayerOptionsInitData