bugBattle for Wesnoth - Bugs: bug #21285, Undo command fires an event

Show feedback again

bug #21285: Undo command fires an event

Submitted by:  Dan Gerhards <beetlenaut>
Submitted on:  Tue Nov 19 17:18:44 2013  
Category: Feature RequestSeverity: 1 - Wish
Priority: 5 - NormalItem Group: WML
Status: FixedPrivacy: Public
Assigned to: NoneOpen/Closed: Open
Release: 1.11.7+devOperating System: Linux

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Thu Mar 23 17:55:20 2017, comment #3:

1.13 supports a [on_undo] tgha that contsins actionwml that is exscuted when the action that fired the event that is appears in is undone.

Daniel <gfgtdf>
Project Member
Mon Feb 17 01:51:33 2014, comment #2:

I assumed that redo events actually were the same as regular actions. Apparently we would need a redo event too. (In most cases, it would just fire the original moveto event so that the same actions would occur. The redo event would have to store the unit for that to work.)

I could just disallow undo, but the case I had in mind was a unit ability. Some UMC authors have, in fact, disallowed undo for scenarios or entire campaigns in order to use an ability like that. However, from the player's standpoint, it seems like a frustrating bug. I'm not willing to do that to a user, so I gave up on my idea instead.

Dan Gerhards <beetlenaut>
Project Member
Mon Feb 17 01:11:36 2014, comment #1:

Poking around in the source, it seems there's a couple places you might try to add something like this but also a couple issues.

One place is in src/playcontroller.cpp:


I'm not sure if that's the best idea.

A different place is in the undo-stack code, maybe here:

However it raises some issues. What will you do if the user then "redoes" the action? As I understand this doesn't quite play out the same as performing the action. Do you also want a "redo" event? The comments in the source code in undo.cpp seem to suggest that maybe you should disallow undo in the case you have in mind.

Chris Beck <involution>
Project Member
Tue Nov 19 17:18:44 2013, original submission:

Currently, there is no way to detect that a user has hit undo. That means that no ability or effect that modifies the game state with a moveto event can allow the user to undo the move. On the other hand, if the command could be detected, it would be possible for the author to reset the game state afterward.

I would like an event type named "user undo" or something similar that detects that command. In order to be more useful, it should store the unit that was un-moved and the hex it came from, but that's not entirely necessary.

Dan Gerhards <beetlenaut>
Project Member


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by gfgtdf (Posted a comment)
  • -unavailable- added by involution (Posted a comment)
  • -unavailable- added by beetlenaut (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Mar 23 17:55:20 2017gfgtdfStatusNone=>Fixed
    Tue Nov 19 17:23:09 2013beetlenautSeverity3 - Normal=>1 - Wish
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup