projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b5d5834
)
rnd-19981214-4
author
Holger Schemel
<info@artsoft.org>
Mon, 14 Dec 1998 22:24:14 +0000
(23:24 +0100)
committer
Holger Schemel
<info@artsoft.org>
Sat, 30 Aug 2014 08:32:22 +0000
(10:32 +0200)
src/editor.c
patch
|
blob
|
history
diff --git
a/src/editor.c
b/src/editor.c
index bcecaa8848529d57450a55acb412473da730a1b5..4b52fdb5d0f5d40be88edb9a59402e9b9eb4645c 100644
(file)
--- a/
src/editor.c
+++ b/
src/editor.c
@@
-39,7
+39,7
@@
#define CHOICE_DELAY_VALUE 100
/* how many steps can be cancelled */
#define CHOICE_DELAY_VALUE 100
/* how many steps can be cancelled */
-#define NUM_UNDO_STEPS
10
+#define NUM_UNDO_STEPS
(10 + 1)
/* values for the control window */
#define ED_CTRL_BUTTONS_GFX_YPOS 236
/* values for the control window */
#define ED_CTRL_BUTTONS_GFX_YPOS 236
@@
-553,6
+553,23
@@
void HandleLevelEditorControlButtons(struct GadgetInfo *gi)
drawing_function = id;
break;
drawing_function = id;
break;
+ case ED_CTRL_ID_UNDO:
+ if (undo_buffer_steps == 0)
+ {
+ Request("Undo buffer empty !", REQ_CONFIRM);
+ break;
+ }
+
+ undo_buffer_position =
+ (undo_buffer_position - 1 + NUM_UNDO_STEPS) % NUM_UNDO_STEPS;
+ undo_buffer_steps--;
+
+ for(x=0; x<lev_fieldx; x++)
+ for(y=0; y<lev_fieldy; y++)
+ Feld[x][y] = UndoBuffer[undo_buffer_position][x][y];
+ DrawMiniLevel(level_xpos,level_ypos);
+ break;
+
case ED_CTRL_ID_CLEAR:
if (Request("Are you sure to clear this level ?", REQ_ASK))
{
case ED_CTRL_ID_CLEAR:
if (Request("Are you sure to clear this level ?", REQ_ASK))
{
@@
-1982,7
+1999,7
@@
void HandleDrawingFunction(int mx, int my, int button)
{
undo_buffer_position = (undo_buffer_position + 1) % NUM_UNDO_STEPS;
{
undo_buffer_position = (undo_buffer_position + 1) % NUM_UNDO_STEPS;
- if (undo_buffer_steps < NUM_UNDO_STEPS)
+ if (undo_buffer_steps < NUM_UNDO_STEPS
- 1
)
undo_buffer_steps++;
for(x=0; x<lev_fieldx; x++)
undo_buffer_steps++;
for(x=0; x<lev_fieldx; x++)
@@
-1991,6
+2008,10
@@
void HandleDrawingFunction(int mx, int my, int button)
copy_to_undo_buffer = FALSE;
copy_to_undo_buffer = FALSE;
+
+
+ /*
printf("state saved to undo buffer %d\n", undo_buffer_position);
printf("state saved to undo buffer %d\n", undo_buffer_position);
+ */
}
}
}
}