Bugfixing the current crash problem... but still no cloe where it comes from

origin
stpohle 23 years ago
parent b74e5dea4a
commit aad984176b

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.37 2003/06/06 23:22:03 stpohle Exp $ */ /* $Id: bomberclone.h,v 1.38 2003/06/07 19:05:55 stpohle Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -259,6 +259,7 @@ extern void d_playerdetail (char *head);
extern void d_gamedetail (char *head); extern void d_gamedetail (char *head);
extern void d_printf (char *fmt,...); extern void d_printf (char *fmt,...);
extern void d_bitprint (int bits, int nr); extern void d_bitprint (int bits, int nr);
extern void d_fatal (char *fmt,...);
// single.c // single.c

@ -50,3 +50,12 @@ void d_bitprint (int bits, int nr) {
printf (" "); printf (" ");
}; };
void d_fatal (char *fmt,...) {
va_list args;
va_start (args, fmt);
fprintf (stdout, "FATAL:");
vfprintf (stdout, fmt, args);
va_end (args);
}

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.29 2003/06/07 14:33:04 stpohle Exp $ */ /* $Id: field.c,v 1.30 2003/06/07 19:05:55 stpohle Exp $ */
/* field.c - procedures which are needed to control the field */ /* field.c - procedures which are needed to control the field */
#include <stdlib.h> #include <stdlib.h>
@ -19,6 +19,11 @@ draw_stone (int x, int y)
int i, int i,
d; d;
if (x < 0 || y < 0 || x > bman.fieldsize.x || y > bman.fieldsize.y) {
d_fatal ("Draw Stone out of range [%d,%d]\n", x, y);
return;
}
src.w = dest.w = gfx.block.x; src.w = dest.w = gfx.block.x;
src.h = dest.h = gfx.block.y; src.h = dest.h = gfx.block.y;
@ -77,9 +82,9 @@ draw_stone (int x, int y)
if (i >= FT_death) { if (i >= FT_death) {
field_animation_add (x, y); field_animation_add (x, y);
srcimg = gfx.powerup[d].image; srcimg = gfx.powerup[d].image;
if ((stone->frame & 0xFF) >= gfx.powerup[d].frames) if (stone->frame >= gfx.powerup[d].frames)
stone->frame = 0; stone->frame = 0;
src.y = (stone->frame & 0xFF) * gfx.block.y; src.y = stone->frame * gfx.block.y;
} }
if (srcimg != NULL) if (srcimg != NULL)

@ -619,6 +619,7 @@ do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr)
bomb->r = b_dat->r; bomb->r = b_dat->r;
bomb->ex_nr = b_dat->ex_nr; bomb->ex_nr = b_dat->ex_nr;
bomb->state = b_dat->state; bomb->state = b_dat->state;
if (bomb->state == BS_exploding) if (bomb->state == BS_exploding)
bomb_explode (b_dat->p_nr, b_dat->b_nr, 0); bomb_explode (b_dat->p_nr, b_dat->b_nr, 0);

@ -12,6 +12,13 @@ draw_player (_player * player)
dest; dest;
int i; int i;
if ((player->pos.x >> 8) < 0 || (player->pos.x >> 8) > bman.fieldsize.x ||
(player->pos.y >> 8) < 0 || (player->pos.y >> 8) > bman.fieldsize.y) {
d_fatal ("Draw Player out of range : [%d,%d]\n", (player->pos.x >> 8),
(player->pos.y >> 8));
return;
}
if (PS_IS_alife (player->state)) { if (PS_IS_alife (player->state)) {
/* player is alife */ /* player is alife */
dest.w = src.w = player->gfx->size.x; dest.w = src.w = player->gfx->size.x;
@ -78,8 +85,16 @@ restore_players_screen ()
y, y,
ys, ys,
ye; ye;
for (i = 0; i < MAX_PLAYERS; i++) for (i = 0; i < MAX_PLAYERS; i++)
if ((PS_IS_used (bman.players[i].state)) && bman.players[i].old.x != -1) { if ((PS_IS_used (bman.players[i].state)) && bman.players[i].old.x != -1) {
if ((bman.players[i].old.x >> 8) < 0 || (bman.players[i].old.x >> 8) > bman.fieldsize.x
|| (bman.players[i].old.y >> 8) < 0
|| (bman.players[i].old.y >> 8) > bman.fieldsize.y)
d_fatal ("Restore Player out of range : playernr %d [%d,%d]\n", i,
(bman.players[i].old.x >> 8), (bman.players[i].old.y >> 8));
else {
if ((bman.players[i].old.x & 0xFF) > 128) { if ((bman.players[i].old.x & 0xFF) > 128) {
x = (bman.players[i].old.x >> 8); x = (bman.players[i].old.x >> 8);
xe = (bman.players[i].old.x >> 8) + 2; xe = (bman.players[i].old.x >> 8) + 2;
@ -105,6 +120,7 @@ restore_players_screen ()
gfx_AddUpdateRect (xs * gfx.block.x + gfx.offset.x, ys * gfx.block.y + gfx.offset.y, gfx_AddUpdateRect (xs * gfx.block.x + gfx.offset.x, ys * gfx.block.y + gfx.offset.y,
gfx.block.x * 3, gfx.block.y * 3); gfx.block.x * 3, gfx.block.y * 3);
} }
}
}; };

Loading…
Cancel
Save