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

item undo bug #400

Open
RogerLiu-Yuxuan opened this issue Jan 19, 2022 · 0 comments
Open

item undo bug #400

RogerLiu-Yuxuan opened this issue Jan 19, 2022 · 0 comments

Comments

@RogerLiu-Yuxuan
Copy link

In match.py:

The undo function is defined by the following script.

def undo(self, event: Event):
assert event.after_id == 0 or event.before_id == 0
item_id = event.before_id or event.after_id
prev = None
while prev is None or prev.item_id != item_id:
prev = self._events.pop()
if prev.type == "ITEM_PURCHASED":
self.destroy(prev.item_id)
elif prev.type == "ITEM_DESTROYED":
self.add(prev.item_id)
elif prev.type == "ITEM_SOLD":
self.add(prev.item_id)
else:
raise TypeError(f"Unexpected event type {prev.type}")

The event of synthetic an item is down by destroying the previous item first and then purchasing a new item. If an undo event happens to this item, the item will be destroyed directly. However, the correct undo of synthetic is disassembled this item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants