diff options
Diffstat (limited to 'Minecraft.Client/Common/UI')
| -rw-r--r-- | Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp | 90 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp | 44 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp | 19 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp | 14 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp | 18 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIController.cpp | 100 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UILayer.cpp | 154 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene.cpp | 69 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp | 85 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp | 4 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_EndPoem.cpp | 16 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp | 8 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp | 158 |
13 files changed, 367 insertions, 412 deletions
diff --git a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp index 05a44202..fc012be3 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp @@ -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,14 +197,14 @@ 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]; @@ -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 @@ -340,7 +340,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) @@ -434,7 +434,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(); @@ -485,13 +485,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 @@ -499,11 +499,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; @@ -536,7 +536,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; @@ -577,7 +577,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { m_iCurrentSlotVIndex++; ui.PlayUISFX(eSFX_Focus); - } + } } UpdateVerticalSlots(); UpdateHighlight(); @@ -621,9 +621,9 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); int iRecipeC=(int)recipes->size(); - AUTO_VAR(itRecipe, recipes->begin()); + auto itRecipe = recipes->begin(); - // dump out the recipe products + // dump out the recipe products // for (int i = 0; i < iRecipeC; i++) // { @@ -631,7 +631,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() // if (pTempItemInst != NULL) // { // wstring itemstring=pTempItemInst->toString(); - // + // // printf("Recipe [%d] = ",i); // OutputDebugStringW(itemstring.c_str()); // if(pTempItemInst->id!=0) @@ -645,7 +645,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()); // } - // + // // } // } // } @@ -686,9 +686,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) @@ -724,18 +724,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 @@ -780,7 +780,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 @@ -804,7 +804,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; @@ -827,7 +827,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() } delete [] bFoundA; - itRecipe++; + itRecipe++; } } @@ -847,7 +847,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() uiAlpha = 31; } else - { + { if(pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].bCanMake[getPad()]) { uiAlpha = 31; @@ -936,10 +936,10 @@ void IUIScene_CraftingMenu::UpdateHighlight() { itemstring=app.GetString( IDS_ITEM_FIREBALLCOAL ); } - } + } break; default: - itemstring=app.GetString(id ); + itemstring=app.GetString(id ); break; } @@ -1004,7 +1004,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots() uiAlpha = 31; } else - { + { if(pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].bCanMake[getPad()]) { uiAlpha = 31; @@ -1043,7 +1043,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() hideAllIngredientsSlots(); if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0) - { + { int iSlot,iRecipy; if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1) { @@ -1135,13 +1135,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; @@ -1164,7 +1164,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() setIngredientSlotRedBox(index, false); } else - { + { if((pRecipeIngredientsRequired[iRecipy].usBitmaskMissingGridIngredients[getPad()]&(1<<(x+y*3)))!=0) { setIngredientSlotRedBox(index, true); @@ -1179,7 +1179,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() { setIngredientSlotRedBox(index, false); setIngredientSlotItem(getPad(),index,nullptr); - } + } } } } @@ -1203,7 +1203,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() { setIngredientSlotRedBox(i, false); setIngredientSlotItem(getPad(),i,nullptr); - } + } } } @@ -1220,7 +1220,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) { @@ -1293,13 +1293,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""); } } @@ -1323,7 +1323,7 @@ void IUIScene_CraftingMenu::UpdateTooltips() { iSlot=iVSlotIndexA[m_iCurrentSlotVIndex]; } - else + else { iSlot=0; } @@ -1363,7 +1363,7 @@ void IUIScene_CraftingMenu::UpdateTooltips() { iSlot=iVSlotIndexA[m_iCurrentSlotVIndex]; } - else + else { iSlot=0; } @@ -1396,7 +1396,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(); diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 04852e97..0d3f7dac 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -60,7 +60,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::mossyCobblestone_Id) @@ -144,7 +144,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) @@ -321,7 +321,7 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Tile::anvil_Id); 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::bucket_milk_Id) ITEM(Item::cauldron_Id) @@ -408,7 +408,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) @@ -430,7 +430,7 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Item::pickAxe_wood_Id) ITEM(Item::hatchet_wood_Id) ITEM(Item::hoe_wood_Id) - + ITEM(Item::emptyMap_Id) ITEM(Item::helmet_chain_Id) ITEM(Item::chestplate_chain_Id) @@ -441,7 +441,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) @@ -452,7 +452,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) @@ -514,7 +514,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) @@ -523,13 +523,13 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Item::gunpowder_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) @@ -562,7 +562,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 @@ -594,7 +594,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)) @@ -669,7 +669,7 @@ void IUIScene_CreativeMenu::staticCtor() // Top Row ECreative_Inventory_Groups blocksGroup[] = {eCreativeInventory_BuildingBlocks}; specs[eCreativeInventoryTab_BuildingBlocks] = new TabSpec(L"Structures", IDS_GROUPNAME_BUILDING_BLOCKS, 1, blocksGroup); - + #ifndef _CONTENT_PACKAGE ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration}; ECreative_Inventory_Groups debugDecorationsGroup[] = {eCreativeInventory_ArtToolsDecorations}; @@ -720,7 +720,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; @@ -735,7 +735,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]); @@ -769,7 +769,7 @@ void IUIScene_CreativeMenu::ScrollBar(UIVec2D pointerPos) IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups, int debugGroupsCount /*= 0*/, ECreative_Inventory_Groups *debugGroups /*= NULL*/) : m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount), m_debugGroupsCount(debugGroupsCount) { - + m_pages = 0; m_staticGroupsA = NULL; @@ -828,8 +828,8 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i // Fill the dynamic group if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != NULL) { - for(AUTO_VAR(it, categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin()); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it) - { + for (auto it = categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it) + { Slot *slot = menu->getSlot(++lastSlotIndex); slot->set( *it ); } @@ -953,7 +953,7 @@ unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount() IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContainer> smp, shared_ptr<Inventory> inv ) : AbstractContainerMenu() { inventory = inv; - creativeContainer = smp; + creativeContainer = smp; //int startLength = slots->size(); @@ -994,7 +994,7 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_CreativeMenu::GetSectionA switch( eSection ) { case eSectionInventoryCreativeSelector: - if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp) + if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp) { newSection = eSectionInventoryCreativeUsing; } @@ -1081,7 +1081,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; @@ -1375,7 +1375,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector<shared_ptr<ItemInstance> > *lis itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag); firework->setTag(itemTag); - } + } list->push_back(firework); } diff --git a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp index 8cc04940..059f9b75 100644 --- a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp @@ -47,11 +47,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); @@ -78,7 +78,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) int buyBMatches = player->inventory->countMatches(buyBItem); if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) ) { - // 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple ‘Enchanted Books’ will cause the title to crash. + // 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple �Enchanted Books� will cause the title to crash. int actualShopItem = m_activeOffers.at(selectedShopItem).second; m_merchant->notifyTrade(activeRecipe); @@ -186,13 +186,12 @@ void IUIScene_TradingMenu::updateDisplay() m_activeOffers.clear(); int unfilteredIndex = 0; int firstValidTrade = INT_MAX; - for(AUTO_VAR(it, unfilteredOffers->begin()); it != unfilteredOffers->end(); ++it) + for(auto& recipe : *unfilteredOffers) { - MerchantRecipe *recipe = *it; if(!recipe->isDeprecated()) { - m_activeOffers.push_back( pair<MerchantRecipe *,int>(recipe,unfilteredIndex)); - firstValidTrade = min(firstValidTrade,unfilteredIndex); + m_activeOffers.emplace_back(recipe,unfilteredIndex); + firstValidTrade = std::min<int>(firstValidTrade, unfilteredIndex); } ++unfilteredIndex; } @@ -249,7 +248,7 @@ void IUIScene_TradingMenu::updateDisplay() vector<HtmlString> *offerDescription = GetItemDescription(activeRecipe->getSellItem()); setOfferDescription(offerDescription); - + shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem(); shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem(); @@ -307,7 +306,7 @@ void IUIScene_TradingMenu::updateDisplay() setRequest1RedBox(false); setRequest2RedBox(false); setRequest1Item(nullptr); - setRequest2Item(nullptr); + setRequest2Item(nullptr); vector<HtmlString> offerDescription; setOfferDescription(&offerDescription); } diff --git a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp index 37f8fcf6..f1e2735a 100644 --- a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp +++ b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp @@ -24,7 +24,7 @@ bool UIControl_EnchantmentButton::setupControl(UIScene *scene, IggyValuePath *pa UIControl::setControlType(UIControl::eEnchantmentButton); bool success = UIControl_Button::setupControl(scene,parent,controlName); - //Button specific initialisers + //Button specific initialisers m_funcChangeState = registerFastName(L"ChangeState"); return success; @@ -40,7 +40,7 @@ void UIControl_EnchantmentButton::ReInit() { UIControl_Button::ReInit(); - + m_lastState = eState_Inactive; m_lastCost = 0; m_bHasFocus = false; @@ -54,10 +54,10 @@ void UIControl_EnchantmentButton::tick() } void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region) -{ +{ UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene; EnchantmentMenu *menu = enchantingScene->getMenu(); - + float width = region->x1 - region->x0; float height = region->y1 - region->y0; float xo = width/2; @@ -101,7 +101,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region) glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.1f); Minecraft *pMinecraft = Minecraft::GetInstance(); - wstring line = _toString<int>(cost); + wstring line = std::to_wstring(cost); Font *font = pMinecraft->altFont; //int col = 0x685E4A; unsigned int col = m_textColour; @@ -143,7 +143,7 @@ void UIControl_EnchantmentButton::updateState() EState state = eState_Inactive; int cost = menu->costs[m_index]; - + Minecraft *pMinecraft = Minecraft::GetInstance(); if(cost > pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild) { @@ -165,7 +165,7 @@ void UIControl_EnchantmentButton::updateState() if(cost != m_lastCost) { - setLabel( _toString<int>(cost) ); + setLabel( std::to_wstring(cost) ); m_lastCost = cost; m_enchantmentString = EnchantmentNames::instance.getRandomName(); } diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp index 2d7c0224..d74bd185 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -175,14 +175,14 @@ void UIControl_PlayerSkinPreview::CycleNextAnimation() void UIControl_PlayerSkinPreview::CyclePreviousAnimation() { - m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1); + m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1); if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1); m_swingTime = 0.0f; } void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region) -{ +{ Minecraft *pMinecraft=Minecraft::GetInstance(); glEnable(GL_RESCALE_NORMAL); @@ -193,7 +193,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region) float height = region->y1 - region->y0; float xo = width/2; float yo = height; - + glTranslatef(xo, yo - 3.5f, 50.0f); //glTranslatef(120.0f, 294, 0.0f); @@ -224,11 +224,9 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region) //vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts(); if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) - { - for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it) + { + for(auto& pModelPart : *m_pvAdditionalModelParts) { - ModelPart *pModelPart=*it; - pModelPart->visible=true; } } @@ -238,11 +236,9 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region) // hide the additional parts if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) - { - for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it) + { + for(auto& pModelPart : *m_pvAdditionalModelParts) { - ModelPart *pModelPart=*it; - pModelPart->visible=false; } } diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 01ab49ba..5375b784 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -182,7 +182,7 @@ UIController::UIController() { m_uiDebugConsole = NULL; m_reloadSkinThread = NULL; - + m_navigateToHomeOnReload = false; m_bCleanupOnReload = false; @@ -302,7 +302,7 @@ void UIController::postInit() IggySetTextureSubstitutionCallbacks ( &UIController::TextureSubstitutionCreateCallback , &UIController::TextureSubstitutionDestroyCallback, this ); SetupFont(); - // + // loadSkins(); for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) @@ -383,7 +383,7 @@ void UIController::SetupFont() app.m_dlcManager.LanguageChanged(); app.loadStringTable(); // Switch to use new string table, - + if (m_eTargetFont == m_eCurrentFont) { // 4J-JEV: If we're ingame, reload the font to update all the text. @@ -458,12 +458,12 @@ bool UIController::UsingBitmapFont() void UIController::tick() { SetupFont(); // If necessary, change font. - + if ( (m_navigateToHomeOnReload || m_bCleanupOnReload) && !ui.IsReloadingSkin() ) { ui.CleanUpSkinReload(); - - if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession()) + + if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession()) { ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu); } @@ -500,8 +500,8 @@ void UIController::tick() // Clear out the cached movie file data __int64 currentTime = System::currentTimeMillis(); - for(AUTO_VAR(it, m_cachedMovieData.begin()); it != m_cachedMovieData.end();) - { + for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();) + { if(it->second.m_expiry < currentTime) { delete [] it->second.m_ba.data; @@ -730,7 +730,7 @@ void UIController::CleanUpSkinReload() { if(!Minecraft::GetInstance()->skins->getSelected()->hasAudio()) { -#ifdef _DURANGO +#ifdef _DURANGO DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK"); #else DWORD result = StorageManager.UnmountInstalledDLC("TPACK"); @@ -738,9 +738,8 @@ void UIController::CleanUpSkinReload() } } - for(AUTO_VAR(it,m_queuedMessageBoxData.begin()); it != m_queuedMessageBoxData.end(); ++it) + for(auto queuedData : m_queuedMessageBoxData) { - QueuedMessageBoxData *queuedData = *it; ui.NavigateToScene(queuedData->iPad, eUIScene_MessageBox, &queuedData->info, queuedData->layer, eUIGroup_Fullscreen); delete queuedData->info.uiOptionA; delete queuedData; @@ -752,8 +751,8 @@ byteArray UIController::getMovieData(const wstring &filename) { // Cache everything we load in the current tick __int64 targetTime = System::currentTimeMillis() + (1000LL * 60); - AUTO_VAR(it,m_cachedMovieData.find(filename)); - if(it == m_cachedMovieData.end() ) + auto it = m_cachedMovieData.find(filename); + if(it == m_cachedMovieData.end() ) { byteArray baFile = app.getArchiveFile(filename); CachedMovieData cmd; @@ -959,7 +958,7 @@ void UIController::handleInput() { #ifdef _DURANGO // 4J-JEV: Added exception for primary play who migh've uttered speech commands. - if(iPad != ProfileManager.GetPrimaryPad() + if(iPad != ProfileManager.GetPrimaryPad() && (!InputManager.IsPadConnected(iPad) || !InputManager.IsPadLocked(iPad)) ) continue; #endif for(unsigned int key = 0; key <= ACTION_MAX_MENU; ++key) @@ -1035,7 +1034,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) { // no active touch? clear active and highlighted touch UI elements m_ActiveUIElement = NULL; - m_HighlightedUIElement = NULL; + m_HighlightedUIElement = NULL; // fullscreen first UIScene *pScene=m_groups[(int)eUIGroup_Fullscreen]->getCurrentScene(); @@ -1085,7 +1084,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) } } } - } + } else if(m_bTouchscreenPressed && pTouchData->reportNum==1) { // fullscreen first @@ -1337,8 +1336,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) app.DebugPrintf(app.USER_SR, "Total static: %d , Total dynamic: %d\n", totalStatic, totalDynamic); app.DebugPrintf(app.USER_SR, "\n\nEND TOTAL SWF MEMORY USAGE\n"); app.DebugPrintf(app.USER_SR, "********************************\n\n"); - } - else + } + else #endif #endif #endif @@ -1535,7 +1534,7 @@ void UIController::setupCustomDrawGameState() glLoadIdentity(); glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); - glEnable(GL_ALPHA_TEST); + glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.1f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); @@ -1635,22 +1634,22 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl //Description //Callback to create a user-defined texture to replace SWF-defined textures. //Parameters -//width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. -//height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. -//destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here). -//return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks. +//width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. +//height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. +//destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here). +//return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks. // //Discussion // //If your texture includes an alpha channel, you must use a premultiplied alpha (where the R,G, and B channels have been multiplied by the alpha value); all Iggy shaders assume premultiplied alpha (and it looks better anyway). GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * user_callback_data , IggyUTF16 * texture_name , S32 * width , S32 * height , void * * destroy_callback_data ) { - UIController *uiController = (UIController *)user_callback_data; - AUTO_VAR(it,uiController->m_substitutionTextures.find((wchar_t *)texture_name)); + UIController *uiController = static_cast<UIController *>(user_callback_data); + auto it = uiController->m_substitutionTextures.find(texture_name); - if(it != uiController->m_substitutionTextures.end()) + if(it != uiController->m_substitutionTextures.end()) { - app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", (wchar_t *)texture_name,it->second.length); + app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", texture_name,it->second.length); BufferedImage image(it->second.data, it->second.length); if( image.getData() != NULL ) @@ -1711,9 +1710,9 @@ void UIController::registerSubstitutionTexture(const wstring &textureName, PBYTE void UIController::unregisterSubstitutionTexture(const wstring &textureName, bool deleteData) { - AUTO_VAR(it,m_substitutionTextures.find(textureName)); + auto it = m_substitutionTextures.find(textureName); - if(it != m_substitutionTextures.end()) + if(it != m_substitutionTextures.end()) { if(deleteData) delete [] it->second.data; m_substitutionTextures.erase(it); @@ -1854,7 +1853,7 @@ bool UIController::NavigateBack(int iPad, bool forceUsePad, EUIScene eScene, EUI void UIController::NavigateToHomeMenu() { ui.CloseAllPlayersScenes(); - + // Alert the app the we no longer want to be informed of ethernet connections app.SetLiveLinkRequired( false ); @@ -1953,8 +1952,8 @@ size_t UIController::RegisterForCallbackId(UIScene *scene) void UIController::UnregisterCallbackId(size_t id) { EnterCriticalSection(&m_registeredCallbackScenesCS); - AUTO_VAR(it, m_registeredCallbackScenes.find(id) ); - if(it != m_registeredCallbackScenes.end() ) + auto it = m_registeredCallbackScenes.find(id); + if(it != m_registeredCallbackScenes.end() ) { m_registeredCallbackScenes.erase(it); } @@ -1964,8 +1963,8 @@ void UIController::UnregisterCallbackId(size_t id) UIScene *UIController::GetSceneFromCallbackId(size_t id) { UIScene *scene = NULL; - AUTO_VAR(it, m_registeredCallbackScenes.find(id) ); - if(it != m_registeredCallbackScenes.end() ) + auto it = m_registeredCallbackScenes.find(id); + if(it != m_registeredCallbackScenes.end() ) { scene = it->second; } @@ -2017,7 +2016,7 @@ void UIController::CloseUIScenes(int iPad, bool forceIPad) m_groups[(int)group]->closeAllScenes(); m_groups[(int)group]->getTooltips()->SetTooltips(-1); - + // This should cause the popup to dissappear TutorialPopupInfo popupInfo; if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(&popupInfo); @@ -2168,7 +2167,7 @@ void UIController::SetMenuDisplayed(int iPad,bool bVal) #ifdef _DURANGO // 4J-JEV: When in-game, allow player to toggle the 'Pause' and 'IngameInfo' menus via Kinnect. - if (Minecraft::GetInstance()->running) + if (Minecraft::GetInstance()->running) InputManager.SetEnabledGtcButtons(_360_GTC_MENU | _360_GTC_PAUSE | _360_GTC_VIEW); #endif } @@ -2341,7 +2340,7 @@ void UIController::PlayUISFX(ESoundEffect eSound) // Don't play multiple SFX on the same tick // (prevents horrible sounds when programmatically setting multiple checkboxes) if (time - m_lastUiSfx < 10) { return; } - m_lastUiSfx = time; + m_lastUiSfx = time; Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,1.0f); } @@ -2588,7 +2587,7 @@ void UIController::SetTrialTimerLimitSecs(unsigned int uiSeconds) void UIController::UpdateTrialTimer(unsigned int iPad) { - WCHAR wcTime[20]; + WCHAR wcTime[20]; DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); @@ -2650,7 +2649,7 @@ void UIController::ShowAutosaveCountdownTimer(bool show) void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) { #if !(defined(_XBOX_ONE) || defined(__ORBIS__)) - WCHAR wcAutosaveCountdown[100]; + WCHAR wcAutosaveCountdown[100]; swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); #endif @@ -2820,7 +2819,7 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 #ifdef __ORBIS__ // Show the vague UGC system message in addition to our message ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad ); - return C4JStorage::EMessage_ResultAccept; + return C4JStorage::EMessage_ResultAccept; #elif defined(__PSVITA__) ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, iPad ); UINT uiIDA[1]; @@ -2857,7 +2856,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT #ifdef __ORBIS__ // Show the vague UGC system message in addition to our message ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad ); - return C4JStorage::EMessage_ResultAccept; + return C4JStorage::EMessage_ResultAccept; #elif defined(__PSVITA__) ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_AGE_RESTRICTION, iPad ); return C4JStorage::EMessage_ResultAccept; @@ -2897,7 +2896,7 @@ void UIController::setFontCachingCalculationBuffer(int length) } } -// Returns the first scene of given type if it exists, NULL otherwise +// Returns the first scene of given type if it exists, NULL otherwise UIScene *UIController::FindScene(EUIScene sceneType) { UIScene *pScene = NULL; @@ -3002,11 +3001,8 @@ void UIController::TouchBoxRebuild(UIScene *pUIScene) ui.TouchBoxesClear(pUIScene); // rebuild boxes - AUTO_VAR(itEnd, pUIScene->GetControls()->end()); - for (AUTO_VAR(it, pUIScene->GetControls()->begin()); it != itEnd; it++) + for ( UIControl *control : *pUIScene->GetControls() ) { - UIControl *control=(UIControl *)*it; - if(control->getControlType() == UIControl::eButton || control->getControlType() == UIControl::eSlider || control->getControlType() == UIControl::eCheckBox || @@ -3035,11 +3031,9 @@ void UIController::TouchBoxesClear(UIScene *pUIScene) EUILayer eUILayer=pUIScene->GetParentLayer()->m_iLayer; EUIScene eUIscene=pUIScene->getSceneType(); - AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end()); - for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++) + for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] ) { - UIELEMENT *element=(UIELEMENT *)*it; - delete element; + delete element; } m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear(); } @@ -3056,10 +3050,8 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y) if(m_TouchBoxes[eUIGroup][eUILayer][eUIscene].size()>0) { - AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end()); - for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++) + for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] ) { - UIELEMENT *element=(UIELEMENT *)*it; if(element->pControl->getHidden() == false && element->pControl->getVisible()) // ignore removed controls { if((x>=element->x1) &&(x<=element->x2) && (y>=element->y1) && (y<=element->y2)) @@ -3075,7 +3067,7 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y) return true; } } - } + } } //app.DebugPrintf("MISS at x = %i y = %i\n", (int)x, (int)y); diff --git a/Minecraft.Client/Common/UI/UILayer.cpp b/Minecraft.Client/Common/UI/UILayer.cpp index 13b26c84..b3cf72a0 100644 --- a/Minecraft.Client/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Common/UI/UILayer.cpp @@ -18,18 +18,16 @@ void UILayer::tick() { // Delete old scenes - deleting a scene can cause a new scene to be deleted, so we need to make a copy of the scenes that we are going to try and destroy this tick vector<UIScene *>scenesToDeleteCopy; - for( AUTO_VAR(it,m_scenesToDelete.begin()); it != m_scenesToDelete.end(); it++) + for(auto& scene : m_scenesToDelete) { - UIScene *scene = (*it); scenesToDeleteCopy.push_back(scene); } m_scenesToDelete.clear(); // Delete the scenes in our copy if they are ready to delete, otherwise add back to the ones that are still to be deleted. Actually deleting a scene might also add something back into m_scenesToDelete. - for( AUTO_VAR(it,scenesToDeleteCopy.begin()); it != scenesToDeleteCopy.end(); it++) + for(auto& scene : scenesToDeleteCopy) { - UIScene *scene = (*it); - if( scene->isReadyToDelete()) + if( scene && scene->isReadyToDelete()) { delete scene; } @@ -38,7 +36,7 @@ void UILayer::tick() m_scenesToDelete.push_back(scene); } } - + while (!m_scenesToDestroy.empty()) { UIScene *scene = m_scenesToDestroy.back(); @@ -46,14 +44,13 @@ void UILayer::tick() scene->destroyMovie(); } m_scenesToDestroy.clear(); - - for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) + + for(auto & component : m_components) { - (*it)->tick(); + component->tick(); } // Note: reverse iterator, the last element is the top of the stack - int sceneIndex = m_sceneStack.size() - 1; - //for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) + int sceneIndex = m_sceneStack.size() - 1; while( sceneIndex >= 0 && sceneIndex < m_sceneStack.size() ) { //(*it)->tick(); @@ -68,20 +65,20 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport) { if(!ui.IsExpectingOrReloadingSkin()) { - for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) - { - AUTO_VAR(itRef,m_componentRefCount.find((*it)->getSceneType())); - if(itRef != m_componentRefCount.end() && itRef->second.second) + for(auto& it : m_components) { - if((*it)->isVisible() ) + auto itRef = m_componentRefCount.find(it->getSceneType()); + if(itRef != m_componentRefCount.end() && itRef->second.second) { - PIXBeginNamedEvent(0, "Rendering component %d", (*it)->getSceneType() ); - (*it)->render(width, height,viewport); - PIXEndNamedEvent(); + if(it->isVisible() ) + { + PIXBeginNamedEvent(0, "Rendering component %d", it->getSceneType() ); + it->render(width, height,viewport); + PIXEndNamedEvent(); + } } } } - } if(!m_sceneStack.empty()) { int lowestRenderable = m_sceneStack.size() - 1; @@ -139,9 +136,9 @@ bool UILayer::HasFocus(int iPad) bool UILayer::hidesLowerScenes() { bool hidesScenes = false; - for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) + for(auto& it : m_components) { - if((*it)->hidesLowerScenes()) + if(it->hidesLowerScenes()) { hidesScenes = true; break; @@ -168,28 +165,27 @@ void UILayer::getRenderDimensions(S32 &width, S32 &height) void UILayer::DestroyAll() { - for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) + for(auto& it : m_components) { - (*it)->destroyMovie(); + it->destroyMovie(); } - for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it) + for(auto& it : m_sceneStack) { - (*it)->destroyMovie(); + it->destroyMovie(); } } void UILayer::ReloadAll(bool force) { - for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) + for(auto& it : m_components) { - (*it)->reloadMovie(force); + it->reloadMovie(force); } if(!m_sceneStack.empty()) { - int lowestRenderable = 0; - for(;lowestRenderable < m_sceneStack.size(); ++lowestRenderable) + for(auto& lowestRenderable : m_sceneStack) { - m_sceneStack[lowestRenderable]->reloadMovie(force); + lowestRenderable->reloadMovie(force); } } } @@ -440,9 +436,9 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData) } m_sceneStack.push_back(newScene); - + updateFocusState(); - + newScene->tick(); return true; @@ -493,8 +489,8 @@ bool UILayer::NavigateBack(int iPad, EUIScene eScene) void UILayer::showComponent(int iPad, EUIScene scene, bool show) { - AUTO_VAR(it,m_componentRefCount.find(scene)); - if(it != m_componentRefCount.end()) + auto it = m_componentRefCount.find(scene); + if(it != m_componentRefCount.end()) { it->second.second = show; return; @@ -505,8 +501,8 @@ void UILayer::showComponent(int iPad, EUIScene scene, bool show) bool UILayer::isComponentVisible(EUIScene scene) { bool visible = false; - AUTO_VAR(it,m_componentRefCount.find(scene)); - if(it != m_componentRefCount.end()) + auto it = m_componentRefCount.find(scene); + if(it != m_componentRefCount.end()) { visible = it->second.second; } @@ -515,16 +511,16 @@ bool UILayer::isComponentVisible(EUIScene scene) UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData) { - AUTO_VAR(it,m_componentRefCount.find(scene)); - if(it != m_componentRefCount.end()) + auto it = m_componentRefCount.find(scene); + if(it != m_componentRefCount.end()) { ++it->second.first; - for(AUTO_VAR(itComp,m_components.begin()); itComp != m_components.end(); ++itComp) + for(auto& itComp : m_components) { - if( (*itComp)->getSceneType() == scene ) + if( itComp->getSceneType() == scene ) { - return *itComp; + return itComp; } } return NULL; @@ -586,16 +582,16 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData) void UILayer::removeComponent(EUIScene scene) { - AUTO_VAR(it,m_componentRefCount.find(scene)); - if(it != m_componentRefCount.end()) + auto it = m_componentRefCount.find(scene); + if(it != m_componentRefCount.end()) { --it->second.first; if(it->second.first <= 0) { m_componentRefCount.erase(it); - for(AUTO_VAR(compIt, m_components.begin()) ; compIt != m_components.end(); ) - { + for (auto compIt = m_components.begin(); compIt != m_components.end();) + { if( (*compIt)->getSceneType() == scene) { #ifdef __PSVITA__ @@ -622,8 +618,8 @@ void UILayer::removeScene(UIScene *scene) ui.TouchBoxesClear(scene); #endif - AUTO_VAR(newEnd, std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene) ); - m_sceneStack.erase(newEnd, m_sceneStack.end()); + auto newEnd = std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene); + m_sceneStack.erase(newEnd, m_sceneStack.end()); m_scenesToDelete.push_back(scene); @@ -645,14 +641,14 @@ void UILayer::closeAllScenes() vector<UIScene *> temp; temp.insert(temp.end(), m_sceneStack.begin(), m_sceneStack.end()); m_sceneStack.clear(); - for(AUTO_VAR(it, temp.begin()); it != temp.end(); ++it) + for(auto& it : temp) { #ifdef __PSVITA__ // remove any touchboxes - ui.TouchBoxesClear(*it); + ui.TouchBoxesClear(it); #endif - m_scenesToDelete.push_back(*it); - (*it)->handleDestroy(); // For anything that might require the pointer be valid + m_scenesToDelete.push_back(it); + it->handleDestroy(); // For anything that might require the pointer be valid } updateFocusState(); @@ -696,8 +692,8 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) m_bIgnorePlayerJoinMenuDisplayed = false; bool layerFocusSet = false; - for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) - { + for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it) + { UIScene *scene = *it; // UPDATE FOCUS STATES @@ -730,12 +726,12 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) // 4J-PB - this should just be true m_bMenuDisplayed=true; - + EUIScene sceneType = scene->getSceneType(); switch(sceneType) { case eUIScene_PauseMenu: - m_bPauseMenuDisplayed = true; + m_bPauseMenuDisplayed = true; break; case eUIScene_Crafting2x2Menu: case eUIScene_Crafting3x3Menu: @@ -757,7 +753,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) // Intentional fall-through case eUIScene_DeathMenu: - case eUIScene_FullscreenProgress: + case eUIScene_FullscreenProgress: case eUIScene_SignEntryMenu: case eUIScene_EndPoem: m_bIgnoreAutosaveMenuDisplayed = true; @@ -766,7 +762,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) switch(sceneType) { - case eUIScene_FullscreenProgress: + case eUIScene_FullscreenProgress: case eUIScene_EndPoem: case eUIScene_Credits: case eUIScene_LeaderboardsMenu: @@ -783,7 +779,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) UIScene *UILayer::getCurrentScene() { // Note: reverse iterator, the last element is the top of the stack - for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) + for( auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it) { UIScene *scene = *it; // 4J-PB - only used on Vita, so iPad 0 is fine @@ -800,13 +796,13 @@ UIScene *UILayer::getCurrentScene() void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { // Note: reverse iterator, the last element is the top of the stack - for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) - { + for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it) + { UIScene *scene = *it; if(scene->hasFocus(iPad) && scene->canHandleInput()) { - // 4J-PB - ignore repeats of action ABXY buttons - // fix for PS3 213 - [MAIN MENU] Holding down buttons will continue to activate every prompt. + // 4J-PB - ignore repeats of action ABXY buttons + // fix for PS3 213 - [MAIN MENU] Holding down buttons will continue to activate every prompt. // 4J Stu - Changed this slightly to add the allowRepeat function so we can allow repeats in the crafting menu if(repeat && !scene->allowRepeat(key) ) { @@ -814,8 +810,8 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel } scene->handleInput(iPad, key, repeat, pressed, released, handled); } - - // Fix for PS3 #444 - [IN GAME] If the user keeps pressing CROSS while on the 'Save Game' screen the title will crash. + + // Fix for PS3 #444 - [IN GAME] If the user keeps pressing CROSS while on the 'Save Game' screen the title will crash. handled = handled || scene->hidesLowerScenes() || scene->blocksInput(); if(handled ) break; } @@ -825,8 +821,8 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel void UILayer::HandleDLCMountingComplete() { - for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) - { + for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it) + { UIScene *topScene = *it; app.DebugPrintf("UILayer::HandleDLCMountingComplete - topScene\n"); topScene->HandleDLCMountingComplete(); @@ -835,8 +831,8 @@ void UILayer::HandleDLCMountingComplete() void UILayer::HandleDLCInstalled() { - for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) - { + for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it) + { UIScene *topScene = *it; topScene->HandleDLCInstalled(); } @@ -845,7 +841,7 @@ void UILayer::HandleDLCInstalled() #ifdef _XBOX_ONE void UILayer::HandleDLCLicenseChange() { - for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) + for( auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it) { UIScene *topScene = *it; topScene->HandleDLCLicenseChange(); @@ -855,8 +851,8 @@ void UILayer::HandleDLCLicenseChange() void UILayer::HandleMessage(EUIMessage message, void *data) { - for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) - { + for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it) + { UIScene *topScene = *it; topScene->HandleMessage(message, data); } @@ -875,9 +871,9 @@ C4JRender::eViewportType UILayer::getViewport() void UILayer::handleUnlockFullVersion() { - for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it) + for(auto& it : m_sceneStack) { - (*it)->handleUnlockFullVersion(); + it->handleUnlockFullVersion(); } } @@ -885,20 +881,20 @@ void UILayer::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic) { __int64 layerStatic = 0; __int64 layerDynamic = 0; - for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) + for(auto& it : m_components) { - (*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic); + it->PrintTotalMemoryUsage(layerStatic, layerDynamic); } - for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it) + for(auto& it : m_sceneStack) { - (*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic); + it->PrintTotalMemoryUsage(layerStatic, layerDynamic); } app.DebugPrintf(app.USER_SR, " \\- Layer static: %d , Layer dynamic: %d\n", layerStatic, layerDynamic); totalStatic += layerStatic; totalDynamic += layerDynamic; } -// Returns the first scene of given type if it exists, NULL otherwise +// Returns the first scene of given type if it exists, NULL otherwise UIScene *UILayer::FindScene(EUIScene sceneType) { for (int i = 0; i < m_sceneStack.size(); i++) diff --git a/Minecraft.Client/Common/UI/UIScene.cpp b/Minecraft.Client/Common/UI/UIScene.cpp index ba253643..6ef6d0e8 100644 --- a/Minecraft.Client/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Common/UI/UIScene.cpp @@ -13,7 +13,7 @@ UIScene::UIScene(int iPad, UILayer *parentLayer) m_iPad = iPad; swf = NULL; m_pItemRenderer = NULL; - + bHasFocus = false; m_hasTickedOnce = false; m_bFocussedOnce = false; @@ -27,7 +27,7 @@ UIScene::UIScene(int iPad, UILayer *parentLayer) m_bUpdateOpacity = false; m_backScene = NULL; - + m_cacheSlotRenders = false; m_needsCacheRendered = true; m_expectedCachedSlotCount = 0; @@ -39,9 +39,9 @@ UIScene::~UIScene() /* Destroy the Iggy player. */ IggyPlayerDestroy( swf ); - for(AUTO_VAR(it,m_registeredTextures.begin()); it != m_registeredTextures.end(); ++it) + for(auto & it : m_registeredTextures) { - ui.unregisterSubstitutionTexture( it->first, it->second ); + ui.unregisterSubstitutionTexture( it.first, it.second ); } if(m_callbackUniqueId != 0) @@ -88,14 +88,14 @@ void UIScene::reloadMovie(bool force) handlePreReload(); // Reload controls - for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it) + for(auto & it : m_controls) { - (*it)->ReInit(); + it->ReInit(); } updateComponents(); handleReload(); - + IggyDataValue result; IggyDataValue value[1]; @@ -332,7 +332,7 @@ void UIScene::loadMovie() __int64 beforeLoad = ui.iggyAllocCount; swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL); __int64 afterLoad = ui.iggyAllocCount; - IggyPlayerInitializeAndTickRS ( swf ); + IggyPlayerInitializeAndTickRS ( swf ); __int64 afterTick = ui.iggyAllocCount; if(!swf) @@ -344,7 +344,7 @@ void UIScene::loadMovie() app.FatalLoadError(); } app.DebugPrintf( app.USER_SR, "Loaded iggy movie %ls\n", moviePath.c_str() ); - IggyProperties *properties = IggyPlayerProperties ( swf ); + IggyProperties *properties = IggyPlayerProperties ( swf ); m_movieHeight = properties->movie_height_in_pixels; m_movieWidth = properties->movie_width_in_pixels; @@ -352,7 +352,7 @@ void UIScene::loadMovie() m_renderHeight = m_movieHeight; S32 width, height; - m_parentLayer->getRenderDimensions(width, height); + m_parentLayer->getRenderDimensions(width, height); IggyPlayerSetDisplaySize( swf, width, height ); IggyPlayerSetUserdata(swf,this); @@ -373,7 +373,7 @@ void UIScene::loadMovie() { totalStatic += memoryInfo.static_allocation_bytes; totalDynamic += memoryInfo.dynamic_allocation_bytes; - app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), memoryInfo.subcategory_stringlen, memoryInfo.subcategory, + app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), memoryInfo.subcategory_stringlen, memoryInfo.subcategory, memoryInfo.static_allocation_bytes, memoryInfo.static_allocation_count, memoryInfo.dynamic_allocation_bytes, memoryInfo.dynamic_allocation_count); ++iteration; //if(memoryInfo.static_allocation_bytes > 0) getDebugMemoryUseRecursive(moviePath, memoryInfo); @@ -399,7 +399,7 @@ void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUse internalIteration , &internalMemoryInfo )) { - app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory, + app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory, internalMemoryInfo.static_allocation_bytes, internalMemoryInfo.static_allocation_count, internalMemoryInfo.dynamic_allocation_bytes, internalMemoryInfo.dynamic_allocation_count); ++internalIteration; if(internalMemoryInfo.subcategory_stringlen > memoryInfo.subcategory_stringlen) getDebugMemoryUseRecursive(moviePath, internalMemoryInfo); @@ -440,9 +440,9 @@ void UIScene::tick() while(IggyPlayerReadyToTick( swf )) { tickTimers(); - for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it) + for(auto & it : m_controls) { - (*it)->tick(); + it->tick(); } IggyPlayerTickRS( swf ); m_hasTickedOnce = true; @@ -468,8 +468,8 @@ void UIScene::addTimer(int id, int ms) void UIScene::killTimer(int id) { - AUTO_VAR(it, m_timers.find(id)); - if(it != m_timers.end()) + auto it = m_timers.find(id); + if(it != m_timers.end()) { it->second.running = false; } @@ -478,13 +478,13 @@ void UIScene::killTimer(int id) void UIScene::tickTimers() { int currentTime = System::currentTimeMillis(); - for(AUTO_VAR(it, m_timers.begin()); it != m_timers.end();) - { + for (auto it = m_timers.begin(); it != m_timers.end();) + { if(!it->second.running) { it = m_timers.erase(it); } - else + else { if(currentTime > it->second.targetTime) { @@ -501,8 +501,8 @@ void UIScene::tickTimers() IggyName UIScene::registerFastName(const wstring &name) { IggyName var; - AUTO_VAR(it,m_fastNames.find(name)); - if(it != m_fastNames.end()) + auto it = m_fastNames.find(name); + if(it != m_fastNames.end()) { var = it->second; } @@ -635,17 +635,16 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP if(useCommandBuffers) RenderManager.CBuffStart(list, true); #endif PIXBeginNamedEvent(0,"Draw uncached"); - ui.setupCustomDrawMatrices(this, customDrawRegion); + ui.setupCustomDrawMatrices(this, customDrawRegion); _customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, useCommandBuffers); delete customDrawRegion; PIXEndNamedEvent(); PIXBeginNamedEvent(0,"Draw all cache"); // Draw all the cached slots - for(AUTO_VAR(it, m_cachedSlotDraw.begin()); it != m_cachedSlotDraw.end(); ++it) + for(auto& drawData : m_cachedSlotDraw) { - CachedSlotDrawData *drawData = *it; - ui.setupCustomDrawMatrices(this, drawData->customDrawRegion); + ui.setupCustomDrawMatrices(this, drawData->customDrawRegion); _customDrawSlotControl(drawData->customDrawRegion, iPad, drawData->item, drawData->fAlpha, drawData->isFoil, drawData->bDecorations, useCommandBuffers); delete drawData->customDrawRegion; delete drawData; @@ -699,7 +698,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP // Finish GDraw and anything else that needs to be finalised ui.endCustomDraw(region); } - } + } } void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer) @@ -717,7 +716,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt // we might want separate x & y scales here float scaleX = bwidth / 16.0f; - float scaleY = bheight / 16.0f; + float scaleY = bheight / 16.0f; glEnable(GL_RESCALE_NORMAL); glPushMatrix(); @@ -755,8 +754,8 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt if(bDecorations) { if((scaleX!=1.0f) ||(scaleY!=1.0f)) - { - glPushMatrix(); + { + glPushMatrix(); glScalef(scaleX, scaleY, 1.0f); int iX= (int)(0.5f+((float)x)/scaleX); int iY= (int)(0.5f+((float)y)/scaleY); @@ -991,8 +990,8 @@ int UIScene::convertGameActionToIggyKeycode(int action) bool UIScene::allowRepeat(int key) { - // 4J-PB - ignore repeats of action ABXY buttons - // fix for PS3 213 - [MAIN MENU] Holding down buttons will continue to activate every prompt. + // 4J-PB - ignore repeats of action ABXY buttons + // fix for PS3 213 - [MAIN MENU] Holding down buttons will continue to activate every prompt. switch(key) { case ACTION_MENU_OK: @@ -1185,9 +1184,9 @@ void UIScene::registerSubstitutionTexture(const wstring &textureName, PBYTE pbDa bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName) { - AUTO_VAR(it, m_registeredTextures.find( textureName ) ); + auto it = m_registeredTextures.find(textureName); - return it != m_registeredTextures.end(); + return it != m_registeredTextures.end(); } void UIScene::_handleFocusChange(F64 controlId, F64 childId) @@ -1240,10 +1239,8 @@ UIScene *UIScene::getBackScene() #ifdef __PSVITA__ void UIScene::UpdateSceneControls() { - AUTO_VAR(itEnd, GetControls()->end()); - for (AUTO_VAR(it, GetControls()->begin()); it != itEnd; it++) + for ( UIControl *control : *GetControls() ) { - UIControl *control=(UIControl *)*it; control->UpdateControl(); } } diff --git a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp index 65c1b6fc..c109ed62 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp @@ -191,13 +191,13 @@ void UIScene_DLCOffersMenu::handleInput(int iPad, int key, bool repeat, bool pre switch(iTextC) { case 0: - m_labelHTMLSellText.init("Voici un fantastique mini-pack de 24 apparences pour personnaliser votre personnage Minecraft et vous mettre dans l'ambiance des fêtes de fin d'année.<br><br>1-4 joueurs<br>2-8 joueurs en réseau<br><br> Cet article fait l’objet d’une licence ou d’une sous-licence de Sony Computer Entertainment America, et est soumis aux conditions générales du service du réseau, au contrat d’utilisateur, aux restrictions d’utilisation de cet article et aux autres conditions applicables, disponibles sur le site www.us.playstation.com/support/useragreements. Si vous ne souhaitez pas accepter ces conditions, ne téléchargez pas ce produit. Cet article peut être utilisé avec un maximum de deux systèmes PlayStation®3 activés associés à ce compte Sony Entertainment Network. <br><br>'Minecraft' est une marque commerciale de Notch Development AB."); + m_labelHTMLSellText.init("Voici un fantastique mini-pack de 24 apparences pour personnaliser votre personnage Minecraft et vous mettre dans l'ambiance des f�tes de fin d'ann�e.<br><br>1-4 joueurs<br>2-8 joueurs en r�seau<br><br> Cet article fait l�objet d�une licence ou d�une sous-licence de Sony Computer Entertainment America, et est soumis aux conditions g�n�rales du service du r�seau, au contrat d�utilisateur, aux restrictions d�utilisation de cet article et aux autres conditions applicables, disponibles sur le site www.us.playstation.com/support/useragreements. Si vous ne souhaitez pas accepter ces conditions, ne t�l�chargez pas ce produit. Cet article peut �tre utilis� avec un maximum de deux syst�mes PlayStation�3 activ�s associ�s � ce compte Sony Entertainment Network.�<br><br>'Minecraft' est une marque commerciale de Notch Development AB."); break; case 1: - m_labelHTMLSellText.init("Un fabuloso minipack de 24 aspectos para personalizar tu personaje de Minecraft y ponerte a tono con las fiestas.<br><br>1-4 jugadores<br>2-8 jugadores en red<br><br> Sony Computer Entertainment America le concede la licencia o sublicencia de este artículo, que está sujeto a los términos de servicio y al acuerdo de usuario de la red. Las restricciones de uso de este artículo, así como otros términos aplicables, se encuentran en www.us.playstation.com/support/useragreements. Si no desea aceptar todos estos términos, no descargue este artículo. Este artículo puede usarse en hasta dos sistemas PlayStation®3 activados asociados con esta cuenta de Sony Entertainment Network. <br><br>'Minecraft' es una marca comercial de Notch Development AB."); + m_labelHTMLSellText.init("Un fabuloso minipack de 24 aspectos para personalizar tu personaje de Minecraft y ponerte a tono con las fiestas.<br><br>1-4 jugadores<br>2-8 jugadores en red<br><br> Sony Computer Entertainment America le concede la licencia o sublicencia de este art�culo, que est� sujeto a los t�rminos de servicio y al acuerdo de usuario de la red. Las restricciones de uso de este art�culo, as� como otros t�rminos aplicables, se encuentran en www.us.playstation.com/support/useragreements. Si no desea aceptar todos estos t�rminos, no descargue este art�culo. Este art�culo puede usarse en hasta dos sistemas PlayStation�3 activados asociados con esta cuenta de Sony Entertainment Network.�<br><br>'Minecraft' es una marca comercial de Notch Development AB."); break; case 2: - m_labelHTMLSellText.init("Este é um incrível pacote com 24 capas para personalizar seu personagem no Minecraft e entrar no clima de final de ano.<br><br>1-4 Jogadores<br>Jogadores em rede 2-8<br><br> Este item está sendo licenciado ou sublicenciado para você pela Sony Computer Entertainment America e está sujeito aos Termos de Serviço da Rede e Acordo do Usuário, as restrições de uso deste item e outros termos aplicáveis estão localizados em www.us.playstation.com/support/useragreements. Caso não queira aceitar todos esses termos, não baixe este item. Este item pode ser usado com até 2 sistemas PlayStation®3 ativados associados a esta Conta de Rede Sony Entertainment. <br><br>'Minecraft' é uma marca registrada da Notch Development AB"); + m_labelHTMLSellText.init("Este � um incr�vel pacote com 24 capas para personalizar seu personagem no Minecraft e entrar no clima de final de ano.<br><br>1-4 Jogadores<br>Jogadores em rede 2-8<br><br> Este item est� sendo licenciado ou sublicenciado para voc� pela Sony Computer Entertainment America e est� sujeito aos Termos de Servi�o da Rede e Acordo do Usu�rio, as restri��es de uso deste item e outros termos aplic�veis est�o localizados em www.us.playstation.com/support/useragreements. Caso n�o queira aceitar todos esses termos, n�o baixe este item. Este item pode ser usado com at� 2 sistemas PlayStation�3 ativados associados a esta Conta de Rede Sony Entertainment.�<br><br>'Minecraft' � uma marca registrada da Notch Development AB"); break; } iTextC++; @@ -208,7 +208,7 @@ void UIScene_DLCOffersMenu::handleInput(int iPad, int key, bool repeat, bool pre case ACTION_MENU_OTHER_STICK_DOWN: case ACTION_MENU_OTHER_STICK_UP: // don't pass down PageUp or PageDown because this will cause conflicts between the buttonlist and scrollable html text component - //case ACTION_MENU_PAGEUP: + //case ACTION_MENU_PAGEUP: //case ACTION_MENU_PAGEDOWN: sendInputToMovie(key, repeat, pressed, released); break; @@ -235,7 +235,7 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) #ifdef __PS3__ // is the item purchasable? - if(info.purchasabilityFlag==1) + if(info.purchasabilityFlag==1) { // can be bought app.Checkout(info.skuId); @@ -249,7 +249,7 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) } #else // __ORBIS__ // is the item purchasable? - if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED) + if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED) { // can be bought app.Checkout(info.skuId); @@ -280,7 +280,7 @@ void UIScene_DLCOffersMenu::handleSelectionChanged(F64 selectedId) } void UIScene_DLCOffersMenu::handleFocusChange(F64 controlId, F64 childId) -{ +{ app.DebugPrintf("UIScene_DLCOffersMenu::handleFocusChange\n"); #ifdef __PSVITA__ @@ -305,7 +305,7 @@ void UIScene_DLCOffersMenu::handleFocusChange(F64 controlId, F64 childId) #if defined __PSVITA__ || defined __ORBIS__ if(m_pvProductInfo) - { + { m_bIsSelected = true; vector<SonyCommerce::ProductInfo >::iterator it = m_pvProductInfo->begin(); string teststring; @@ -315,7 +315,7 @@ void UIScene_DLCOffersMenu::handleFocusChange(F64 controlId, F64 childId) } SonyCommerce::ProductInfo info = *it; - if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED) + if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED) { m_bHasPurchased=false; } @@ -379,7 +379,7 @@ void UIScene_DLCOffersMenu::tick() #ifdef __PS3__ // is the item purchasable? - if(info.purchasabilityFlag==1) + if(info.purchasabilityFlag==1) { // can be bought app.DebugPrintf("Adding DLC (%s) - not bought\n",teststring.c_str()); @@ -397,7 +397,7 @@ void UIScene_DLCOffersMenu::tick() } #else // __ORBIS__ // is the item purchasable? - if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED) + if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED) { // can be bought m_buttonListOffers.addItem(teststring,false,i); @@ -445,13 +445,13 @@ void UIScene_DLCOffersMenu::tick() // does the DLC info have an image? if(pSONYDLCInfo && pSONYDLCInfo->dwImageBytes!=0) - { + { pbImageData=pSONYDLCInfo->pbImageData; iImageDataBytes=pSONYDLCInfo->dwImageBytes; bDeleteData=false; // we'll clean up the local LDC images - } + } else -#endif +#endif if(info.imageUrl[0]!=0) { SonyHttp::getDataFromURL(info.imageUrl,(void **)&pbImageData,&iImageDataBytes); @@ -460,7 +460,7 @@ void UIScene_DLCOffersMenu::tick() if(iImageDataBytes!=0) { - // set the image + // set the image registerSubstitutionTexture(textureName,pbImageData,iImageDataBytes,bDeleteData); m_bitmapIconOfferImage.setTextureName(textureName); // 4J Stu - Don't delete this @@ -497,25 +497,25 @@ void UIScene_DLCOffersMenu::tick() m_labelOffers.setLabel(app.GetString(IDS_NO_DLCCATEGORIES)); } } - + m_Timer.setVisible(false); m_bProductInfoShown=true; } } else { -#ifdef __PSVITA__ +#ifdef __PSVITA__ // MGH - fixes bug 5768 on Vita - should be extended properly to work for other platforms if((SonyCommerce_Vita::getPurchasabilityUpdated()) && app.GetCommerceProductListRetrieved()&& app.GetCommerceProductListInfoRetrieved() && m_iTotalDLC > 0) { - - { + + { vector<SonyCommerce::ProductInfo >::iterator it = m_pvProductInfo->begin(); for(int i=0;i<m_iTotalDLC;i++) { SonyCommerce::ProductInfo info = *it; // is the item purchasable? - if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED) + if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED) { // can be bought m_buttonListOffers.showTick(i, false); @@ -577,11 +577,11 @@ void UIScene_DLCOffersMenu::tick() // does the DLC info have an image? if(pSONYDLCInfo->dwImageBytes!=0) - { + { pbImageData=pSONYDLCInfo->pbImageData; iImageDataBytes=pSONYDLCInfo->dwImageBytes; bDeleteData=false; // we'll clean up the local LDC images - } + } else #endif { @@ -601,7 +601,7 @@ void UIScene_DLCOffersMenu::tick() else { m_bitmapIconOfferImage.setTextureName(L""); - } + } } else { @@ -620,7 +620,7 @@ void UIScene_DLCOffersMenu::tick() { // DLCContentRetrieved is to see if the type of content has been retrieved - and on Durango there is only type 0 - XMARKETPLACE_OFFERING_TYPE_CONTENT if(app.DLCContentRetrieved(e_Marketplace_Content)) - { + { m_bDLCRequiredIsRetrieved=true; // Retrieve the info @@ -660,29 +660,10 @@ void UIScene_DLCOffersMenu::tick() } } } - -// if(m_bBitmapOfferIconDisplayed==false) -// { -// // do we have it yet? -// if -// } - // retrieve the icons for the DLC -// if(m_vIconRetrieval.size()>0) -// { -// // for each icon, request it, and remove it from the list -// // the callback for the retrieval will update the display if needed -// -// AUTO_VAR(itEnd, m_vIconRetrieval.end()); -// for (AUTO_VAR(it, m_vIconRetrieval.begin()); it != itEnd; it++) -// { -// -// } -// -// } #endif } -#if defined _XBOX_ONE +#if defined _XBOX_ONE void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) { MARKETPLACE_CONTENTOFFER_INFO xOffer; @@ -719,7 +700,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) app.DebugPrintf("Unknown offer - %ls\n",xOffer.wszOfferName); } } - + qsort( OrderA, uiDLCCount, sizeof(SORTINDEXSTRUCT), OrderSortFunction ); for(int i = 0; i < uiDLCCount; i++) @@ -737,7 +718,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) } if(pDLC->eDLCType==(eDLCContentType)m_iProductInfoIndex) - { + { wstring wstrTemp=xOffer.wszOfferName; // 4J-PB - Rog requested we remove the Minecraft at the start of the name. It's required for the Bing search, but gets in the way here @@ -774,7 +755,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) * We've filtered results out from the list, need to keep track * of the 'actual' list index. */ - iCount++; + iCount++; } } @@ -834,7 +815,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) // is the file in the local DLC images? - // is the file in the TMS XZP? + // is the file in the TMS XZP? //int iIndex = app.GetLocalTMSFileIndex(cString, true); if(dlc->dwImageBytes!=0) @@ -862,7 +843,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) else { if(hasRegisteredSubstitutionTexture(cString)==false) - { + { BYTE *pData=NULL; DWORD dwSize=0; app.GetMemFileDetails(cString,&pData,&dwSize); @@ -879,12 +860,12 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) m_bitmapIconOfferImage.setTextureName(cString); } bImageAvailable=true; - } + } } m_labelHTMLSellText.setLabel(xOffer.wszSellText); - // set the price info + // set the price info m_labelPriceTag.setVisible(true); m_labelPriceTag.setLabel(xOffer.wszCurrencyPrice); @@ -923,7 +904,7 @@ void UIScene_DLCOffersMenu::HandleDLCInstalled() } // void UIScene_DLCOffersMenu::HandleDLCMountingComplete() -// { +// { // app.DebugPrintf(4,"UIScene_SkinSelectMenu::HandleDLCMountingComplete\n"); //} diff --git a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp index 6514e6ec..af86d4b8 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp @@ -80,7 +80,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa for(unsigned int level = ench->getMinLevel(); level <= ench->getMaxLevel(); ++level) { m_enchantmentIdAndLevels.push_back(pair<int,int>(ench->id,level)); - m_buttonListEnchantments.addItem(app.GetString( ench->getDescriptionId() ) + _toString<int>(level) ); + m_buttonListEnchantments.addItem(app.GetString( ench->getDescriptionId() ) + std::to_wstring(level) ); } } @@ -196,7 +196,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]); } } diff --git a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp index c5a8e61a..2f43cada 100644 --- a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp @@ -61,13 +61,13 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",playerName); Random random(8124371); - int found=(int)noNoiseString.find(L"{*NOISE*}"); + size_t found=noNoiseString.find(L"{*NOISE*}"); int length; while (found!=string::npos) { length = random.nextInt(4) + 3; m_noiseLengths.push_back(length); - found=(int)noNoiseString.find(L"{*NOISE*}",found+1); + found=noNoiseString.find(L"{*NOISE*}",found+1); } updateNoise(); @@ -77,7 +77,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) m_paragraphs = vector<wstring>(); int lastIndex = 0; for ( int index = 0; - index != wstring::npos; + index != wstring::npos; index = noiseString.find(L"<br /><br />", index+12, 12) ) { @@ -198,7 +198,7 @@ void UIScene_EndPoem::updateNoise() { Minecraft *pMinecraft = Minecraft::GetInstance(); noiseString = noNoiseString; - + int length = 0; wchar_t replacements[64]; wstring replaceString = L""; @@ -209,8 +209,8 @@ void UIScene_EndPoem::updateNoise() wstring tag = L"{*NOISE*}"; - AUTO_VAR(it, m_noiseLengths.begin()); - int found=(int)noiseString.find(tag); + auto it = m_noiseLengths.begin(); + size_t found= noiseString.find(tag); while (found!=string::npos && it != m_noiseLengths.end() ) { length = *it; @@ -229,7 +229,7 @@ void UIScene_EndPoem::updateNoise() static wstring acceptableLetters = L"!\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_'|}~"; randomChar = acceptableLetters[ random->nextInt((int)acceptableLetters.length()) ]; } - + wstring randomCharStr = L""; randomCharStr.push_back(randomChar); if(randomChar == L'<') @@ -275,6 +275,6 @@ void UIScene_EndPoem::updateNoise() //ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0)); //ib.put(listPos + pos + 32); - found=(int)noiseString.find(tag,found+1); + found=noiseString.find(tag,found+1); } }
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp index 723937d0..4a9dab43 100644 --- a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp @@ -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()); @@ -261,10 +261,8 @@ void UIScene_InventoryMenu::updateEffectsDisplay() int iValue = 0; IggyDataValue *UpdateValue = new IggyDataValue[activeEffects->size()*2]; - for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) - { - MobEffectInstance *effect = *it; - + for(auto& effect : *activeEffects) + { if(effect->getDuration() >= m_bEffectTime[effect->getId()]) { wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim(); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index d3cbe4c3..0c515ec0 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -300,7 +300,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer bool bTexturePackAlreadyListed; bool bNeedToGetTPD=false; Minecraft *pMinecraft = Minecraft::GetInstance(); - int texturePacksCount = pMinecraft->skins->getTexturePackCount(); + int texturePacksCount = pMinecraft->skins->getTexturePackCount(); for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) { @@ -407,7 +407,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() // update the tooltips // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should the the View Gamercard tooltip - int iRB=-1; + int iRB=-1; int iY = -1; int iLB = -1; int iX=-1; @@ -418,7 +418,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() else if (DoesSavesListHaveFocus()) { if((m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC)) - { + { if(StorageManager.GetSaveDisabled()) { iRB=IDS_TOOLTIPS_DELETESAVE; @@ -474,7 +474,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() // Is there a save from PS3 or PSVita available? // Sony asked that this be displayed at all times so users are aware of the functionality. We'll display some text when there's no save available //if(app.getRemoteStorage()->saveIsAvailable()) - { + { bool bSignedInLive = ProfileManager.IsSignedInLive(m_iPad); if(bSignedInLive) { @@ -489,7 +489,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK, iX, iY,-1,-1,iLB,iRB); } -// +// void UIScene_LoadOrJoinMenu::Initialise() { m_iSaveListIndex = 0; @@ -577,7 +577,7 @@ void UIScene_LoadOrJoinMenu::handleGainFocus(bool navBack) { app.SetLiveLinkRequired( true ); - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); + m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); // re-enable button presses m_bIgnoreInput=false; @@ -661,7 +661,7 @@ void UIScene_LoadOrJoinMenu::tick() #ifdef SONY_REMOTE_STORAGE_DOWNLOAD // if the loadOrJoin menu has focus again, we can clear the saveTransfer flag now. Added so we can delay the ehternet disconnect till it's cleaned up if(m_eSaveTransferState == eSaveTransfer_Idle) - m_bSaveTransferRunning = false; + m_bSaveTransferRunning = false; #endif #if defined(_XBOX_ONE) || defined(__ORBIS__) if(m_bUpdateSaveSize) @@ -978,7 +978,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() m_pSaveDetails=StorageManager.ReturnSavesInfo(); if(m_pSaveDetails==NULL) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); } #endif @@ -1027,7 +1027,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() m_pSaveDetails=StorageManager.ReturnSavesInfo(); if(m_pSaveDetails==NULL) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); } #if TO_BE_IMPLEMENTED @@ -1054,10 +1054,8 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons() int i = 0; - for(AUTO_VAR(it, app.getLevelGenerators()->begin()); it != app.getLevelGenerators()->end(); ++it) + for ( LevelGenerationOptions *levelGen : *app.getLevelGenerators() ) { - LevelGenerationOptions *levelGen = *it; - // retrieve the save icon from the texture pack, if there is one unsigned int uiTexturePackID=levelGen->getRequiredTexturePackId(); @@ -1071,7 +1069,7 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons() continue; } } - + // 4J-JEV: For debug. Ignore worlds with no name. LPCWSTR wstr = levelGen->getWorldName(); m_buttonListSaves.addItem( wstr ); @@ -1124,7 +1122,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr case ACTION_MENU_X: #if TO_BE_IMPLEMENTED // Change device - // Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage + // Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage // device, and repeatedly backs out of the SD screen, disconnects from LIVE, and then selects a SD, the title crashes. m_bIgnoreInput=true; StorageManager.SetSaveDevice(&CScene_MultiGameJoinLoad::DeviceSelectReturned,this,true); @@ -1142,7 +1140,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr { bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); if(bSignedInLive) - { + { LaunchSaveTransfer(); } } @@ -1334,7 +1332,7 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo UIScene_LoadOrJoinMenu *pClass=(UIScene_LoadOrJoinMenu *)lpParam; pClass->m_bIgnoreInput=false; if (bRes) - { + { uint16_t ui16Text[128]; ZeroMemory(ui16Text, 128 * sizeof(uint16_t) ); InputManager.GetText(ui16Text); @@ -1347,13 +1345,13 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo StorageManager.RenameSaveData(pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC, ui16Text,&UIScene_LoadOrJoinMenu::RenameSaveDataReturned,pClass); #endif } - else + else { pClass->m_bIgnoreInput=false; pClass->updateTooltips(); } - } - else + } + else { pClass->m_bIgnoreInput=false; pClass->updateTooltips(); @@ -1367,13 +1365,13 @@ void UIScene_LoadOrJoinMenu::handleInitFocus(F64 controlId, F64 childId) app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleInitFocus - %d , %d\n", (int)controlId, (int)childId); } -void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId) +void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId) { app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleFocusChange - %d , %d\n", (int)controlId, (int)childId); - + switch((int)controlId) { - case eControl_GamesList: + case eControl_GamesList: m_iGameListIndex = childId; m_buttonListGames.updateChildFocus( (int) childId ); break; @@ -1409,7 +1407,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) ui.PlayUISFX(eSFX_Press); if((int)childId == JOIN_LOAD_CREATE_BUTTON_INDEX) - { + { app.SetTutorialMode( false ); m_controlJoinTimer.setVisible( false ); @@ -1461,7 +1459,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) } else #endif - { + { app.SetTutorialMode( false ); if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) @@ -1503,7 +1501,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) case eControl_GamesList: { m_bIgnoreInput=true; - + m_eAction = eAction_JoinGame; //CD - Added for audio @@ -1538,7 +1536,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) bool bPlayStationPlus=true; int iPadWithNoPlaystationPlus=0; - bool isSignedInLive = true; + bool isSignedInLive = true; int iPadNotSignedInLive = -1; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -1631,7 +1629,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; - param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; + param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); iResult=sceNpCommerceDialogOpen(¶m); @@ -1714,7 +1712,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) } void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) -{ +{ // Load data from disc //File saveFile( L"Tutorial\\Tutorial" ); //LoadSaveFromDisk(&saveFile); @@ -1812,7 +1810,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should show the View Gamercard tooltip - int iRB=-1; + int iRB=-1; int iY = -1; int iX=-1; @@ -1859,10 +1857,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() unsigned int sessionIndex = 0; m_buttonListGames.setCurrentSelection(0); - for( AUTO_VAR(it, m_currentSessions->begin()); it < m_currentSessions->end(); ++it) + for( FriendSessionInfo *sessionInfo : *m_currentSessions ) { - FriendSessionInfo *sessionInfo = *it; - wchar_t textureName[64] = L"\0"; // Is this a default game or a texture pack game? @@ -2036,7 +2032,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) if(iImageDataBytes!=0) { - // set the image + // set the image registerSubstitutionTexture(textureName,pbImageData,iImageDataBytes,true); m_iConfigA[i]=-1; } @@ -2049,7 +2045,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) bool bAllDone=true; for(int i=0;i<m_iTexturePacksNotInstalled;i++) { - if(m_iConfigA[i]!=-1) + if(m_iConfigA[i]!=-1) { bAllDone = false; } @@ -2064,13 +2060,13 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) } break; -#endif +#endif } } void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform savePlatform /*= SAVE_FILE_PLATFORM_LOCAL*/) -{ +{ // we'll only be coming in here when the tutorial is loaded now StorageManager.ResetSaveData(); @@ -2128,7 +2124,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save #ifdef SONY_REMOTE_STORAGE_DOWNLOAD void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() -{ +{ wchar_t wFileName[128]; mbstowcs(wFileName, app.getRemoteStorage()->getLocalFilename(), strlen(app.getRemoteStorage()->getLocalFilename())+1); // plus null @@ -2201,7 +2197,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt // Check that we have a valid save selected (can get a bad index if the save list has been refreshed) bool validSelection= pClass->m_iDefaultButtonsC != 0 && pClass->m_iSaveListIndex >= pClass->m_iDefaultButtonsC; - if(result==C4JStorage::EMessage_ResultDecline && validSelection) + if(result==C4JStorage::EMessage_ResultDecline && validSelection) { if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { @@ -2231,7 +2227,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) if(bRes) { // wipe the list and repopulate it - pClass->m_iState=e_SavesRepopulateAfterDelete; + pClass->m_iState=e_SavesRepopulateAfterDelete; } else pClass->m_bIgnoreInput=false; @@ -2363,7 +2359,7 @@ int UIScene_LoadOrJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStora { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack, pClass); } @@ -2391,7 +2387,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon if(bContinue==true) { - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); if(pSONYDLCInfo!=NULL) { char chName[42]; @@ -2420,7 +2416,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon } else { - app.Checkout(chSkuID); + app.Checkout(chSkuID); } } } @@ -2436,7 +2432,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS UIScene_LoadOrJoinMenu *pClass = (UIScene_LoadOrJoinMenu *)pParam; // Exit with or without saving - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { // we need to enable background downloading for the DLC XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); @@ -2454,7 +2450,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS } #endif - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); if(pSONYDLCInfo!=NULL) { char chName[42]; @@ -2483,16 +2479,16 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS } else { - app.Checkout(chSkuID); + app.Checkout(chSkuID); } } } #endif -#if defined _XBOX_ONE +#if defined _XBOX_ONE if(ProfileManager.IsSignedIn(iPad)) - { + { if (ProfileManager.IsSignedInLive(iPad)) { wstring ProductId; @@ -2501,13 +2497,13 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL); } else - { + { // 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why. UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); } } -#endif +#endif } pClass->m_bIgnoreInput=false; @@ -2519,7 +2515,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStora { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { #if defined(__PS3__) SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass); @@ -2679,7 +2675,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter Compression::UseDefaultThreadStorage(); UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter; pClass->m_saveTransferDownloadCancelled = false; - m_bSaveTransferRunning = true; + m_bSaveTransferRunning = true; bool bAbortCalled = false; Minecraft *pMinecraft=Minecraft::GetInstance(); bool bSaveFileCreated = false; @@ -2728,7 +2724,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); } } - else + else { // no save available, inform the user about the functionality UINT uiIDA[1]; @@ -2752,7 +2748,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that + StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that BYTE bTextMetadata[88]; ZeroMemory(bTextMetadata,88); @@ -2784,7 +2780,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter { // we can't cancel here, we need the saves info so we can delete the file if(pClass->m_saveTransferDownloadCancelled) - { + { WCHAR wcTemp[256]; swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; @@ -2799,7 +2795,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter break; case eSaveTransfer_GettingSavesInfo: if(pClass->m_saveTransferDownloadCancelled) - { + { WCHAR wcTemp[256]; swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; @@ -2916,7 +2912,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that + StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that BYTE bTextMetadata[88]; ZeroMemory(bTextMetadata,88); @@ -2929,12 +2925,12 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter } -#ifdef SPLIT_SAVES +#ifdef SPLIT_SAVES ConsoleSaveFileOriginal oldFormatSave( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() ); pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer ); pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - pSave->Flush(false,false); + pSave->Flush(false,false); pClass->m_eSaveTransferState = eSaveTransfer_Saving; #else pSave = new ConsoleSaveFileOriginal( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() ); @@ -2970,7 +2966,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter delete pSave; - + pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); pClass->m_eSaveTransferState = eSaveTransfer_Succeeded; } @@ -2984,7 +2980,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } break; @@ -2999,7 +2995,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter if(bSaveFileCreated) { if(pClass->m_saveTransferDownloadCancelled) - { + { WCHAR wcTemp[256]; swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; @@ -3077,7 +3073,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter #endif } - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } if(bSaveFileCreated) // save file has been created, then deleted. @@ -3223,7 +3219,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); pClass->m_eSaveUploadState = esaveUpload_Finished; } break; @@ -3240,7 +3236,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); pClass->m_eSaveUploadState = esaveUpload_Finished; } } @@ -3289,7 +3285,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferDialogReturned(void *pParam,int iPad,C4J { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // results switched for this dialog - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { // upload the save pClass->LaunchSaveUpload(); @@ -3408,13 +3404,13 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) ByteArrayInputStream bais(UIScene_LoadOrJoinMenu::s_transferData); DataInputStream dis(&bais); - wstring saveTitle = dis.readUTF(); + wstring saveTitle = dis.readUTF(); StorageManager.SetSaveTitle(saveTitle.c_str()); wstring saveUniqueName = dis.readUTF(); // 4J Stu - Don't set this any more. We added it so that we could share the ban list data for this save - // However if the player downloads the same save multiple times, it will overwrite the previous version + // However if the player downloads the same save multiple times, it will overwrite the previous version // with that filname, and they could have made changes to it. //StorageManager.SetSaveUniqueFilename((wchar_t *)saveUniqueName.c_str()); @@ -3424,7 +3420,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) byteArray ba(thumbnailSize); dis.readFully(ba); - + // retrieve the seed value from the image metadata, we need to change to host options, then set it back again bool bHostOptionsRead = false; @@ -3458,13 +3454,13 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) case eSaveTransferFile_SaveData: { #ifdef SPLIT_SAVES - if(!pStateContainer->m_bSaveTransferCancelled) + if(!pStateContainer->m_bSaveTransferCancelled) { ConsoleSaveFileOriginal oldFormatSave( L"Temp name", UIScene_LoadOrJoinMenu::s_transferData.data, UIScene_LoadOrJoinMenu::s_transferData.length, false, SAVE_FILE_PLATFORM_X360 ); pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer ); pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); + if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); } pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Saving; @@ -3485,7 +3481,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) pSave->ConvertToLocalPlatform(); pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); + if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); pStateContainer->m_iProgress+=1; if(pStateContainer->m_iProgress==101) @@ -3501,8 +3497,8 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) // On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete // the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving. #if defined(_DURANGO) || defined(__ORBIS__) - pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); - + pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); + while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) { Sleep(10); @@ -3517,9 +3513,9 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) #ifdef _XBOX_ONE pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE); #endif - + pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - + // wipe the list and repopulate it if(!pStateContainer->m_bSaveTransferCancelled) pStateContainer->m_pClass->m_iState=e_SavesRepopulateAfterTransferDownload; @@ -3559,7 +3555,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) } void UIScene_LoadOrJoinMenu::RequestFileSize( SaveTransferStateContainer *pClass, wchar_t *filename ) -{ +{ Minecraft *pMinecraft=Minecraft::GetInstance(); // get the save file size @@ -3665,7 +3661,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsigned l if(pClass->m_bSaveTransferCancelled) // was cancelled { - pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING); + pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING); swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING)); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3740,7 +3736,7 @@ int UIScene_LoadOrJoinMenu::CopySaveDialogReturned(void *pParam,int iPad,C4JStor { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { LoadingInputParams *loadingParams = new LoadingInputParams(); @@ -3785,7 +3781,7 @@ int UIScene_LoadOrJoinMenu::CopySaveThreadProc( LPVOID lpParameter ) ui.LeaveCallbackIdCriticalSection(); // Copy save data takes two callbacks - one for completion, and one for progress. The progress callback also lets us cancel the operation, if we return false. StorageManager.CopySaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC],UIScene_LoadOrJoinMenu::CopySaveDataReturned,UIScene_LoadOrJoinMenu::CopySaveDataProgress,lpParameter); - + bool bContinue = true; do { @@ -3822,7 +3818,7 @@ int UIScene_LoadOrJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C { pClass->m_bCopying = false; // wipe the list and repopulate it - pClass->m_iState=e_SavesRepopulateAfterDelete; + pClass->m_iState=e_SavesRepopulateAfterDelete; ui.LeaveCallbackIdCriticalSection(); } else |
