FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: getMatchingInstances and undo/redo problems  (Read 2520 times)

CheeseSucker

  • Developer
  • Newbie
  • *
  • Posts: 26
  • FIFE programmer
    • View Profile
getMatchingInstances and undo/redo problems
« on: May 24, 2009, 05:08:22 am »

I did some debugging to figure out why the undomanager didn't work as expected when undoing and redoing many actions at once.

To recreate this problem:
 1) Remove some tiles (eg. 30)
 2) Open HistoryManager and click on the item one step above the selected item

What is supposed to happen is:
 1) Historymanager places 30 tiles, until it reaches first shared branch or top node
 2) All branches between shared branch and target node are set to point to target node
     (there are no branches between them, so no change is done here in this case)
 3) It then removes 29 tiles until it reaches target node
(Yes, I know this could have been done in one undo)

However, on step 3 it does not remove any tiles at all, so the tiles are duplicated.

I looked in the code and removeInstance relies on Camera::getMatchingInstances(location) which operates on a cache of the instances that can be seen on screen. This means that it will return an empty list when removeinstances tries to access a tiles outside the screen, and that it does not have any of the changes that has been done between renders.

So my question is: Are there an uncached function similar to getMatchingInstances that contains all instances on a layer?

If not, I suggest creating one/some in Layer.
Logged

CheeseSucker

  • Developer
  • Newbie
  • *
  • Posts: 26
  • FIFE programmer
    • View Profile
Logged