aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-09-09 16:01:45 +0000
committerrodri <rgl@antares-labs.eu>2023-09-09 16:01:45 +0000
commit230cd15dfa5fc602639f0d55080ae2ff8794c5ba (patch)
treead539c09eae07c7ced966ca0cd4c50c62da6fbef
parent2d2fabb2bb4472d840f896d086e1c1233e1302e1 (diff)
downloadbattleship-230cd15dfa5fc602639f0d55080ae2ff8794c5ba.tar.gz
battleship-230cd15dfa5fc602639f0d55080ae2ff8794c5ba.tar.bz2
battleship-230cd15dfa5fc602639f0d55080ae2ff8794c5ba.zip
don't rotate the ship when moving the mouse while pressing mmb.
-rw-r--r--bts.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bts.c b/bts.c
index f272239..15b1a94 100644
--- a/bts.c
+++ b/bts.c
@@ -553,7 +553,7 @@ rmb(Mousectl *mc)
nil
};
static Menu menu = { .item = items };
- char buf[5*(1+3+1)+1];
+ char buf[NSHIPS*(1+3+1)+1];
int i, n;
if(game.state != Outlaying)
@@ -591,6 +591,7 @@ void
mouse(Mousectl *mc)
{
Rectangle newbbox;
+ static Mouse oldm;
mc->xy = subpt(mc->xy, screen->r.min);
@@ -620,12 +621,15 @@ mouse(Mousectl *mc)
lmb(mc);
break;
case 2:
- mmb(mc);
+ if(oldm.buttons != 2)
+ mmb(mc);
break;
case 4:
rmb(mc);
break;
}
+
+ oldm = mc->Mouse;
}
void