summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorsavask <savask@yandex.ru>2012-02-28 12:31:07 (GMT)
committer savask <savask@yandex.ru>2012-02-28 12:35:59 (GMT)
commit2b4d0442b5a81faa9cd1f0fb31fe07544989716b (patch)
treee59b4c26f0dfa4f4fc7a86bf103e94e5e2263ab3 /src/elements
parentfe8268525776b8867e950d627bbc8d1df0234595 (diff)
downloadpowder-2b4d0442b5a81faa9cd1f0fb31fe07544989716b.zip
powder-2b4d0442b5a81faa9cd1f0fb31fe07544989716b.tar.gz
Fixed the bug with fighters running away from stick mans, but now
boundary check is worser so fighters won't usually notice holes on their way.
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/figh.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/elements/figh.c b/src/elements/figh.c
index 284a56c..928923f 100644
--- a/src/elements/figh.c
+++ b/src/elements/figh.c
@@ -4,41 +4,41 @@ int update_FIGH(UPDATE_FUNC_ARGS)
{
playerst* figh = &fighters[(unsigned char)parts[i].tmp];
- float tarx, tary;
+ unsigned int tarx, tary;
parts[i].tmp2 = 0; //0 - stay in place, 1 - seek a stick man
//Set target cords
- if (player.spwn)
+ if (player.spwn && player2.spwn)
{
- if (player2.spwn)
if ((pow(player.legs[2]-x, 2) + pow(player.legs[3]-y, 2))<=
(pow(player2.legs[2]-x, 2) + pow(player2.legs[3]-y, 2)))
{
- tarx = player.legs[2];
- tary = player.legs[3];
+ tarx = (unsigned int)player.legs[2];
+ tary = (unsigned int)player.legs[3];
}
else
{
- tarx = player2.legs[2];
- tary = player2.legs[3];
+ tarx = (unsigned int)player2.legs[2];
+ tary = (unsigned int)player2.legs[3];
}
- else
- {
- tarx = player.legs[2];
- tary = player.legs[3];
- }
-
- parts[i].tmp2 = 1;
+ parts[i].tmp2 = 1;
}
else
+ {
+ if (player.spwn)
+ {
+ tarx = (unsigned int)player.legs[2];
+ tary = (unsigned int)player.legs[3];
+ parts[i].tmp2 = 1;
+ }
if (player2.spwn)
{
- tarx = player2.legs[2];
- tary = player2.legs[3];
-
+ tarx = (unsigned int)player2.legs[2];
+ tary = (unsigned int)player2.legs[3];
parts[i].tmp2 = 1;
}
+ }
switch (parts[i].tmp2)
{
@@ -51,9 +51,10 @@ int update_FIGH(UPDATE_FUNC_ARGS)
figh->comm = (int)figh->comm | 0x08;
}
else
- if (tarx<x )
+ if (tarx<x)
{
- if(!eval_move(PT_DUST, figh->legs[4]-10, figh->legs[5]+6, NULL))
+ if(!(eval_move(PT_DUST, figh->legs[4]-10, figh->legs[5]+6, NULL)
+ && eval_move(PT_DUST, figh->legs[4]-10, figh->legs[5]+3, NULL)))
figh->comm = 0x01;
else
figh->comm = 0x02;
@@ -65,7 +66,8 @@ int update_FIGH(UPDATE_FUNC_ARGS)
}
else
{
- if (!eval_move(PT_DUST, figh->legs[12]+10, figh->legs[13]+6, NULL))
+ if (!(eval_move(PT_DUST, figh->legs[12]+10, figh->legs[13]+6, NULL)
+ && eval_move(PT_DUST, figh->legs[12]+10, figh->legs[13]+3, NULL)))
figh->comm = 0x02;
else
figh->comm = 0x01;