December 2014 files
This commit is contained in:
@@ -44,7 +44,10 @@ void UIScene_AbstractContainerMenu::handleDestroy()
|
||||
|
||||
// 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss.
|
||||
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
|
||||
if(pMinecraft->localplayers[m_iPad] != NULL) pMinecraft->localplayers[m_iPad]->closeContainer();
|
||||
if(pMinecraft->localplayers[m_iPad] != NULL && pMinecraft->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId)
|
||||
{
|
||||
pMinecraft->localplayers[m_iPad]->closeContainer();
|
||||
}
|
||||
|
||||
ui.OverrideSFX(m_iPad,ACTION_MENU_A,false);
|
||||
ui.OverrideSFX(m_iPad,ACTION_MENU_OK,false);
|
||||
@@ -200,7 +203,7 @@ void UIScene_AbstractContainerMenu::render(S32 width, S32 height, C4JRender::eVi
|
||||
|
||||
if(m_needsCacheRendered)
|
||||
{
|
||||
m_expectedCachedSlotCount = 0;
|
||||
m_expectedCachedSlotCount = GetBaseSlotCount();
|
||||
unsigned int count = m_menu->getSize();
|
||||
for(unsigned int i = 0; i < count; ++i)
|
||||
{
|
||||
@@ -222,6 +225,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
|
||||
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
|
||||
|
||||
shared_ptr<ItemInstance> item = nullptr;
|
||||
int slotId = -1;
|
||||
if(wcscmp((wchar_t *)region->name,L"pointerIcon")==0)
|
||||
{
|
||||
m_cacheSlotRenders = false;
|
||||
@@ -229,7 +233,6 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
|
||||
}
|
||||
else
|
||||
{
|
||||
int slotId = -1;
|
||||
swscanf((wchar_t*)region->name,L"slot_%d",&slotId);
|
||||
if (slotId == -1)
|
||||
{
|
||||
@@ -243,7 +246,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
|
||||
}
|
||||
}
|
||||
|
||||
if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true);
|
||||
if(item != NULL) customDrawSlotControl(region,m_iPad,item,m_menu->isValidIngredient(item, slotId)?1.0f:0.5f,item->isFoil(),true);
|
||||
}
|
||||
|
||||
void UIScene_AbstractContainerMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
@@ -259,21 +262,24 @@ void UIScene_AbstractContainerMenu::handleInput(int iPad, int key, bool repeat,
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_AbstractContainerMenu::SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot)
|
||||
void UIScene_AbstractContainerMenu::SetPointerText(vector<HtmlString> *description, bool newSlot)
|
||||
{
|
||||
//app.DebugPrintf("Setting pointer text\n");
|
||||
m_cursorPath.setLabel(description,false,newSlot);
|
||||
m_cursorPath.setLabel(HtmlString::Compose(description), false, newSlot);
|
||||
}
|
||||
|
||||
void UIScene_AbstractContainerMenu::setSectionFocus(ESceneSection eSection, int iPad)
|
||||
{
|
||||
UIControl *newFocus = getSection(eSection);
|
||||
if(newFocus) newFocus->setFocus(true);
|
||||
|
||||
if(m_focusSection != eSectionNone)
|
||||
{
|
||||
UIControl *currentFocus = getSection(m_focusSection);
|
||||
if(currentFocus) currentFocus->setFocus(false);
|
||||
// 4J-TomK only set current focus to false if it differs from last (previously this continuously fired iggy functions when they were identical!
|
||||
if(currentFocus != newFocus)
|
||||
if(currentFocus) currentFocus->setFocus(false);
|
||||
}
|
||||
UIControl *newFocus = getSection(eSection);
|
||||
if(newFocus) newFocus->setFocus(true);
|
||||
|
||||
m_focusSection = eSection;
|
||||
}
|
||||
|
||||
@@ -294,6 +300,13 @@ shared_ptr<ItemInstance> UIScene_AbstractContainerMenu::getSlotItem(ESceneSectio
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
Slot *UIScene_AbstractContainerMenu::getSlot(ESceneSection eSection, int iSlot)
|
||||
{
|
||||
Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot );
|
||||
if(slot) return slot;
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
bool UIScene_AbstractContainerMenu::isSlotEmpty(ESceneSection eSection, int iSlot)
|
||||
{
|
||||
Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot );
|
||||
|
||||
Reference in New Issue
Block a user