field generation fix

origin
stpohle 23 years ago
parent 8f7ecbc44e
commit 47ead24f98

@ -24,8 +24,8 @@
#define MAX_GAMESRVENTRYS 255 /* number of entry which can be get */ #define MAX_GAMESRVENTRYS 255 /* number of entry which can be get */
#define MAX_FIELDSIZE_X 51 #define MAX_FIELDSIZE_X 51
#define MAX_FIELDSIZE_Y 31 #define MAX_FIELDSIZE_Y 31
#define MIN_FIELDSIZE_X 21 #define MIN_FIELDSIZE_X 15
#define MIN_FIELDSIZE_Y 13 #define MIN_FIELDSIZE_Y 9
#define ANI_FIRETIMEOUT 20 #define ANI_FIRETIMEOUT 20

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.9 2003/05/05 15:53:27 stpohle Exp $ */ /* $Id: field.c,v 1.10 2003/05/05 16:33:57 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>
@ -283,6 +283,12 @@ field_new (char *filename)
// Clean and create the field // // Clean and create the field //
if (fmap == NULL) { if (fmap == NULL) {
/* if we can't load the map check first the fieldsize settings */
if (bman.fieldsize.x < MIN_FIELDSIZE_X)
bman.fieldsize.x = MIN_FIELDSIZE_X;
if (bman.fieldsize.x > MAX_FIELDSIZE_X)
bman.fieldsize.x = MAX_FIELDSIZE_X;
for (x = 0; x < bman.fieldsize.x; x++) for (x = 0; x < bman.fieldsize.x; x++)
for (y = 0; y < bman.fieldsize.y; y++) { for (y = 0; y < bman.fieldsize.y; y++) {
if ((y == 0) || (y == bman.fieldsize.y - 1)) if ((y == 0) || (y == bman.fieldsize.y - 1))

Loading…
Cancel
Save