Skip to content
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

Fix regression when vending identical nonstackable items #364

Merged
merged 4 commits into from
Dec 26, 2016

Conversation

farrainbow
Copy link
Contributor

No description provided.

@allanon
Copy link
Member

allanon commented Dec 20, 2016

👍 And I ❤️ tests.

if ($item->{name} eq $sale->{name} and !$used_items{$item->{invIndex}}) {
$cart_item = $item;
$used_items{$item->{invIndex}} = 1;
last
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like early exit style better than wrapping the whole block in an if. Just personal preference, please feel free to ignore me. :)

Here's my suggestion:

for my $item (@{$char->cart->getItems}) {
    next if $item->{name} ne $sale->{name};
    next if $used_items{$item->{invIndex}};
    $cart_item = $used_items->{$item->{invIndex}} = $item;
    last;
}

Copy link
Contributor Author

@farrainbow farrainbow Dec 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good one, will change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@Henrybk
Copy link
Contributor

Henrybk commented Dec 25, 2016

Seems fine.

@Henrybk Henrybk merged commit 61f1e6d into master Dec 26, 2016
@farrainbow farrainbow deleted the nonstackable_shop_regression branch December 26, 2016 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants