summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-06 20:38:19 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-06 20:38:19 +0300
commitafc6bb37100fd110512cd1119920719376e87ecf (patch)
treede341d04ec8cefc1d493f393350104976a50d891 /src
parent960401cc2b219dbaf0a07cbc1077dd3e26718762 (diff)
downloadplus-afc6bb37100fd110512cd1119920719376e87ecf.tar.gz
plus-afc6bb37100fd110512cd1119920719376e87ecf.tar.bz2
plus-afc6bb37100fd110512cd1119920719376e87ecf.tar.xz
plus-afc6bb37100fd110512cd1119920719376e87ecf.zip
Add diagonal direction for crazy move a.
New directions: D, R, L, U
Diffstat (limited to 'src')
-rw-r--r--src/being/localplayer.cpp48
1 files changed, 30 insertions, 18 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 8a2f86421..a8caa73fa 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -2796,9 +2796,9 @@ void LocalPlayer::crazyMoveA()
signed char param = mMoveProgram[mCrazyMoveState++];
if (param == '?')
{
- const char cmd[] = {'l', 'r', 'u', 'd'};
+ const char cmd[] = {'l', 'r', 'u', 'd', 'L', 'R', 'U', 'D'};
srand(tick_time);
- param = cmd[rand() % 4];
+ param = cmd[rand() % 8];
}
switch (param)
{
@@ -2814,26 +2814,38 @@ void LocalPlayer::crazyMoveA()
case 'r':
move(1, 0);
break;
+ case 'D':
+ move(1, 1);
+ break;
+ case 'U':
+ move (-1, -1);
+ break;
+ case 'L':
+ move(-1, 1);
+ break;
+ case 'R':
+ move(1, -1);
+ break;
case 'f':
- switch (mDirection)
- {
- case UP : dy = -1; break;
- case DOWN : dy = 1; break;
- case LEFT : dx = -1; break;
- case RIGHT: dx = 1; break;
- default: break;
- }
+ if (mDirection | UP)
+ dy = -1;
+ else if (mDirection | DOWN)
+ dy = 1;
+ if (mDirection | LEFT)
+ dx = -1;
+ else if (mDirection | RIGHT)
+ dx = 1;
move(dx, dy);
break;
case 'b':
- switch (mDirection)
- {
- case UP : dy = 1; break;
- case DOWN : dy = -1; break;
- case LEFT : dx = 1; break;
- case RIGHT: dx = -1; break;
- default: break;
- }
+ if (mDirection | UP)
+ dy = 1;
+ else if (mDirection | DOWN)
+ dy = -1;
+ if (mDirection | LEFT)
+ dx = 1;
+ else if (mDirection | RIGHT)
+ dx = -1;
move(dx, dy);
break;
default: