-
Notifications
You must be signed in to change notification settings - Fork 178
Anvil CUIItemUpgrade implemented #417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Scroll check and other reviews solved. |
|
I used sn/itemupgrade, and it is compatible with @stefannikolei’s #743 PR. @twostars |
9390eb8 to
46d057f
Compare
twostars
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to get #743 in before this, just to make life a little bit easier.
The item/icon data management here really leaves a lot to be desired though.
All of this (the reliance on the item having a given stack size and being stackable to determine how to handle the item/icon data) is a giant red flag for potential problems:
if (spItem->iCount > 1 && spItem->IsStackable())
{
// Clean divided item
if (spItem != nullptr)
{
if (spItem->pUIIcon != nullptr)
{
delete spItem->pUIIcon;
spItem->pUIIcon = nullptr;
}
if (m_pSelectedItem == spItem)
m_pSelectedItem = nullptr;
delete spItem;
spItem = nullptr;
}
}
else
{
// Restore the icon position to its original place if drop failed.
CancelIconDrop(spItem);
}Even off-handedly, without looking closer at it, I have to wonder how that handles it when it splits from a stack of 2, for example. That is, potentially, it splits creating a new instance, ends up with a stack of 1, so it doesn't consider it a managed instance and doesn't free it when the time comes.
Regardless of whether or not that's actually the case here, it would be better to just simplify so there's no question as to how things behave without having to dive through all of the associated code.
But yeah, once the server part of it's in, and the icon stuff's cleaned up, it should be fine to merge.
|
Be sure the file is formatted. CTRL+K -> D will reformat the entire document. |
Please check the type of change your PR introduces:
What is the current behaviour?
-Item Upgrade not implemented
What is the new behaviour?
-The CUIItemUpgrade class has been implemented, and the UI behaviors work the same as in the original 1298 Client. Items can be upgraded correctly.
Why and how did I change this?
-The items in the ItemUpgrade window are copied from the inventory and backed up. When the window is closed or the Cancel button is pressed, the items are restored from the backup. A backup is used to prevent errors when switching between Inventory and ItemUpgrade. If the upgrade process succeeds or fails, the backup is updated accordingly.
Checklist