forked from github/server
mapper an region_list angepasst
This commit is contained in:
parent
743a867df2
commit
d2aa46fb39
2 changed files with 18 additions and 18 deletions
|
@ -32,17 +32,17 @@ newfaction * newfactions = NULL;
|
||||||
static int regions_per_faction = 3;
|
static int regions_per_faction = 3;
|
||||||
|
|
||||||
void
|
void
|
||||||
get_island(regionlist ** rlist)
|
get_island(region_list ** rlist)
|
||||||
{
|
{
|
||||||
regionlist *rcurrent = *rlist;
|
region_list *rcurrent = *rlist;
|
||||||
regionlist **rnext = &rcurrent->next;
|
region_list **rnext = &rcurrent->next;
|
||||||
assert(rcurrent && *rnext==NULL);
|
assert(rcurrent && *rnext==NULL);
|
||||||
|
|
||||||
fset(rcurrent->region, FL_MARK);
|
fset(rcurrent->data, FL_MARK);
|
||||||
while (rcurrent!=NULL) {
|
while (rcurrent!=NULL) {
|
||||||
direction_t dir;
|
direction_t dir;
|
||||||
for (dir=0;dir!=MAXDIRECTIONS;++dir) {
|
for (dir=0;dir!=MAXDIRECTIONS;++dir) {
|
||||||
region * r = rconnect(rcurrent->region, dir);
|
region * r = rconnect(rcurrent->data, dir);
|
||||||
if (r!=NULL && r->land && !fval(r, FL_MARK)) {
|
if (r!=NULL && r->land && !fval(r, FL_MARK)) {
|
||||||
fset(r, FL_MARK);
|
fset(r, FL_MARK);
|
||||||
add_regionlist(rnext, r);
|
add_regionlist(rnext, r);
|
||||||
|
@ -54,7 +54,7 @@ get_island(regionlist ** rlist)
|
||||||
rnext=rlist;
|
rnext=rlist;
|
||||||
while (*rnext) {
|
while (*rnext) {
|
||||||
rcurrent = *rnext;
|
rcurrent = *rnext;
|
||||||
freset(rcurrent->region, FL_MARK);
|
freset(rcurrent->data, FL_MARK);
|
||||||
rnext = &rcurrent->next;
|
rnext = &rcurrent->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ recalc(seed_t * seeds, int nseeds, int nplayers)
|
||||||
extern int numnewbies;
|
extern int numnewbies;
|
||||||
|
|
||||||
void
|
void
|
||||||
autoseed(struct regionlist * rlist)
|
autoseed(struct region_list * rlist)
|
||||||
{
|
{
|
||||||
int nregions = listlen(rlist);
|
int nregions = listlen(rlist);
|
||||||
int nseeds = nregions;
|
int nseeds = nregions;
|
||||||
|
@ -204,7 +204,7 @@ autoseed(struct regionlist * rlist)
|
||||||
|
|
||||||
nf = newfactions;
|
nf = newfactions;
|
||||||
for (i=0;i!=nseeds;++i) {
|
for (i=0;i!=nseeds;++i) {
|
||||||
seeds[i].region = rlist->region;
|
seeds[i].region = rlist->data;
|
||||||
rlist = rlist->next;
|
rlist = rlist->next;
|
||||||
if (i<nfactions) {
|
if (i<nfactions) {
|
||||||
while (nf->bonus!=0) nf=nf->next;
|
while (nf->bonus!=0) nf=nf->next;
|
||||||
|
@ -288,7 +288,7 @@ mkisland(int nsize)
|
||||||
{
|
{
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
region * r;
|
region * r;
|
||||||
regionlist * rlist = NULL;
|
region_list * rlist = NULL;
|
||||||
int rsize, isize=0;
|
int rsize, isize=0;
|
||||||
|
|
||||||
#ifdef RANDOM_LOCATION
|
#ifdef RANDOM_LOCATION
|
||||||
|
@ -333,10 +333,10 @@ mkisland(int nsize)
|
||||||
rsize = 1;
|
rsize = 1;
|
||||||
while (nsize && rsize) {
|
while (nsize && rsize) {
|
||||||
int i = rand() % rsize;
|
int i = rand() % rsize;
|
||||||
regionlist ** rnext = &rlist;
|
region_list ** rnext = &rlist;
|
||||||
direction_t d;
|
direction_t d;
|
||||||
while (i--) rnext=&(*rnext)->next;
|
while (i--) rnext=&(*rnext)->next;
|
||||||
r = (*rnext)->region;
|
r = (*rnext)->data;
|
||||||
*rnext = (*rnext)->next;
|
*rnext = (*rnext)->next;
|
||||||
if (rsize==0) {
|
if (rsize==0) {
|
||||||
log_error(("Could not place all factions on the same island as requested\n"));
|
log_error(("Could not place all factions on the same island as requested\n"));
|
||||||
|
@ -381,16 +381,16 @@ mkisland(int nsize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rlist) {
|
if (rlist) {
|
||||||
regionlist ** rbegin = &rlist;
|
region_list ** rbegin = &rlist;
|
||||||
int i;
|
int i;
|
||||||
#define MINOCEANDIST 3
|
#define MINOCEANDIST 3
|
||||||
#define MAXFILLDIST 10
|
#define MAXFILLDIST 10
|
||||||
for (i=0;i!=MINOCEANDIST;++i) {
|
for (i=0;i!=MINOCEANDIST;++i) {
|
||||||
regionlist ** rend = rbegin;
|
region_list ** rend = rbegin;
|
||||||
while (*rend) rend=&(*rend)->next;
|
while (*rend) rend=&(*rend)->next;
|
||||||
while (rbegin!=rend) {
|
while (rbegin!=rend) {
|
||||||
direction_t d;
|
direction_t d;
|
||||||
region * r = (*rbegin)->region;
|
region * r = (*rbegin)->data;
|
||||||
rbegin=&(*rbegin)->next;
|
rbegin=&(*rbegin)->next;
|
||||||
for (d=0;d!=MAXDIRECTIONS;++d) {
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
region * rn = rconnect(r, d);
|
region * rn = rconnect(r, d);
|
||||||
|
@ -404,7 +404,7 @@ mkisland(int nsize)
|
||||||
|
|
||||||
}
|
}
|
||||||
while (*rbegin) {
|
while (*rbegin) {
|
||||||
region * r = (*rbegin)->region;
|
region * r = (*rbegin)->data;
|
||||||
direction_t d;
|
direction_t d;
|
||||||
rbegin=&(*rbegin)->next;
|
rbegin=&(*rbegin)->next;
|
||||||
for (d=0;d!=MAXDIRECTIONS;++d) if (rconnect(r, d)==NULL) {
|
for (d=0;d!=MAXDIRECTIONS;++d) if (rconnect(r, d)==NULL) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#ifndef _REGIONLIST_H
|
#ifndef _REGIONLIST_H
|
||||||
#define _REGIONLIST_H
|
#define _REGIONLIST_H
|
||||||
|
|
||||||
struct regionlist;
|
struct region_list;
|
||||||
struct newfaction;
|
struct newfaction;
|
||||||
|
|
||||||
typedef struct newfaction {
|
typedef struct newfaction {
|
||||||
|
@ -32,8 +32,8 @@ typedef struct newfaction {
|
||||||
|
|
||||||
extern newfaction * newfactions;
|
extern newfaction * newfactions;
|
||||||
|
|
||||||
extern void autoseed(struct regionlist * rlist);
|
extern void autoseed(struct region_list * rlist);
|
||||||
extern void get_island(struct regionlist ** rlist);
|
extern void get_island(struct region_list ** rlist);
|
||||||
extern int mkisland(int nsize);
|
extern int mkisland(int nsize);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue