making the mapper compile

This commit is contained in:
Enno Rehling 2005-10-25 12:59:23 +00:00
parent 70b3e9ad50
commit 19a7624fe8
3 changed files with 21 additions and 21 deletions

View File

@ -66,7 +66,7 @@ climate(int y)
} }
#define MAXSEEDSIZE 17 #define MAXSEEDSIZE 17
static char maxseeds[MAXCLIMATES][MAXTERRAINS] = static char maxseeds[MAXCLIMATES][8] =
{ {
{0, 1, 3, 3, 0, 3, 3, 4,}, /* Summe muß MAXSEEDSIZE sein */ {0, 1, 3, 3, 0, 3, 3, 4,}, /* Summe muß MAXSEEDSIZE sein */
{0, 5, 4, 2, 0, 2, 3, 1,}, {0, 5, 4, 2, 0, 2, 3, 1,},
@ -155,8 +155,8 @@ block_create(short x1, short y1, int size, char chaotisch, int special, const te
int c = (int) fringe.data[rand() % fringe.size]; int c = (int) fringe.data[rand() % fringe.size];
direction_t d; direction_t d;
x = (c & 0xFFFF0000) >> 16; x = (short)(c >> 16);
y = (c & 0xFFFF); y = (short)(c & 0xFFFF);
assert(newblock[x][y] == T_OCEAN); assert(newblock[x][y] == T_OCEAN);
newblock[x][y] = terrain_create(local_climate); newblock[x][y] = terrain_create(local_climate);
vset_erase(&fringe, (void *) c); vset_erase(&fringe, (void *) c);
@ -193,7 +193,7 @@ block_create(short x1, short y1, int size, char chaotisch, int special, const te
for (y = 0; y != BLOCKSIZE; y++) { for (y = 0; y != BLOCKSIZE; y++) {
const luxury_type * sale = (rand()%2)?p1:p2; const luxury_type * sale = (rand()%2)?p1:p2;
r = findregion(x1 + x - BLOCKSIZE/2, y1 + y - BLOCKSIZE/2); r = findregion(x1 + x - BLOCKSIZE/2, y1 + y - BLOCKSIZE/2);
if (r && r->terrain!=T_OCEAN) continue; if (r && !fval(r->terrain, SEA_REGION)) continue;
if (r==NULL) r = new_region(x1 + x - BLOCKSIZE/2, y1 + y - BLOCKSIZE/2); if (r==NULL) r = new_region(x1 + x - BLOCKSIZE/2, y1 + y - BLOCKSIZE/2);
if (chaotisch) fset(r, RF_CHAOTIC); if (chaotisch) fset(r, RF_CHAOTIC);
if (special == 1) { if (special == 1) {
@ -858,7 +858,7 @@ modify_region(region * r)
case 'T': case 'T':
case 'B': case 'B':
if (r->terrain != T_OCEAN) { if (fval(r->terrain, LAND_REGION)) {
NeueBurg(r); NeueBurg(r);
return 1; return 1;
} else } else
@ -888,17 +888,16 @@ modify_region(region * r)
} }
void void
make_new_region(int x, int y) make_new_region(short x, short y)
{ {
WINDOW *win; WINDOW *win;
int q, z, i;
region *r; region *r;
const terrain_type * terrain = NULL; const terrain_type * terrain = NULL;
win = openwin(SX - 10, 10, "< Region erzeugen >"); win = openwin(SX - 10, 10, "< Region erzeugen >");
x = map_input(win, 2, 1, "X-Koordinate", -999, 999, x); x = (short)map_input(win, 2, 1, "X-Koordinate", -999, 999, x);
y = map_input(win, 2, 2, "Y-Koordinate", -999, 999, y); y = (short)map_input(win, 2, 2, "Y-Koordinate", -999, 999, y);
wmove(win, 3, 2); wmove(win, 3, 2);
if ((r=findregion(x, y))!=NULL) { if ((r=findregion(x, y))!=NULL) {
if (!yes_no(win, "Dort ist schon etwas! Überschreiben?", 'n')) if (!yes_no(win, "Dort ist schon etwas! Überschreiben?", 'n'))
@ -928,9 +927,9 @@ make_new_region(int x, int y)
#define BLOCK_RADIUS 6 #define BLOCK_RADIUS 6
void void
make_ocean_block(int x, int y) make_ocean_block(short x, short y)
{ {
int cx, cy; short cx, cy;
region *r; region *r;
for(cx = x - BLOCK_RADIUS; cx < x+BLOCK_RADIUS; cx++) { for(cx = x - BLOCK_RADIUS; cx < x+BLOCK_RADIUS; cx++) {
@ -970,7 +969,7 @@ void
make_new_block(int x, int y) make_new_block(int x, int y)
{ {
WINDOW *win; WINDOW *win;
int q, z, i, special = 0; int z, special = 0;
char chaos; char chaos;
const terrain_type * terrain = NULL; const terrain_type * terrain = NULL;
@ -1176,14 +1175,15 @@ settg(region *r)
} }
boolean boolean
Create_Island(region *r, int * n, terrain_t t, int x, int y) { Create_Island(region *r, int * n, const terrain_type * terrain, int x, int y) {
terrain_t t = oldterrain(terrain);
if (!r) return false; if (!r) return false;
if (*n == 0) return true; if (*n == 0) return true;
if((t == T_MOUNTAIN || t == T_GLACIER) && rand()%100 < 5) { if((t == T_MOUNTAIN || t == T_GLACIER) && rand()%100 < 5) {
terraform(r,T_VOLCANO); terraform(r,T_VOLCANO);
} else { } else {
terraform(r,t); terraform_region(r, terrain);
} }
if (r->land) settg(r); if (r->land) settg(r);
(*n)--; (*n)--;
@ -1194,7 +1194,7 @@ Create_Island(region *r, int * n, terrain_t t, int x, int y) {
void void
create_island(region *r, int n, terrain_t t) create_island(region *r, int n, terrain_t t)
{ {
int sx=r->x, sy=r->y, i, x = 0, y = 0; short sx=r->x, sy=r->y, i, x = 0, y = 0;
direction_t d; direction_t d;
boolean abbruch=false; boolean abbruch=false;
region *r2; region *r2;
@ -1241,7 +1241,7 @@ create_island(region *r, int n, terrain_t t)
break; break;
} }
r2 = findregion(x,y); r2 = findregion(x,y);
if(r2 && r2->terrain == T_OCEAN ) { if (r2 && fval(r2->terrain, SEA_REGION)) {
r2->msgs = (void *)d; r2->msgs = (void *)d;
push(r2); push(r2);
abbruch=Create_Island(r2,&n,choose_terrain(r->terrain),sx,sy); abbruch=Create_Island(r2,&n,choose_terrain(r->terrain),sx,sy);

View File

@ -953,7 +953,7 @@ movearound(short rx, short ry) {
} else { } else {
const terrain_type * terrain = select_terrain(r->terrain); const terrain_type * terrain = select_terrain(r->terrain);
for (tag=Tagged; tag; tag=tag->next) for (tag=Tagged; tag; tag=tag->next)
terraform(tag->r, terrain); terraform_region(tag->r, terrain);
} }
ch = -9; ch = -9;
modified = 1; modified = 1;

View File

@ -56,11 +56,11 @@ int modify_region(struct region * r);
void NeueBurg(struct region * r); void NeueBurg(struct region * r);
void NeuesSchiff(struct region * r); void NeuesSchiff(struct region * r);
void create_island(struct region *r, int n, terrain_t t); void create_island(struct region *r, int n, terrain_t t);
void make_ocean_block(int x, int y); void make_ocean_block(short x, short y);
void make_new_block(int x, int y); void make_new_block(int x, int y);
void moveln(const int x); void moveln(const int x);
char *my_input(WINDOW * win, int x, int y, const char *text, const char *def); char *my_input(WINDOW * win, int x, int y, const char *text, const char *def);
void make_new_region(int x, int y); void make_new_region(short x, short y);
int map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre); int map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre);
boolean yes_no(WINDOW * win, const char *text, const char def); boolean yes_no(WINDOW * win, const char *text, const char def);
void warnung(WINDOW * win, const char *text); void warnung(WINDOW * win, const char *text);