Skip to content
Browse files

Pressing remove in the editor now selects the brick that was removed …

…(for use as a pick-tool since default behaviour is to override an existing brick this makes sense as one no longer removed a brick simply to place another brick).
  • Loading branch information...
1 parent f2b2675 commit c45835e89967d83ab82c534711d4f4cb18db6d92 @DusteDdk committed Jun 8, 2012
Showing with 23 additions and 2 deletions.
  1. +23 −2 leveleditor.c
View
25 leveleditor.c
@@ -99,6 +99,14 @@ void editorFileName(const char* fn)
strcpy(fileName,fn);
}
+void editorPickBrickUnderCursor()
+{
+ if(pf.board[cur.x][cur.y])
+ {
+ selBrick=pf.board[cur.x][cur.y]->type;
+ }
+}
+
void editorRemoveBrickUnderCursor()
{
if(pf.board[cur.x][cur.y])
@@ -224,13 +232,26 @@ int runEditor(SDL_Surface* screen)
changed=1;
}
- if( getButton(C_BTNY) || ( isPointerClicked() && selBrick == RESERVED) )
+ if( getButton(C_BTNY) )
{
resetBtn(C_BTNY);
- resetMouseBtn();
+
+ if(selBrick!=RESERVED)
+ {
+ editorPickBrickUnderCursor();
+ }
editorRemoveBrickUnderCursor();
}
+ if( isPointerClicked() )
+ {
+ resetMouseBtn();
+ if(selBrick==RESERVED)
+ {
+ editorRemoveBrickUnderCursor();
+ }
+ }
+
if(getButton(C_BTNSELECT))
{
resetBtn(C_BTNSELECT);

0 comments on commit c45835e

Please sign in to comment.
Something went wrong with that request. Please try again.