summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-05-22 20:13:25 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-05-22 20:13:25 +0000
commita1e9bc7430ca827808a502f455b20a23ba15e31a (patch)
tree0f5367068425be881657840c08756662510adf39 /src
parent7055882c93022da3a6a1cf74cebf3d17c44ce6c4 (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')
-rwxr-xr-xsrc/Makefile20
-rw-r--r--src/arena.c34
-rw-r--r--src/arenaFile.c81
-rw-r--r--src/dynamicInt.c1
-rw-r--r--src/idManager.c97
-rwxr-xr-xsrc/image.c4
-rw-r--r--src/item.c14
-rwxr-xr-xsrc/layer.c6
-rw-r--r--src/main.c8
-rw-r--r--src/music.c2
-rw-r--r--src/proto.c9
-rw-r--r--src/screen.c2
-rw-r--r--src/screen_world.c18
-rw-r--r--src/shot.c15
-rw-r--r--src/tux.c23
15 files changed, 184 insertions, 150 deletions
diff --git a/src/Makefile b/src/Makefile
index ab243b6..25db7f8 100755
--- a/src/Makefile
+++ b/src/Makefile
@@ -9,9 +9,10 @@ CFLAGS = -g -O0 -std=c99 -I../include -Wall `sdl-config --cflags`
BUILD_DIR = .
LIBS = `sdl-config --libs` -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_net
-FILES = interface.o font.o list.o modules.o image.o layer.o director.o configFile.o tux.o main.o \
- screen.o screen_world.o wall.o shot.o myTimer.o panel.o net_multiplayer.o \
- buffer.o dynamicInt.o arena.o arenaFile.o textFile.o audio.o sound.o music.o gun.o \
+FILES = interface.o idManager.o checkFront.o font.o list.o modules.o image.o layer.o director.o\
+ configFile.o tux.o main.o \
+ screen.o screen_world.o shot.o myTimer.o panel.o net_multiplayer.o \
+ buffer.o arena.o arenaFile.o textFile.o audio.o sound.o music.o gun.o \
item.o widget_label.o screen_mainMenu.o widget_button.o screen_analyze.o widget_textfield.o \
widget_check.o widget_image.o screen_setting.o screen_gameType.o screen_choiceArena.o \
widget_buttonimage.o screen_credits.o homeDirector.o screen_table.o \
@@ -29,6 +30,12 @@ interface.o: interface.c ../include/interface.h
modules.o: modules.c ../include/modules.h
$(CC) $(CFLAGS) -o $(BUILD_DIR)/modules.o -c modules.c
+idManager.o: idManager.c ../include/idManager.h
+ $(CC) $(CFLAGS) -o $(BUILD_DIR)/idManager.o -c idManager.c
+
+checkFront.o: checkFront.c ../include/checkFront.h
+ $(CC) $(CFLAGS) -o $(BUILD_DIR)/checkFront.o -c checkFront.c
+
font.o: font.c ../include/font.h
$(CC) $(CFLAGS) -o $(BUILD_DIR)/font.o -c font.c
@@ -56,8 +63,8 @@ screen.o: screen.c ../include/screen.h
screen_world.o: screen_world.c ../include/screen_world.h
$(CC) $(CFLAGS) -o $(BUILD_DIR)/screen_world.o -c screen_world.c
-wall.o: wall.c ../include/wall.h
- $(CC) $(CFLAGS) -o $(BUILD_DIR)/wall.o -c wall.c
+#wall.o: wall.c ../include/wall.h
+# $(CC) $(CFLAGS) -o $(BUILD_DIR)/wall.o -c wall.c
shot.o: shot.c ../include/shot.h
$(CC) $(CFLAGS) -o $(BUILD_DIR)/shot.o -c shot.c
@@ -95,9 +102,6 @@ network.o: network.c ../include/network.h
net_multiplayer.o: net_multiplayer.c ../include/net_multiplayer.h
$(CC) $(CFLAGS) -o $(BUILD_DIR)/net_multiplayer.o -c net_multiplayer.c
-dynamicInt.o: dynamicInt.c ../include/dynamicInt.h
- $(CC) $(CFLAGS) -o $(BUILD_DIR)/dynamicInt.o -c dynamicInt.c
-
arena.o: arena.c ../include/arena.h
$(CC) $(CFLAGS) -o $(BUILD_DIR)/arena.o -c arena.c
diff --git a/src/arena.c b/src/arena.c
index 05749d6..3e14066 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -44,10 +44,7 @@ arena_t* newArena()
new->listTimer = newList();
new->listTux = newList();
new->listShot = newList();
- new->listWall = newList();
new->listItem = newList();
- new->listTeleport = newList();
- new->listPipe = newTimer();
return new;
}
@@ -59,12 +56,13 @@ int conflictSpace(int x1,int y1,int w1,int h1,int x2,int y2,int w2,int h2)
int isFreeSpace(arena_t *arena, int x, int y, int w, int h)
{
- if ( isConflictWithListTux(arena->listTux, x, y, w, h) )return 0;
- if ( isConflictWithListWall(arena->listWall, x, y, w, h) )return 0;
- if ( isConflictWithListShot(arena->listShot, x, y, w, h) )return 0;
- if ( isConflictWithListItem(arena->listItem, x, y, w, h) )return 0;
- //if ( isConflictWithListTeleport(arena->listTeleport, x, y, w, h) )return 0;
- //if ( isConflictWithListPipe(arena->listPipe, x, y, w, h) )return 0;
+ if( isConflictWithListTux(arena->listTux, x, y, w, h) )return 0;
+ if( isConflictWithListShot(arena->listShot, x, y, w, h) )return 0;
+ if( isConflictWithListItem(arena->listItem, x, y, w, h) )return 0;
+ if( isConflictModule(x, y, w, h) )return 0;
+ //if( isConflictWithListWall(arena->listWall, x, y, w, h) )return 0;
+ //if( isConflictWithListTeleport(arena->listTeleport, x, y, w, h) )return 0;
+ //if( isConflictWithListPipe(arena->listPipe, x, y, w, h) )return 0;
return 1;
}
@@ -95,7 +93,7 @@ void drawArena(arena_t *arena)
addLayer(arena->background, 0, 0, 0, 0, WINDOW_SIZE_X, WINDOW_SIZE_Y, -100);
drawListTux(arena->listTux);
- drawListWall(arena->listWall);
+ //drawListWall(arena->listWall);
//drawListTeleport(arena->listTeleport);
//drawListPipe(arena->listPipe);
drawListShot(arena->listShot);
@@ -127,7 +125,7 @@ void eventArena(arena_t *arena)
for( i = 0 ; i < 4 ; i++)
{
eventMoveListShot(arena->listShot);
- eventConflictShotWithWall(arena->listWall, arena->listShot);
+ //eventConflictShotWithWall(arena->listWall, arena->listShot);
//eventConflictShotWithTeleport(arena->listTeleport, arena->listShot);
//eventConflictShotWithPipe(arena->listPipe, arena->listShot);
eventConflictShotWithItem(arena->listItem, arena->listShot);
@@ -140,25 +138,11 @@ void eventArena(arena_t *arena)
eventTimer(arena->listTimer);
}
-int isConflictWithObjectInArena(arena_t *arena, int x, int y, int w, int h)
-{
- if( isConflictWithListWall(arena->listWall, x, y, w, h) ||
- isConflictModule(x, y, w, h) )
- {
- return 1;
- }
-
- return 0;
-}
-
void destroyArena(arena_t *p)
{
destroyListItem(p->listTux, destroyTux);
destroyListItem(p->listShot, destroyShot);
- destroyListItem(p->listWall, destroyWall);
destroyListItem(p->listItem, destroyItem);
- destroyListItem(p->listTeleport, destroyItem);
- destroyListItem(p->listPipe, destroyItem);
destroyTimer(p->listTimer);
free(p);
}
diff --git a/src/arenaFile.c b/src/arenaFile.c
index 90ae231..dc705fd 100644
--- a/src/arenaFile.c
+++ b/src/arenaFile.c
@@ -91,85 +91,6 @@ static void cmd_playMusic(arena_t *arena, char *line)
#endif
-static void cmd_wall(arena_t *arena, char *line)
-{
- char str_x[STR_NUM_SIZE];
- char str_y[STR_NUM_SIZE];
- char str_img_x[STR_NUM_SIZE];
- char str_img_y[STR_NUM_SIZE];
- char str_w[STR_NUM_SIZE];
- char str_h[STR_NUM_SIZE];
- char str_layer[STR_NUM_SIZE];
- char str_image[STR_SIZE];
- wall_t *new;
-
- if( getValue(line, "x", str_x, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "y", str_y, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "w", str_w, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "h", str_h, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "img_x", str_img_x, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "img_y", str_img_y, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "layer", str_layer, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "image", str_image, STR_SIZE) != 0 )return;
-
-#ifndef PUBLIC_SERVER
- new = newWall(atoi(str_x), atoi(str_y),
- atoi(str_w), atoi(str_h),
- atoi(str_img_x), atoi(str_img_y),
- atoi(str_layer), getImage(IMAGE_GROUP_USER, str_image) );
-#endif
-
-#ifdef PUBLIC_SERVER
- new = newWall(atoi(str_x), atoi(str_y),
- atoi(str_w), atoi(str_h),
- atoi(str_img_x), atoi(str_img_y),
- atoi(str_layer) );
-#endif
-
- addList(arena->listWall, new);
-}
-
-/*
-static void cmd_pipe(arena_t *arena, char *line)
-{
- char str_x[STR_NUM_SIZE];
- char str_y[STR_NUM_SIZE];
- char str_w[STR_NUM_SIZE];
- char str_h[STR_NUM_SIZE];
- char str_id[STR_NUM_SIZE];
- char str_id_out[STR_NUM_SIZE];
- char str_position[STR_NUM_SIZE];
- char str_layer[STR_NUM_SIZE];
- char str_image[STR_SIZE];
- pipe_t *new;
-
- if( getValue(line, "x", str_x, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "y", str_y, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "w", str_w, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "h", str_h, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "id", str_id, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "id_out", str_id_out, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "position", str_position, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "layer", str_layer, STR_NUM_SIZE) != 0 )return;
- if( getValue(line, "image", str_image, STR_SIZE) != 0 )return;
-
-#ifndef PUBLIC_SERVER
- new = newPipe(atoi(str_x), atoi(str_y),
- atoi(str_w), atoi(str_h),
- atoi(str_layer), atoi(str_id), atoi(str_id_out), atoi(str_position),
- getImage(IMAGE_GROUP_USER, str_image) );
-#endif
-
-#ifdef PUBLIC_SERVER
- new = newPipe(atoi(str_x), atoi(str_y),
- atoi(str_w), atoi(str_h),
- atoi(str_layer), atoi(str_id), atoi(str_id_out), atoi(str_position) );
-#endif
-
- addList(arena->listPipe, new);
-}
-*/
-
int getArenaCount()
{
return listArenaFile->count;
@@ -260,7 +181,7 @@ arena_t* getArena(int id)
#endif
if( strncmp(line, "loadModule", 10) == 0 )cmd_loadModule(line);
- if( strncmp(line, "wall", 4) == 0 )cmd_wall(arena, line);
+ //if( strncmp(line, "wall", 4) == 0 )cmd_wall(arena, line);
//if( strncmp(line, "teleport", 8) == 0 )cmd_teleport(arena, line);
//if( strncmp(line, "pipe", 4) == 0 )cmd_pipe(arena, line);
}
diff --git a/src/dynamicInt.c b/src/dynamicInt.c
index 4dd32ce..0b53762 100644
--- a/src/dynamicInt.c
+++ b/src/dynamicInt.c
@@ -3,6 +3,7 @@
#include "main.h"
#include "dynamicInt.h"
+
int* newInt(int x)
{
int *new;
diff --git a/src/idManager.c b/src/idManager.c
new file mode 100644
index 0000000..1da30bc
--- /dev/null
+++ b/src/idManager.c
@@ -0,0 +1,97 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+
+#include "main.h"
+#include "list.h"
+#include "idManager.h"
+
+list_t * newListID()
+{
+ return newList();
+}
+
+int getNewID(list_t *p)
+{
+ int ret;
+ int i;
+
+ assert( p != NULL );
+
+ do{
+ ret = random() % MAX_ID + 1;
+
+ for( i = 0 ; i < p->count ; i++ )
+ {
+ int *z;
+
+ z = (int *) p->list[i];
+
+ if( *z == ret )continue;
+ }
+
+ }while(0);
+
+ addList(p, newInt(ret) );
+
+ //printf("new ID -> %d\n", ret);
+ return ret;
+}
+
+int isRegisterID(list_t *p, int id)
+{
+ int i;
+
+ assert( p != NULL );
+
+ for( i = 0 ; i < p->count ; i++ )
+ {
+ int *z;
+
+ z = (int *) p->list[i];
+
+ if( *z == id )
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+void delID(list_t *p, int id)
+{
+ int index;
+
+ assert( p != NULL );
+
+ index = isRegisterID(p, id);
+
+ if( index == -1 )
+ {
+ assert( ! "takyto ID nebol nikdy registrovany !" );
+ return; // ha ha ha
+ }
+
+ delListItem(p, index, free);
+
+ return;
+}
+
+void replaceID(list_t *p, int old_id, int new_id)
+{
+ delID(p, old_id);
+
+ if( new_id != -1 )
+ {
+ assert( isRegisterID(p, new_id) == -1 );
+ addList(p, newInt(new_id) );
+ }
+}
+
+void destroyListID(list_t *p)
+{
+ assert( p != NULL );
+ destroyListItem(p, free);
+}
diff --git a/src/image.c b/src/image.c
index a7c2261..1462b56 100755
--- a/src/image.c
+++ b/src/image.c
@@ -155,11 +155,11 @@ void delAllImageInGroup(char *group)
for(i = 0 ; i < listImageData->count; i++)
{
this = (image_data_t *) listImageData->list[i];
-
+
if( strcmp(group, this->group) == 0 )
{
delListItem(listImageData, i, destroyImageData);
- break;
+ i--;
}
}
diff --git a/src/item.c b/src/item.c
index 6123c55..2ca4875 100644
--- a/src/item.c
+++ b/src/item.c
@@ -8,6 +8,7 @@
#include "item.h"
#include "shot.h"
#include "proto.h"
+#include "idManager.h"
#include "net_multiplayer.h"
#ifndef PUBLIC_SERVER
@@ -30,6 +31,7 @@ static SDL_Surface *g_item[ITEM_COUNT];
#endif
static bool_t isItemInit = FALSE;
+static list_t *listID;
bool_t isItemInicialized()
{
@@ -57,12 +59,12 @@ void initItem()
g_item[BONUS_4X] = addImageData("item.bonus.4x.png", IMAGE_ALPHA, "item_4x_speed", IMAGE_GROUP_BASE);
g_item[BONUS_HIDDEN] = addImageData("item.bonus.hidden.png", IMAGE_ALPHA, "item_hidden_speed", IMAGE_GROUP_BASE);
#endif
+ listID = newListID();
isItemInit = TRUE;
}
item_t* newItem(int x, int y, int type, int author_id)
{
- static unsigned int last_id = 0;
item_t *new;
new = malloc( sizeof(item_t) );
@@ -70,7 +72,7 @@ item_t* newItem(int x, int y, int type, int author_id)
new->type = type;
- new->id = last_id++;
+ new->id = getNewID(listID);
new->x = x;
new->y = y;
new->frame = 0;
@@ -149,6 +151,12 @@ item_t* getItemID(list_t *listItem, int id)
return NULL;
}
+void replaceItemID(item_t *item, int id)
+{
+ replaceID(listID, item->id, id);
+ item->id = id;
+}
+
void addNewItem(list_t *listItem, int author_id)
{
#ifndef PUBLIC_SERVER
@@ -614,10 +622,12 @@ void eventGiveTuxListItem(tux_t *tux, list_t *listItem)
void destroyItem(item_t *p)
{
assert( p != NULL );
+ delID(listID, p->id);
free(p);
}
void quitItem()
{
+ destroyListID(listID);
isItemInit = FALSE;
}
diff --git a/src/layer.c b/src/layer.c
index 05dc62a..d8740dc 100755
--- a/src/layer.c
+++ b/src/layer.c
@@ -129,6 +129,12 @@ void drawLayerCenter(int x, int y)
listLayer = newList();
}
+void flushLayer()
+{
+ destroyListItem(listLayer, free);
+ listLayer = newList();
+}
+
/*
* Odstrani zoznam vrtsiev z pamete.
*/
diff --git a/src/main.c b/src/main.c
index 4b14c63..193148a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -81,6 +81,14 @@ char *getString(int n)
return strdup(str);
}
+int* newInt(int x)
+{
+ int *new;
+ new = malloc( sizeof(int) );
+ *new = x;
+ return new;
+}
+
void accessExistFile(const char *s)
{
if( access(s, F_OK) != 0 )
diff --git a/src/music.c b/src/music.c
index 5ef4ae6..2fd8e31 100644
--- a/src/music.c
+++ b/src/music.c
@@ -211,7 +211,7 @@ void delAllMusicInGroup(int group)
if( this->group == group )
{
delListItem(listMusic, i, destroyMusic);
- break;
+ i--;
}
}
}
diff --git a/src/proto.c b/src/proto.c
index 0441371..45abf8c 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -190,7 +190,7 @@ void proto_recv_init_client(char *msg)
setMaxCountRound(n);
tux = newTux();
- tux->id = id;
+ replaceTuxID(tux, id);
tux->x = x;
tux->y = y;
tux->control = TUX_CONTROL_KEYBOARD_RIGHT;
@@ -329,8 +329,7 @@ void proto_recv_newtux_client(char *msg)
addList(getCurrentArena()->listTux, tux);
}
- tux->id = id;
-
+ replaceTuxID(tux, id);
tux->x = x;
tux->y = y;
tux->status = status;
@@ -508,7 +507,7 @@ void proto_recv_additem_client(char *msg)
return;
}
*/
- item->id = id;
+ replaceItemID(item, id);
item->count = count;
item->frame = frame;
item->lastSync = getMyTime();
@@ -606,7 +605,7 @@ void proto_recv_shot_client(char *msg)
*/
shot = newShot(x, y, px, py, gun, author_id);
- shot->id = shot_id;
+ replaceShotID(shot, shot_id);
shot->isCanKillAuthor = isCanKillAuthor;
shot->position = position;
diff --git a/src/screen.c b/src/screen.c
index dba91bc..0fc0d69 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -84,6 +84,8 @@ void setScreen(char *name)
if( strcmp(name, this->name) == 0 )
{
+ flushLayer();
+
if( currentScreen != NULL )
{
printf("stop screen %s..\n", currentScreen->name);
diff --git a/src/screen_world.c b/src/screen_world.c
index 671a858..fde1d4a 100644
--- a/src/screen_world.c
+++ b/src/screen_world.c
@@ -214,27 +214,9 @@ static void netAction(tux_t *tux, int action)
static void control_keyboard_right(tux_t *tux)
{
-/*
- static my_time_t lastTime = 0;
- my_time_t currentTime;
-*/
Uint8 *mapa;
mapa = SDL_GetKeyState(NULL);
-/*
- if( lastTime == 0 )
- {
- lastTime = getMyTime();
- }
-
- currentTime = getMyTime();
- if( currentTime - lastTime < 45 )
- {
- return;
- }
-
- lastTime = getMyTime();
-*/
assert( tux != NULL );
assert( mapa != NULL );
diff --git a/src/shot.c b/src/shot.c
index 7a7d55a..f5da8a9 100644
--- a/src/shot.c
+++ b/src/shot.c
@@ -10,6 +10,7 @@
#include "pipe.h"
#include "net_multiplayer.h"
#include "proto.h"
+#include "idManager.h"
#ifndef PUBLIC_SERVER
#include "image.h"
@@ -31,6 +32,7 @@ static SDL_Surface *g_shot_bombball;
#endif
static bool_t isShotInit = FALSE;
+static list_t *listID;
bool_t isShotInicialized()
{
@@ -52,6 +54,8 @@ void initShot()
#endif
+ listID = newListID();
+
isShotInit = TRUE;
}
@@ -59,12 +63,11 @@ shot_t* newShot(int x,int y, int px, int py, int gun, int author_id)
{
shot_t *new;
tux_t *author;
- static int last_id = 0;
new = malloc( sizeof(shot_t) );
memset(new, 0, sizeof(shot_t) );
- new->id = ++last_id;
+ new->id = getNewID(listID);
new->x = x;
new->y = y;
new->px = px;
@@ -153,6 +156,12 @@ shot_t* getShotID(list_t *listShot, int id)
return NULL;
}
+void replaceShotID(shot_t *shot, int id)
+{
+ replaceID(listID, shot->id, id);
+ shot->id = id;
+}
+
#ifndef PUBLIC_SERVER
@@ -404,11 +413,13 @@ void moveShot(shot_t *shot, int position, int src_x, int src_y,
void destroyShot(shot_t *p)
{
assert( p != NULL );
+ delID(listID, p->id);
free(p);
}
void quitShot()
{
+ destroyListID(listID);
isShotInit = FALSE;
}
diff --git a/src/tux.c b/src/tux.c
index c0b6f22..ce9a249 100644
--- a/src/tux.c
+++ b/src/tux.c
@@ -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;
}
-