Fix undo in two-players mode.

https://bugzilla.gnome.org/show_bug.cgi?id=734866
Based on code by Michael Catanzaro.