|
@@ -118,15 +118,15 @@ CraftingGridView::CraftingGridView(Text id,
|
|
delete[] msg;
|
|
delete[] msg;
|
|
setNeedToolTipEvent([this](Zeichnung* z, Punkt p) {
|
|
setNeedToolTipEvent([this](Zeichnung* z, Punkt p) {
|
|
int slot = getSlotByLocalPos(p);
|
|
int slot = getSlotByLocalPos(p);
|
|
- if (currentTooltipSlot != slot)
|
|
+ if (currentTooltipSlot != slot && currentTooltipSlot != -1)
|
|
{
|
|
{
|
|
|
|
+ std::cout << "closing tooltip\n";
|
|
this->setToolTipZ(0);
|
|
this->setToolTipZ(0);
|
|
currentTooltipSlot = -1;
|
|
currentTooltipSlot = -1;
|
|
}
|
|
}
|
|
- else
|
|
+ if (requestetTooltipSlot != slot && slot != -1)
|
|
- return;
|
|
|
|
- if (requestetTooltipSlot != slot)
|
|
|
|
{
|
|
{
|
|
|
|
+ std::cout << "requesting tooltip for slot " << slot << "\n";
|
|
requestetTooltipSlot = slot;
|
|
requestetTooltipSlot = slot;
|
|
char* msg = new char[this->id.getLength() + 6];
|
|
char* msg = new char[this->id.getLength() + 6];
|
|
msg[0] = 2;
|
|
msg[0] = 2;
|
|
@@ -135,7 +135,9 @@ CraftingGridView::CraftingGridView(Text id,
|
|
*(int*)(msg + 2 + this->id.getLength()) = slot;
|
|
*(int*)(msg + 2 + this->id.getLength()) = slot;
|
|
World::INSTANCE->zClient()->inventoryAPIRequest(
|
|
World::INSTANCE->zClient()->inventoryAPIRequest(
|
|
this->target, msg, this->id.getLength() + 6);
|
|
this->target, msg, this->id.getLength() + 6);
|
|
|
|
+ return 1;
|
|
}
|
|
}
|
|
|
|
+ return 0;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -267,16 +269,24 @@ void CraftingGridView::api(char* message)
|
|
int slotId = *(int*)(message + 1);
|
|
int slotId = *(int*)(message + 1);
|
|
if (slotId == requestetTooltipSlot)
|
|
if (slotId == requestetTooltipSlot)
|
|
{
|
|
{
|
|
|
|
+ std::cout << "tooltip loaded for slot " << slotId << "\n";
|
|
short len = *(short*)(message + 5);
|
|
short len = *(short*)(message + 5);
|
|
- char* uiml = new char[len + 1];
|
|
+ if (len > 0)
|
|
- memcpy(uiml, message + 7, len);
|
|
+ {
|
|
- uiml[len] = 0;
|
|
+ char* uiml = new char[len + 1];
|
|
- UIMLToolTip* tip = new UIMLToolTip();
|
|
+ memcpy(uiml, message + 7, len);
|
|
- tip->setUIML(uiml);
|
|
+ uiml[len] = 0;
|
|
- setToolTipZ(tip);
|
|
+ UIMLToolTip* tip = new UIMLToolTip();
|
|
- delete[] uiml;
|
|
+ tip->setUIML(uiml);
|
|
- currentTooltipSlot = slotId;
|
|
+ tip->setWarten(0);
|
|
- requestetTooltipSlot = -1;
|
|
+ tip->setPosition(mausPos.x, mausPos.y + 15);
|
|
|
|
+ setToolTipZ(tip);
|
|
|
|
+ delete[] uiml;
|
|
|
|
+ currentTooltipSlot = slotId;
|
|
|
|
+ requestetTooltipSlot = -1;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ toolTipRequested = 0;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -368,12 +378,20 @@ void CraftingGridView::render(Bild& rObj)
|
|
|
|
|
|
void CraftingGridView::doMausEreignis(MausEreignis& me, bool userRet)
|
|
void CraftingGridView::doMausEreignis(MausEreignis& me, bool userRet)
|
|
{
|
|
{
|
|
|
|
+ mausPos.x = me.originalX;
|
|
|
|
+ mausPos.y = me.originalY;
|
|
if (!slots) return;
|
|
if (!slots) return;
|
|
if (me.id == ME_Bewegung)
|
|
if (me.id == ME_Bewegung)
|
|
{
|
|
{
|
|
if (getSlotByLocalPos(Punkt(me.mx, me.my)) != currentTooltipSlot)
|
|
if (getSlotByLocalPos(Punkt(me.mx, me.my)) != currentTooltipSlot)
|
|
{
|
|
{
|
|
- setToolTipZ(0);
|
|
+ if (currentTooltipSlot != -1)
|
|
|
|
+ {
|
|
|
|
+ std::cout << "closing tooltip\n";
|
|
|
|
+ setToolTipZ(0);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ toolTipRequested = 0;
|
|
currentTooltipSlot = -1;
|
|
currentTooltipSlot = -1;
|
|
}
|
|
}
|
|
}
|
|
}
|