summaryrefslogtreecommitdiff
path: root/src/modules/modTeleport.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-18 19:19:10 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-18 19:19:10 +0000
commit8b93dd8dac51e28bb25ad341f594d21a955c3adb (patch)
treee04e9ea1d2d9b57c77617614283fc8756c96d53c /src/modules/modTeleport.c
parenta5a03e684b5ed3e8781ce30e5ffd4f73b59c3e97 (diff)
- bezpecnejsie prepiannie screenov ( uz sa to nedeje v event() daneho screenu aj ked to on vyvolal )
- do laveho horneho rohu s nevypisuju blbiny - moduly pouzivaju funkcie actionSpace a actionSpaceFromLocation - dane funkcie sa pouzivaju aj pri vykreslovani objektov - btw. je jedno kolko zeru tuxanci top, na kerneli-2.6.25.* to zralo X a na kerneli 2.6.26 to zere 2*X git-svn-id: http://opensvn.csie.org/tuxanci_ng@159 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/modules/modTeleport.c')
-rwxr-xr-xsrc/modules/modTeleport.c106
1 files changed, 44 insertions, 62 deletions
diff --git a/src/modules/modTeleport.c b/src/modules/modTeleport.c
index 1411b88..28ebeb6 100755
--- a/src/modules/modTeleport.c
+++ b/src/modules/modTeleport.c
@@ -380,96 +380,78 @@ int init(export_fce_t *p)
}
#ifndef PUBLIC_SERVER
-int draw(int x, int y, int w, int h)
+
+static void action_drawteleport(space_t *space, teleport_t *teleport, void *p)
{
- teleport_t *thisTeleport;
- int i;
+ drawTeleport(teleport);
+}
+int draw(int x, int y, int w, int h)
+{
if( spaceTeleport == NULL )
{
return 0;
}
- listDoEmpty(listTeleport);
- getObjectFromSpace(spaceTeleport, x, y, w, h, listTeleport);
-
- for( i = 0 ; i < listTeleport->count ; i++ )
- {
- thisTeleport = (teleport_t *)listTeleport->list[i];
- assert( thisTeleport != NULL );
- drawTeleport(thisTeleport);
- }
+ actionSpaceFromLocation(spaceTeleport, action_drawteleport, NULL, x, y, w, h);
return 0;
}
#endif
-int event()
+static void action_eventteleportshot(space_t *space, teleport_t *teleport, shot_t *shot)
{
- teleport_t *thisTeleport;
arena_t *arena;
- int i;
-
- if( spaceTeleport == NULL )
- {
- return 0;
- }
-
- if( export_fce->fce_getNetTypeGame() == NET_GAME_TYPE_CLIENT )
- {
- return 0;
- }
+ tux_t *author;
arena = export_fce->fce_getCurrentArena();
- for( i = 0 ; i < arena->spaceTux->list->count ; i++ )
+ author = getObjectFromSpaceWithID(arena->spaceTux, shot->author_id);
+
+ if( author != NULL &&
+ author->bonus == BONUS_GHOST &&
+ author->bonus_time > 0 )
{
- tux_t *thisTux;
- int x, y, w, h;
- int j;
+ return;
+ }
- thisTux = (tux_t *)arena->spaceTux->list->list[i];
- export_fce->fce_getTuxProportion(thisTux, &x, &y, &w, &h);
+ moveShotFromTeleport(shot, teleport, spaceTeleport->list);
+}
- listDoEmpty(listTeleport);
- getObjectFromSpace(spaceTeleport, x, y, w, h, listTeleport);
+static void action_eventshot(space_t *space, shot_t *shot, space_t *spaceTeleport)
+{
+ actionSpaceFromLocation(spaceTeleport, action_eventteleportshot, shot, shot->x, shot->y, shot->w, shot->h);
+}
- for( j = 0 ; j < listTeleport->count ; j++ )
- {
- thisTeleport = (teleport_t *)listTeleport->list[j];
- teleportTux(thisTux, thisTeleport);
- }
- }
-
- for( i = 0 ; i < arena->spaceShot->list->count ; i++ )
- {
- shot_t *thisShot;
- int j;
+static void action_eventteleporttux(space_t *space, teleport_t *teleport, tux_t *tux)
+{
+ teleportTux(tux, teleport);
+}
- thisShot = (shot_t *)arena->spaceShot->list->list[i];
- assert( thisShot != NULL );
+static void action_eventtux(space_t *space, tux_t *tux, space_t *spaceTeleport)
+{
+ int x, y, w, h;
- listDoEmpty(listTeleport);
- getObjectFromSpace(spaceTeleport, thisShot->x, thisShot->y, thisShot->w, thisShot->h, listTeleport);
+ export_fce->fce_getTuxProportion(tux, &x, &y, &w, &h);
- for( j = 0 ; j < listTeleport->count ; j++ )
- {
- tux_t *author;
+ actionSpaceFromLocation(spaceTeleport, action_eventteleporttux, tux, x, y, w, h);
+}
- thisTeleport = (teleport_t *)listTeleport->list[j];
- author = getObjectFromSpaceWithID(arena->spaceTux, thisShot->author_id);
-
- if( author != NULL &&
- author->bonus == BONUS_GHOST &&
- author->bonus_time > 0 )
- {
- continue;
- }
+int event()
+{
+ if( spaceTeleport == NULL )
+ {
+ return 0;
+ }
- moveShotFromTeleport(thisShot, thisTeleport, spaceTeleport->list);
- }
+ if( export_fce->fce_getNetTypeGame() == NET_GAME_TYPE_CLIENT )
+ {
+ return 0;
}
+ actionSpace(export_fce->fce_getCurrentArena()->spaceShot, action_eventshot, spaceTeleport);
+ actionSpace(export_fce->fce_getCurrentArena()->spaceTux, action_eventtux, spaceTeleport);
+
return 0;
}