Newbie islands should not have volcano terrain.

This commit is contained in:
Enno Rehling 2019-04-05 17:14:28 +02:00
parent b48b69bc94
commit df746dd342
4 changed files with 20 additions and 24 deletions

View File

@ -160,7 +160,7 @@ static int tolua_make_island(lua_State * L)
int y = (int)tolua_tonumber(L, 2, 0); int y = (int)tolua_tonumber(L, 2, 0);
int s = (int)tolua_tonumber(L, 3, 0); int s = (int)tolua_tonumber(L, 3, 0);
s = build_island_e3(x, y, s, NULL, 0); s = build_island(x, y, s, NULL, 0);
lua_pushinteger(L, s); lua_pushinteger(L, s);
return 1; return 1;
} }

View File

@ -1143,7 +1143,7 @@ static void handlekey(state * st, int c)
else { else {
n = minpop; n = minpop;
} }
build_island_e3(nx, ny, n, NULL, 0); build_island(nx, ny, n, NULL, 0);
st->modified = 1; st->modified = 1;
st->wnd_info->update |= 1; st->wnd_info->update |= 1;
st->wnd_status->update |= 1; st->wnd_status->update |= 1;

View File

@ -49,7 +49,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
const terrain_type *random_terrain(const terrain_type * terrains[], static const terrain_type *random_terrain_select(const terrain_type * terrains[],
int distribution[], int size) int distribution[], int size)
{ {
int ndistribution = size; int ndistribution = size;
@ -583,7 +583,7 @@ int autoseed(newfaction ** players, int nsize, int max_agediff)
break; break;
} }
else { else {
terraform_region(r, random_terrain(terrainarr, distribution, nterrains)); terraform_region(r, random_terrain_select(terrainarr, distribution, nterrains));
--isize; --isize;
} }
} }
@ -619,7 +619,7 @@ int autoseed(newfaction ** players, int nsize, int max_agediff)
pnormalize(&x, &y, pl); pnormalize(&x, &y, pl);
rn = new_region(x, y, pl, 0); rn = new_region(x, y, pl, 0);
if (rng_int() % SPECIALCHANCE < special) { if (rng_int() % SPECIALCHANCE < special) {
terrain = random_terrain(terrainarr, distribution, nterrains); terrain = random_terrain_select(terrainarr, distribution, nterrains);
special = SPECIALCHANCE / 3; /* 33% chance auf noch eines */ special = SPECIALCHANCE / 3; /* 33% chance auf noch eines */
} }
else { else {
@ -698,23 +698,21 @@ region *regionqueue_pop(region_list ** rlist)
return 0; return 0;
} }
#define GEOMAX 8 #define GEOMAX 7
static struct geo { static struct geo {
int distribution; int distribution;
terrain_t type; terrain_t type;
} geography_e3[GEOMAX] = { } geography_e3[GEOMAX] = {
{ { 8, T_OCEAN },
8, T_OCEAN }, { { 3, T_SWAMP },
3, T_SWAMP }, { { 3, T_DESERT },
1, T_VOLCANO }, { { 4, T_HIGHLAND },
3, T_DESERT }, { { 3, T_MOUNTAIN },
4, T_HIGHLAND }, { { 2, T_GLACIER },
3, T_MOUNTAIN }, { { 1, T_PLAIN }
2, T_GLACIER }, {
1, T_PLAIN }
}; };
const terrain_type *random_terrain_e3(direction_t dir) const terrain_type *random_terrain(direction_t dir)
{ {
static const terrain_type **terrainarr = 0; static const terrain_type **terrainarr = 0;
static int *distribution = 0; static int *distribution = 0;
@ -731,7 +729,7 @@ const terrain_type *random_terrain_e3(direction_t dir)
distribution[n] = geography_e3[n].distribution; distribution[n] = geography_e3[n].distribution;
} }
} }
return random_terrain(terrainarr, distribution, GEOMAX); return random_terrain_select(terrainarr, distribution, GEOMAX);
} }
static int static int
@ -864,8 +862,8 @@ static void starting_region(newfaction ** players, region * r, region * rn[])
} }
} }
/* E3A island generation */ /* island generator */
int build_island_e3(int x, int y, int minsize, newfaction ** players, int numfactions) int build_island(int x, int y, int minsize, newfaction ** players, int numfactions)
{ {
#define MIN_QUALITY 1000 #define MIN_QUALITY 1000
int nfactions = 0; int nfactions = 0;
@ -881,14 +879,14 @@ int build_island_e3(int x, int y, int minsize, newfaction ** players, int numfac
r = new_region(x, y, pl, 0); r = new_region(x, y, pl, 0);
} }
do { do {
terraform_region(r, random_terrain_e3(NODIRECTION)); terraform_region(r, random_terrain(NODIRECTION));
} while (!r->land); } while (!r->land);
while (r) { while (r) {
fset(r, RF_MARK); fset(r, RF_MARK);
if (r->land) { if (r->land) {
if (nsize < minsize) { if (nsize < minsize) {
nsize += random_neighbours(r, &rlist, &random_terrain_e3, minsize - nsize); nsize += random_neighbours(r, &rlist, &random_terrain, minsize - nsize);
} }
else { else {
nsize += random_neighbours(r, &rlist, &get_ocean, minsize - nsize); nsize += random_neighbours(r, &rlist, &get_ocean, minsize - nsize);

View File

@ -33,10 +33,8 @@ extern "C" {
extern int autoseed(newfaction ** players, int nsize, int max_agediff); extern int autoseed(newfaction ** players, int nsize, int max_agediff);
extern newfaction *read_newfactions(const char *filename); extern newfaction *read_newfactions(const char *filename);
extern const struct terrain_type *random_terrain(const struct terrain_type
*terrains[], int distribution[], int size);
extern int build_island_e3(int x, int y, int minsize, newfaction **players, int numfactions); extern int build_island(int x, int y, int minsize, newfaction **players, int numfactions);
#ifdef __cplusplus #ifdef __cplusplus
} }