summaryrefslogtreecommitdiff
path: root/src/base/tux.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-16 19:51:46 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-16 19:51:46 +0000
commitd5ae032d2b251a1604042f68a9cd3215c233792e (patch)
tree65ede336c208aa594f5afa38f22b5f108886e56d /src/base/tux.c
parent6b22698fec26e427d0edaf9e4e55a35b28f9ab93 (diff)
nove funkcie :
extern void actionSpace(space_t *space, void *f, void *p); extern void actionSpaceFromLocation(space_t *space, void *f, void *p, int x, int y, int w, int h); casti kodu ktore tieto funkcie potrebovali boli prepisane tak aby ich pouzivali. ( moduly tak prepisem zajtra ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@150 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/base/tux.c')
-rw-r--r--src/base/tux.c85
1 files changed, 38 insertions, 47 deletions
diff --git a/src/base/tux.c b/src/base/tux.c
index 21fa7e6..94a7666 100644
--- a/src/base/tux.c
+++ b/src/base/tux.c
@@ -406,62 +406,53 @@ static void bombBallExplosion(shot_t *shot)
delObjectFromSpaceWithObject(getCurrentArena()->spaceShot, shot, destroyShot);
}
-void eventConflictTuxWithShot(arena_t *arena)
+static void action_tux(space_t *space, tux_t *tux, shot_t *shot)
{
- shot_t *thisShot;
- tux_t *thisTux;
- int i, j;
-
- for( i = 0 ; i < arena->spaceShot->list->count ; i++ )
- {
- thisShot = (shot_t *)arena->spaceShot->list->list[i];
- assert( thisShot != NULL );
+ arena_t *arena;
- listDoEmpty(listHelp);
- getObjectFromSpace(arena->spaceTux, thisShot->x, thisShot->y,
- thisShot->w, thisShot->h, listHelp);
+ arena = getCurrentArena();
- for( j = 0 ; j < listHelp->count ; j++ )
+ if( tux->status == TUX_STATUS_ALIVE )
+ {
+ if( shot->author_id == tux->id &&
+ shot->isCanKillAuthor == FALSE )
{
- thisTux = listHelp->list[j];
+ return;
+ }
- if( thisTux->status == TUX_STATUS_ALIVE )
+ if( tux->bonus == BONUS_TELEPORT )
+ {
+ tuxTeleport(tux);
+ return;
+ }
+
+ if( shot->gun == GUN_BOMBBALL )
+ {
+ if( getNetTypeGame() != NET_GAME_TYPE_CLIENT )
{
- if( thisShot->author_id == thisTux->id &&
- thisShot->isCanKillAuthor == FALSE )
- {
- continue;
- }
-
- if( thisTux->bonus == BONUS_TELEPORT )
- {
- tuxTeleport(thisTux);
- continue;
- }
-
- if( thisShot->gun == GUN_BOMBBALL )
- {
- if( getNetTypeGame() != NET_GAME_TYPE_CLIENT )
- {
- bombBallExplosion(thisShot);
- i--;
- }
-
- continue;
- }
-
- if( getNetTypeGame() != NET_GAME_TYPE_CLIENT )
- {
- eventTuxIsDeadWIthShot(thisTux, thisShot);
- }
+ bombBallExplosion(shot);
}
-
- delObjectFromSpaceWithObject(arena->spaceShot, thisShot, destroyShot);
- i--;
-
- continue;
+
+ return;
+ }
+
+ if( getNetTypeGame() != NET_GAME_TYPE_CLIENT )
+ {
+ eventTuxIsDeadWIthShot(tux, shot);
}
}
+
+ delObjectFromSpaceWithObject(arena->spaceShot, shot, destroyShot);
+}
+
+static void action_shot(space_t *space, shot_t *shot, space_t *spaceTux)
+{
+ actionSpaceFromLocation(spaceTux, action_tux, shot, shot->x, shot->y, shot->w, shot->h);
+}
+
+void eventConflictTuxWithShot(arena_t *arena)
+{
+ actionSpace(arena->spaceShot, action_shot, arena->spaceTux);
}
void moveTux(tux_t *tux, int n)