diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-05-22 20:13:25 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-05-22 20:13:25 +0000 |
| commit | a1e9bc7430ca827808a502f455b20a23ba15e31a (patch) | |
| tree | 0f5367068425be881657840c08756662510adf39 /src/tux.c | |
| parent | 7055882c93022da3a6a1cf74cebf3d17c44ce6c4 (diff) | |
- dopisany skutocny ID manager
- objekt wall je ako modul
- oprava chyby, pri prepinani screenov sa nevyprazdnoval layer
- oprava chyby, pri odstraneni vsetkych obrazkov zo skupiny sa odstrani iba prvy obrazok
- oprava chyby, pri odstraneni vsetkej hudby zo skupiny sa odstrani iba prva hudba
PS: (asi) zajtra ten kod trochu esteticky upravim
git-svn-id: http://opensvn.csie.org/tuxanci_ng@53 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/tux.c')
| -rw-r--r-- | src/tux.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -19,6 +19,7 @@ #include "dynamicInt.h" #include "proto.h" #include "modules.h" +#include "idManager.h" #ifndef PUBLIC_SERVER #include "image.h" @@ -43,6 +44,8 @@ static SDL_Surface *g_cross; #endif +static list_t *listID; + static bool_t isTuxInit = FALSE; bool_t isTuxInicialized() @@ -64,12 +67,13 @@ void initTux() g_cross = addImageData("cross.png", IMAGE_ALPHA, "cross", IMAGE_GROUP_BASE); #endif + listID = newListID(); + isTuxInit = TRUE; } tux_t* newTux() { - static int last_id = 0; int x, y; tux_t *new; @@ -78,7 +82,7 @@ tux_t* newTux() memset(new, 0, sizeof(tux_t) ); - new->id = last_id++; + new->id = getNewID(listID); new->status = TUX_STATUS_ALIVE; new->control = TUX_CONTROL_NONE; @@ -246,6 +250,12 @@ tux_t* getTuxID(list_t *listTux, int id) return NULL; } +void replaceTuxID(tux_t *tux, int id) +{ + replaceID(listID, tux->id, id); + tux->id = id; +} + tux_t* isConflictWithListTux(list_t *listTux, int x, int y, int w, int h) { tux_t *thisTux; @@ -626,7 +636,6 @@ void moveTux(tux_t *tux, int n) if( tux->bonus != BONUS_GHOST && ( isConflictTuxWithListTux(tux, arena->listTux) || - isConflictWithListWall(arena->listWall, x, y, w, h) || isConflictModule(x, y, w, h) ) ) { tux->x = zal_x; @@ -797,9 +806,8 @@ static void eventBonus(tux_t *tux) tux->bonus = BONUS_NONE; - if ( isConflictWithListWall(getCurrentArena()->listWall, x, y, w, h) || - isConflictModule(x, y, w, h) || - isConflictTuxWithListTux(tux, getCurrentArena()->listTux) ) + if( isConflictTuxWithListTux(tux, getCurrentArena()->listTux) || + isConflictModule(x, y, w, h) ) { tux->bonus = BONUS_GHOST; return; @@ -865,11 +873,12 @@ void setTuxProportion(tux_t *tux, int x, int y) void destroyTux(tux_t *tux) { assert( tux != NULL ); + delID(listID, tux->id); free(tux); } void quitTux() { + destroyListID(listID); isTuxInit = FALSE; } - |