[Xbubble-commits] xbubble/src board.c,1.1,1.2

Martin Quinson xbubble-devel@lists.alioth.debian.org
Wed, 27 Apr 2005 14:26:23 +0000


Update of /cvsroot/xbubble/xbubble/src
In directory haydn:/tmp/cvs-serv26023

Modified Files:
	board.c 
Log Message:
Declare static all functions which should; stop correctly the canon on fire; piky cleanup

Index: board.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble/src/board.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- board.c	5 Dec 2004 20:40:59 -0000	1.1
+++ board.c	27 Apr 2005 14:26:20 -0000	1.2
@@ -93,7 +93,7 @@
 };
 
 
-void stick_bubble( Board board, Bubble bubble, int target_cell);
+void stick_bubble( Board board, Bubble bubble, int target);
 void drop_bubbles(Board board);
 void place_received_bubbles( Board board );
 
@@ -344,13 +344,13 @@
   board->state = WON;
 }
 
-void stick_bubble( Board board, Bubble bubble, int target_cell) {
+void stick_bubble( Board board, Bubble bubble, int target) {
   double x, y;
-  cell_center( board->array, target_cell, &x, &y );
+  cell_center( board->array, target, &x, &y );
   set_bubble_state( bubble, STUCK, BOTTOM_LAYER, 0);
   set_bubble_position( bubble, x, y);
-  bubble->cell = target_cell;
-  board->array->cell[target_cell] = bubble;
+  bubble->cell = target;
+  board->array->cell[target] = bubble;
 }
 
 static void kill_bubble( Board board, Bubble bubble ) {
@@ -358,7 +358,7 @@
   remove_sprite_from_pool( board->sprite_pool, bubble->sprite );
 }
 
-int animate_bubbles( Board board, int dt ) {
+static int animate_bubbles( Board board, int dt ) {
   int i;
   Bubble tmp;
   Bubble bubble;
@@ -428,8 +428,9 @@
 	bubble->vx = board->vx[ board->canon_angle + CANON_ANGLE_MAX ];
 	bubble->vy = board->vy[ board->canon_angle + CANON_ANGLE_MAX ];
 	/* store target cell */
-	bubble->cell = target_cell( board->array, board->canon_angle+CANON_ANGLE_MAX, 
-				    &bubble->target_y,NULL );
+	bubble->cell = find_target_cell( board->array, 
+					 board->canon_angle+CANON_ANGLE_MAX, 
+					 &bubble->target_y,NULL );
 	transition_allowed = 0;
 	board->state = REBOUND;
 	board->launch_count++;
@@ -719,7 +720,7 @@
    board->empty = cell_array_is_empty( board->array );
 }
 
-void lower_board(Board board) {
+static void lower_board(Board board) {
   int i, color;
   Bubble bubble;
 
@@ -750,7 +751,7 @@
 				  scale ));
 }
 
-void kill_board( Board board ) {
+static void kill_board( Board board ) {
   int i, clock;
   Bubble bubble;
   /* kill bubbles */
@@ -774,21 +775,19 @@
 
 void canon_move( Board board, int dt ) {
   int frame, x, y;
-  Frame cframe;
   board->canon_virtual_angle += board->canon_direction*dt*CANON_ROTATING_SPEED*board->canon_speed;
   board->canon_virtual_angle = clip( board->canon_virtual_angle,
 				     -CANON_ANGLE_MAX, CANON_ANGLE_MAX );
   board->canon_angle = (int) floor( board->canon_virtual_angle + 0.5 );
   frame = (board->canon_angle+CANON_ANGLE_MAX)*canon_animation->size/NB_ANGLES;
   /* compute canon center coordinates */
-  cframe = (Frame) canon_animation->element[frame];
   x = scale_x( CANON_X, scale );
   y = scale_y( CANON_Y, scale );
   set_sprite_frame( board->canon_sprite, frame);
   set_sprite_position( board->canon_sprite, x, y);
 }
 
-void animate_alert( Board board ) {
+static void animate_alert( Board board ) {
   int blinking;
   /* blink alert when launch count is almost equal to period */
   if ( board->launch_count >= board->period - 1 ) {
@@ -872,7 +871,7 @@
 
 void canon_fire(Board board) {
   board->launch_requested = 1;
-  board->canon_speed = 1;
+  canon_stop(board);
 }
 
 SpritePool get_board_sprite_pool( Board board ) {