From 3e53d8bd09ae9361b39371efcd6a1513db852bf1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 5 Sep 2004 13:02:09 +0000 Subject: [PATCH] =?UTF-8?q?Mapper=20setzt=20zuf=C3=A4llig=20kleine=20Insel?= =?UTF-8?q?n=20in=20den=20Ozean.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mapper/autoseed.c | 18 ++++++-- src/mapper/map_modify.c | 2 +- src/mapper/map_partei.c | 88 ++++++++++++++++++++-------------------- src/mapper/mapper.vcproj | 4 +- 4 files changed, 61 insertions(+), 51 deletions(-) diff --git a/src/mapper/autoseed.c b/src/mapper/autoseed.c index 7f82af017..26f222d1b 100644 --- a/src/mapper/autoseed.c +++ b/src/mapper/autoseed.c @@ -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); } } diff --git a/src/mapper/map_modify.c b/src/mapper/map_modify.c index 8f60380b5..55e766563 100644 --- a/src/mapper/map_modify.c +++ b/src/mapper/map_modify.c @@ -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 diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index cd33ca314..10702972d 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -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 * diff --git a/src/mapper/mapper.vcproj b/src/mapper/mapper.vcproj index 835748a8c..2186976d6 100644 --- a/src/mapper/mapper.vcproj +++ b/src/mapper/mapper.vcproj @@ -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"/>