Mapper setzt zufällig kleine Inseln in den Ozean.

This commit is contained in:
Enno Rehling 2004-09-05 13:02:09 +00:00
parent f596ea5a8d
commit 3e53d8bd09
4 changed files with 61 additions and 51 deletions

View File

@ -372,11 +372,14 @@ mkisland(int nsize)
}
}
if (rlist) {
region_list ** rbegin = &rlist;
int i;
#define MINOCEANDIST 3
#define MAXFILLDIST 10
for (i=0;i!=MINOCEANDIST;++i) {
#define SPECIALCHANCE 80
region_list ** rbegin = &rlist;
int i;
int special = 1;
for (i=0;i!=MINOCEANDIST;++i) {
region_list ** rend = rbegin;
while (*rend) rend=&(*rend)->next;
while (rbegin!=rend) {
@ -386,8 +389,15 @@ mkisland(int nsize)
for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d);
if (rn==NULL) {
terrain_t terrain = T_OCEAN;
rn = new_region(r->x + delta_x[d], r->y + delta_y[d]);
terraform(rn, T_OCEAN);
if (rand() % SPECIALCHANCE < special) {
terrain = (terrain_t)(1 + rand() % T_GLACIER);
special = SPECIALCHANCE / 3; /* 33% chance auf noch eines */
} else {
special = 1;
}
terraform(rn, terrain);
add_regionlist(rend, rn);
}
}

View File

@ -85,7 +85,7 @@ terrain_create(int climate)
return terrain;
}
static char newblock[BLOCKSIZE][BLOCKSIZE];
static terrain_t newblock[BLOCKSIZE][BLOCKSIZE];
static int g_maxluxuries;
void

View File

@ -236,52 +236,52 @@ read_newfactions(const char * filename)
char race[20], email[64], lang[8], password[16];
newfaction *nf;
int bonus, subscription;
int alliance;
if (alliances!=NULL) {
/* email;race;locale;startbonus;subscription;alliance */
if (fscanf(F, "%s %s %s %d %d %s %d", email, race, lang, &bonus, &subscription, password, &alliance)<=0) break;
} else {
/* email;race;locale;startbonus;subscription */
if (fscanf(F, "%s %s %s %d %d %s", email, race, lang, &bonus, &subscription, password)<=0) break;
int alliance = 0;
if (alliances!=NULL) {
/* email;race;locale;startbonus;subscription;alliance */
if (fscanf(F, "%s %s %s %d %d %s %d", email, race, lang, &bonus, &subscription, password, &alliance)<=0) break;
} else {
/* email;race;locale;startbonus;subscription */
if (fscanf(F, "%s %s %s %d %d %s", email, race, lang, &bonus, &subscription, password)<=0) break;
}
while (f) {
if (strcmp(f->email, email)==0 && f->subscription) {
break;
}
while (f) {
if (strcmp(f->email, email)==0 && f->subscription) {
break;
}
f = f->next;
}
if (f) continue; /* skip the ones we've already got */
for (nf=newfactions;nf;nf=nf->next) {
if (strcmp(nf->email, email)==0) break;
}
if (nf) continue;
nf = calloc(sizeof(newfaction), 1);
if (set_email(&nf->email, email)!=0) {
log_error(("Invalid email address for subscription %s: %s\n", itoa36(subscription), email));
f = f->next;
}
if (f) continue; /* skip the ones we've already got */
for (nf=newfactions;nf;nf=nf->next) {
if (strcmp(nf->email, email)==0) break;
}
if (nf) continue;
nf = calloc(sizeof(newfaction), 1);
if (set_email(&nf->email, email)!=0) {
log_error(("Invalid email address for subscription %s: %s\n", itoa36(subscription), email));
}
nf->password = strdup(password);
nf->race = rc_find(race);
nf->subscription = subscription;
if (alliances!=NULL) {
struct alliance * al = findalliance(alliance);
if (al==NULL) {
char zText[64];
sprintf(zText, "Allianz %d", alliance);
al = makealliance(alliance, zText);
}
nf->password = strdup(password);
nf->race = rc_find(race);
nf->subscription = subscription;
if (alliances!=NULL) {
struct alliance * al = findalliance(alliance);
if (al==NULL) {
char zText[64];
sprintf(zText, "Allianz %d", alliance);
al = makealliance(alliance, zText);
}
nf->allies = al;
} else {
nf->allies = NULL;
}
if (nf->race==NULL) nf->race = findrace(race, default_locale);
nf->lang = find_locale(lang);
nf->bonus = bonus;
assert(nf->race && nf->email && nf->lang);
nf->next = newfactions;
newfactions = nf;
}
fclose(F);
nf->allies = al;
} else {
nf->allies = NULL;
}
if (nf->race==NULL) nf->race = findrace(race, default_locale);
nf->lang = find_locale(lang);
nf->bonus = bonus;
assert(nf->race && nf->email && nf->lang);
nf->next = newfactions;
newfactions = nf;
}
fclose(F);
}
newfaction *

View File

@ -83,7 +83,7 @@
Name="VCCLCompilerTool"
Optimization="0"
ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="$(CURSES_ROOT)/include;../common/kernel,../common/gamecode,../common/util,../common,.."
AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.."
PreprocessorDefinitions="_CONSOLE,WIN32"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
@ -107,7 +107,7 @@
OutputFile=".\Debug/mapper.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="$(CURSES_ROOT)\lib"
AdditionalLibraryDirectories=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/mapper.pdb"
SubSystem="1"/>