diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-06-12 19:27:11 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-06-12 19:27:11 +0000 |
| commit | 652ce49bba44c885da4891bcae5fb650ef132a73 (patch) | |
| tree | 227a6f37a77f4b907e457b9163a0e36a0d9af1ed /modules/modWall.c | |
| parent | 9751218f594526982877332d6ca0fa90b67bbb7b (diff) | |
- moduly pouzivaju space_t
- drobne upravy
git-svn-id: http://opensvn.csie.org/tuxanci_ng@64 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'modules/modWall.c')
| -rwxr-xr-x | modules/modWall.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/modules/modWall.c b/modules/modWall.c index bd1f8b6..49140b4 100755 --- a/modules/modWall.c +++ b/modules/modWall.c @@ -42,7 +42,11 @@ typedef struct wall_struct static export_fce_t *export_fce; static space_t *spaceWall; + +#ifndef PUBLIC_SERVER static space_t *spaceImgWall; +#endif + static list_t *listWall; #ifndef PUBLIC_SERVER @@ -103,28 +107,6 @@ void drawListWall(list_t *list) #endif -wall_t* isConflictWithListWall(list_t *list, int x, int y, int w, int h) -{ - wall_t *thisWall; - int i; - - assert( list != NULL ); - - for( i = 0 ; i < list->count ; i++ ) - { - thisWall = (wall_t *)list->list[i]; - assert( thisWall != NULL ); - - if( export_fce->fce_conflictSpace(x, y, w, h, - thisWall->x, thisWall->y, thisWall->w, thisWall->h) ) - { - return thisWall; - } - } - - return NULL; -} - void eventConflictShotWithWall(list_t *listShot) { shot_t *thisShot; @@ -191,6 +173,8 @@ static void setStatusWall(void *p, int x, int y, int w, int h) wall->h = h; } +#ifndef PUBLIC_SERVER + static void getStatusImgWall(void *p, int *id, int *x, int *y, int *w, int *h) { wall_t *wall; @@ -208,6 +192,8 @@ static void setStatusImgWall(void *p, int x, int y, int w, int h) { } +#endif + static void cmd_wall(char *line) { char str_x[STR_NUM_SIZE]; @@ -248,12 +234,17 @@ static void cmd_wall(char *line) spaceWall = newSpace(export_fce->fce_getCurrentArena()->w, export_fce->fce_getCurrentArena()->h, 320, 240, getStatusWall, setStatusWall); +#ifndef PUBLIC_SERVER spaceImgWall = newSpace(export_fce->fce_getCurrentArena()->w, export_fce->fce_getCurrentArena()->h, 320, 240, getStatusImgWall, setStatusImgWall); +#endif } addObjectToSpace(spaceWall, new); + +#ifndef PUBLIC_SERVER addObjectToSpace(spaceImgWall, new); +#endif } int init(export_fce_t *p) @@ -271,7 +262,10 @@ int draw(int x, int y, int w, int h) wall_t *thisWall; int i; - assert( spaceWall != NULL ); + if( spaceWall == NULL ) + { + return 0; + } listDoEmpty(listWall); getObjectFromSpace(spaceImgWall, x, y, w, h, listWall); @@ -292,12 +286,22 @@ int draw(int x, int y, int w, int h) int event() { + if( spaceWall == NULL ) + { + return 0; + } + eventConflictShotWithWall(export_fce->fce_getCurrentArena()->listShot); return 0; } int isConflict(int x, int y, int w, int h) { + if( spaceWall == NULL ) + { + return 0; + } + return isConflictWithObjectFromSpace(spaceWall, x, y, w, h); } @@ -308,6 +312,7 @@ void cmd(char *line) int destroy() { + destroySpace(spaceWall, destroyWall); destroyList(listWall); return 0; |