forked from github/server
Mapper setzt zufällig kleine Inseln in den Ozean.
This commit is contained in:
parent
f596ea5a8d
commit
3e53d8bd09
|
@ -372,11 +372,14 @@ mkisland(int nsize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rlist) {
|
if (rlist) {
|
||||||
region_list ** rbegin = &rlist;
|
|
||||||
int i;
|
|
||||||
#define MINOCEANDIST 3
|
#define MINOCEANDIST 3
|
||||||
#define MAXFILLDIST 10
|
#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;
|
region_list ** rend = rbegin;
|
||||||
while (*rend) rend=&(*rend)->next;
|
while (*rend) rend=&(*rend)->next;
|
||||||
while (rbegin!=rend) {
|
while (rbegin!=rend) {
|
||||||
|
@ -386,8 +389,15 @@ mkisland(int nsize)
|
||||||
for (d=0;d!=MAXDIRECTIONS;++d) {
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
region * rn = rconnect(r, d);
|
region * rn = rconnect(r, d);
|
||||||
if (rn==NULL) {
|
if (rn==NULL) {
|
||||||
|
terrain_t terrain = T_OCEAN;
|
||||||
rn = new_region(r->x + delta_x[d], r->y + delta_y[d]);
|
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);
|
add_regionlist(rend, rn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ terrain_create(int climate)
|
||||||
return terrain;
|
return terrain;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char newblock[BLOCKSIZE][BLOCKSIZE];
|
static terrain_t newblock[BLOCKSIZE][BLOCKSIZE];
|
||||||
static int g_maxluxuries;
|
static int g_maxluxuries;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -236,52 +236,52 @@ read_newfactions(const char * filename)
|
||||||
char race[20], email[64], lang[8], password[16];
|
char race[20], email[64], lang[8], password[16];
|
||||||
newfaction *nf;
|
newfaction *nf;
|
||||||
int bonus, subscription;
|
int bonus, subscription;
|
||||||
int alliance;
|
int alliance = 0;
|
||||||
|
|
||||||
if (alliances!=NULL) {
|
if (alliances!=NULL) {
|
||||||
/* email;race;locale;startbonus;subscription;alliance */
|
/* 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;
|
if (fscanf(F, "%s %s %s %d %d %s %d", email, race, lang, &bonus, &subscription, password, &alliance)<=0) break;
|
||||||
} else {
|
} else {
|
||||||
/* email;race;locale;startbonus;subscription */
|
/* email;race;locale;startbonus;subscription */
|
||||||
if (fscanf(F, "%s %s %s %d %d %s", email, race, lang, &bonus, &subscription, password)<=0) break;
|
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) {
|
f = f->next;
|
||||||
if (strcmp(f->email, email)==0 && f->subscription) {
|
}
|
||||||
break;
|
if (f) continue; /* skip the ones we've already got */
|
||||||
}
|
for (nf=newfactions;nf;nf=nf->next) {
|
||||||
f = f->next;
|
if (strcmp(nf->email, email)==0) break;
|
||||||
}
|
}
|
||||||
if (f) continue; /* skip the ones we've already got */
|
if (nf) continue;
|
||||||
for (nf=newfactions;nf;nf=nf->next) {
|
nf = calloc(sizeof(newfaction), 1);
|
||||||
if (strcmp(nf->email, email)==0) break;
|
if (set_email(&nf->email, email)!=0) {
|
||||||
}
|
log_error(("Invalid email address for subscription %s: %s\n", itoa36(subscription), email));
|
||||||
if (nf) continue;
|
}
|
||||||
nf = calloc(sizeof(newfaction), 1);
|
nf->password = strdup(password);
|
||||||
if (set_email(&nf->email, email)!=0) {
|
nf->race = rc_find(race);
|
||||||
log_error(("Invalid email address for subscription %s: %s\n", itoa36(subscription), email));
|
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->allies = al;
|
||||||
nf->race = rc_find(race);
|
} else {
|
||||||
nf->subscription = subscription;
|
nf->allies = NULL;
|
||||||
if (alliances!=NULL) {
|
}
|
||||||
struct alliance * al = findalliance(alliance);
|
if (nf->race==NULL) nf->race = findrace(race, default_locale);
|
||||||
if (al==NULL) {
|
nf->lang = find_locale(lang);
|
||||||
char zText[64];
|
nf->bonus = bonus;
|
||||||
sprintf(zText, "Allianz %d", alliance);
|
assert(nf->race && nf->email && nf->lang);
|
||||||
al = makealliance(alliance, zText);
|
nf->next = newfactions;
|
||||||
}
|
newfactions = nf;
|
||||||
nf->allies = al;
|
}
|
||||||
} else {
|
fclose(F);
|
||||||
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 *
|
newfaction *
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
ImproveFloatingPointConsistency="TRUE"
|
ImproveFloatingPointConsistency="TRUE"
|
||||||
AdditionalIncludeDirectories="$(CURSES_ROOT)/include;../common/kernel,../common/gamecode,../common/util,../common,.."
|
AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.."
|
||||||
PreprocessorDefinitions="_CONSOLE,WIN32"
|
PreprocessorDefinitions="_CONSOLE,WIN32"
|
||||||
BasicRuntimeChecks="0"
|
BasicRuntimeChecks="0"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
OutputFile=".\Debug/mapper.exe"
|
OutputFile=".\Debug/mapper.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="$(CURSES_ROOT)\lib"
|
AdditionalLibraryDirectories=""
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
ProgramDatabaseFile=".\Debug/mapper.pdb"
|
ProgramDatabaseFile=".\Debug/mapper.pdb"
|
||||||
SubSystem="1"/>
|
SubSystem="1"/>
|
||||||
|
|
Loading…
Reference in New Issue