From 153f4616683461eab70202728fe9886338ce4c8b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 29 Mar 2002 04:23:51 +0000 Subject: [PATCH] =?UTF-8?q?*=20dynamictypes=20raus.=20endg=C3=BCltig.=20*?= =?UTF-8?q?=20SEE=5FFAR=20ersetzt=20durch=20plane-abh=C3=A4ngige=20sichtfu?= =?UTF-8?q?nktionen.=20*=20regatta-queste=20hat=20eine=20sichtweite=20abha?= =?UTF-8?q?engig=20von=20Wahrnehmung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/attributes/attributes.dsp | 42 ++++++--- src/common/gamecode/creport.c | 25 ----- src/common/gamecode/report.c | 135 +++++++++++++++++++-------- src/common/kernel/plane.h | 1 + src/common/kernel/reports.h | 2 - src/common/kernel/save.c | 49 +--------- src/eressea/korrektur.c | 1 + src/res/buildings.xml | 6 ++ 8 files changed, 133 insertions(+), 128 deletions(-) diff --git a/src/common/attributes/attributes.dsp b/src/common/attributes/attributes.dsp index c9eb17cad..f5c190822 100644 --- a/src/common/attributes/attributes.dsp +++ b/src/common/attributes/attributes.dsp @@ -1,32 +1,34 @@ # Microsoft Developer Studio Project File - Name="attributes" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** NICHT BEARBEITEN ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=attributes - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit\ + NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den\ + Befehl !MESSAGE !MESSAGE NMAKE /f "attributes.mak". !MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: !MESSAGE !MESSAGE NMAKE /f "attributes.mak" CFG="attributes - Win32 Debug" !MESSAGE -!MESSAGE Possible choices for configuration are: +!MESSAGE Für die Konfiguration stehen zur Auswahl: !MESSAGE -!MESSAGE "attributes - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "attributes - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "attributes - Win32 Release" (basierend auf\ + "Win32 (x86) Static Library") +!MESSAGE "attributes - Win32 Debug" (basierend auf\ + "Win32 (x86) Static Library") !MESSAGE # Begin Project -# PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe -RSC=rc.exe !IF "$(CFG)" == "attributes - Win32 Release" @@ -40,10 +42,11 @@ RSC=rc.exe # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /Za /W4 /GX /Z7 /O2 /I "../util" /I "../kernel" /I "../.." /I ".." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +RSC=rc.exe # ADD BASE RSC /l 0x407 # ADD RSC /l 0x407 +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /Za /W4 /GX /Z7 /O2 /I "../util" /I "../kernel" /I "../.." /I ".." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -63,10 +66,11 @@ LIB32=link.exe -lib # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /Za /W4 /Z7 /Od /I "../util" /I "../kernel" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c +RSC=rc.exe # ADD BASE RSC /l 0x407 # ADD RSC /l 0x407 +# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /Za /W4 /Z7 /Od /I "../util" /I "../kernel" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -167,6 +171,10 @@ SOURCE=.\targetregion.h SOURCE=.\ugroup.h # End Source File +# Begin Source File + +SOURCE=.\viewrange.h +# End Source File # End Group # Begin Source File @@ -248,5 +256,9 @@ SOURCE=.\targetregion.c SOURCE=.\ugroup.c # End Source File +# Begin Source File + +SOURCE=.\viewrange.c +# End Source File # End Target # End Project diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 021f16653..eebd64ffc 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -336,26 +336,6 @@ static void report_crtypes(FILE * F, const struct locale* lang) { int i; -#ifdef OLD_MESSAGETYPES - fputs("MESSAGETYPES\n", F); - for (i=0;i!=MTMAXHASH;++i) { - struct known_mtype * kmt; - for (kmt=mtypehash[i];kmt;kmt=kmt->nexthash) { - const struct nrmessage_type * nrt = nrt_find(lang, kmt->mtype); - if (nrt) { - unsigned int hash = hashstring(mt_name(kmt->mtype)); - fputc('\"', F); - fputs(escape_string(nrt_string(nrt), NULL, 0), F); - fprintf(F, "\";%d\n", hash); - } - } - while (mtypehash[i]) { - kmt = mtypehash[i]; - mtypehash[i] = mtypehash[i]->nexthash; - free(kmt); - } - } -#else for (i=0;i!=MTMAXHASH;++i) { struct known_mtype * kmt; for (kmt=mtypehash[i];kmt;kmt=kmt->nexthash) { @@ -375,7 +355,6 @@ report_crtypes(FILE * F, const struct locale* lang) free(kmt); } } -#endif } static void @@ -1000,11 +979,9 @@ report_computer(FILE * F, faction * f, const seen_region * seen, fprintf(F, "\"%s\";Terrain\n", add_translation(tname, locale_string(f->locale, tname))); switch (seemode) { -#ifdef SEE_FAR case see_far: fputs("\"neighbourhood\";visibility\n", F); break; -#endif case see_lighthouse: fputs("\"lighthouse\";visibility\n", F); break; @@ -1258,9 +1235,7 @@ report_computer(FILE * F, faction * f, const seen_region * seen, case see_unit: modifier=0; break; -#ifdef SEE_FAR case see_far: -#endif case see_lighthouse: modifier = -2; break; diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index afdfddbb2..17d40ae14 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -23,6 +23,7 @@ /* attributes includes */ #include +#include #include #ifdef AT_OPTION # include @@ -65,6 +66,7 @@ #endif /* util includes */ +#include #include #include #include @@ -1039,11 +1041,9 @@ describe(FILE * F, region * r, int partial, faction * f) if (partial == 1) { scat(" (durchgereist)"); } -#ifdef SEE_FAR else if (partial == 3) { scat(" (benachbart)"); } -#endif else if (partial == 2) { scat(" (vom Turm erblickt)"); } @@ -2046,10 +2046,8 @@ report(FILE *F, faction * f, const faction_list * addresses, case see_lighthouse: turm_sieht_region = true; break; -#ifdef SEE_FAR case see_far: break; -#endif case see_travel: durchgezogen_in_region = true; break; @@ -2072,13 +2070,11 @@ report(FILE *F, faction * f, const faction_list * addresses, guards(F, r, f); durchreisende(F, r, f); } -#ifdef SEE_FAR else if (sd->mode==see_far) { describe(F, r, 3, f); guards(F, r, f); durchreisende(F, r, f); } -#endif else if (turm_sieht_region) { describe(F, r, 2, f); durchreisende(F, r, f); @@ -2114,9 +2110,7 @@ report(FILE *F, faction * f, const faction_list * addresses, if ((u->faction == f) || (unit_in_region && cansee(f, r, u, 0)) || (durchgezogen_in_region && cansee(f, r, u, -1)) || -#ifdef SEE_FAR (sd->mode==see_far && cansee(f, r, u, -2)) || -#endif (turm_sieht_region && cansee(f, r, u, -2))) { if (dh == 0 && !(rbuildings(r) || r->ships)) { @@ -2594,6 +2588,93 @@ add_seen(region * r, unsigned char mode, boolean dis) int chits = 0; int ctries = 0; #endif +static void +view_default(region *r, faction *f) +{ + direction_t dir; + for (dir=0;dir!=MAXDIRECTIONS;++dir) { + region * r2 = rconnect(r, dir); + if (r2) { + border * b = get_borders(r, r2); + if (!b) add_seen(r2, see_neighbour, false); + } + } +} + +static void +view_neighbours(region * r, faction * f) +{ + direction_t dir; + for (dir=0;dir!=MAXDIRECTIONS;++dir) { + region * r2 = rconnect(r, dir); + if (r2) { + border * b = get_borders(r, r2); + while (b) { + if (!b->type->transparent(b, f)) break; + b = b->next; + } + if (!b) { + if (add_seen(r2, see_far, false)) { + direction_t dir; + for (dir=0;dir!=MAXDIRECTIONS;++dir) { + region * r3 = rconnect(r2, dir); + if (r3) { + border * b = get_borders(r2, r3); + while (b) { + if (!b->type->transparent(b, f)) break; + b = b->next; + } + if (!b) add_seen(r3, see_neighbour, false); + } + } + } + } + } + } +} + +static void +recurse_regatta(region *center, region *r, faction *f, int maxdist) +{ + plane * p = rplane(center); + direction_t dir; + int dist = distance(center, r); + for (dir=0;dir!=MAXDIRECTIONS;++dir) { + region * r2 = rconnect(r, dir); + if (r2) { + int ndist = distance(center, r2); + if (ndist>dist) { + border * b = get_borders(r, r2); + while (b) { + if (!b->type->transparent(b, f)) break; + b = b->next; + } + if (!b) { + if (ndistunits; u; u=u->next) { + if (u->faction==f) { + int es = effskill(u, SK_OBSERVATION); + if (es>skill) skill=es; + } + } + recurse_regatta(r, r, f, skill/2); +} + static void prepare_report(faction * f) { @@ -2659,38 +2740,12 @@ prepare_report(faction * f) add_seen(r, mode, dis); /* nicht, wenn Verwirrung herrscht: */ if (!is_cursed(r->attribs, C_REGCONF, 0)) { - direction_t dir; - - for (dir=0;dir!=MAXDIRECTIONS;++dir) { - region * r2 = rconnect(r, dir); - if (r2) { - border * b = get_borders(r, r2); - while (b) { - if (!b->type->transparent(b, f)) break; - b = b->next; - } -#ifdef SEE_FAR - if (!b) { - if (add_seen(r2, see_far, false)) { - direction_t dir; - for (dir=0;dir!=MAXDIRECTIONS;++dir) { - region * r3 = rconnect(r2, dir); - if (r3) { - border * b = get_borders(r2, r3); - while (b) { - if (!b->type->transparent(b, f)) break; - b = b->next; - } - if (!b) add_seen(r3, see_neighbour, false); - } - } - } - } -#else - if (!b) add_seen(r2, see_neighbour, false); -#endif - } + void (*view)(region * r, faction * f) = view_default; + if (p && fval(p, PFL_SEESPECIAL)) { + attrib * a = a_find(p->attribs, &at_viewrange); + if (a) view = (void (*)(region * r, faction * f))a->data.f; } + view(r, f); } } #if DBG_CACHE @@ -3669,4 +3724,6 @@ report_init(void) add_function("direction", &eval_direction); add_function("int36", &eval_int36); add_function("trail", &eval_trail); + register_function((pf_generic)view_neighbours, "view_neighbours"); + register_function((pf_generic)view_regatta, "view_regatta"); } diff --git a/src/common/kernel/plane.h b/src/common/kernel/plane.h index 0feaf4e1e..06ba0c527 100644 --- a/src/common/kernel/plane.h +++ b/src/common/kernel/plane.h @@ -36,6 +36,7 @@ #define PFL_FRIENDLY 4096 /* everyone is your ally */ #define PFL_NOORCGROWTH 8192 /* orcs don't grow */ #define PFL_NOMONSTERS 16384 /* no monster randenc */ +#define PFL_SEESPECIAL 32768 /* far seeing */ #define PFL_MUSEUM PFL_NOMONSTERS | PFL_NOCOORDS | PFL_NORECRUITS | PFL_NOGIVE | PFL_NOATTACK | PFL_NOTERRAIN | PFL_NOMAGIC | PFL_NOSTEALTH | PFL_NOTEACH | PFL_NOBUILD | PFL_NOFEED diff --git a/src/common/kernel/reports.h b/src/common/kernel/reports.h index 3828b1564..fd3145283 100644 --- a/src/common/kernel/reports.h +++ b/src/common/kernel/reports.h @@ -73,9 +73,7 @@ enum { see_neighbour, see_lighthouse, see_travel, -#ifdef SEE_FAR see_far, -#endif see_unit, see_battle }; diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 3d1a74375..6ca86fb7c 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -647,51 +647,6 @@ datapath(void) return strcat(strcpy(zText, basepath()), "/data"); } -void -read_dynamictypes(void) -{ - FILE * F; - sprintf(buf, "%s/%d.dynamictypes", datapath(), turn); - F = fopen(buf, "rt+"); - if (F==NULL) { - sprintf(buf, "%s/%d.buildingtypes", datapath(), turn); - F = fopen(buf, "rt+"); - } - if (F==NULL) return; - while (!feof(F)) { - fscanf(F, "%s", buf); - if (!strcmp("BUILDINGTYPE", buf)) bt_read(F); - } - fclose(F); -} - -void -write_dynamictypes(void) -{ - const building_typelist * btl = buildingtypes; - const item_type * itype = itemtypes; - const resource_type * rtype = resourcetypes; - FILE * F; - - sprintf(buf, "%s/%d.dynamictypes", datapath(), turn); - F = fopen(buf, "wt"); - while (btl) { - if (btl->type->flags & BTF_DYNAMIC) bt_write(F, btl->type); - btl=btl->next; - } - fputs("\n", F); - while (rtype) { - if (rtype->flags & RTF_DYNAMIC) rt_write(F, rtype); - rtype=rtype->next; - } - fputs("\n", F); - while (itype) { - if (itype->flags & ITF_DYNAMIC) it_write(F, itype); - itype=itype->next; - } - fclose(F); -} - void read_items(FILE *F, item **ilist) { @@ -812,7 +767,7 @@ readgame(boolean backup) } #endif turn = ri(F); - read_dynamictypes(); + /* read_dynamictypes(); */ if (global.data_version < NEWMAGIC) { max_unique_id = 0; } else { @@ -1250,7 +1205,7 @@ writegame(char *path, char quiet) sprintf(buf, "%s/%d.players", datapath(), turn); export_players(playerfile); #endif - write_dynamictypes(); + /* write_dynamictypes(); */ F = cfopen(path, "w"); if (F==NULL) diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index da6d828a2..a3aa8186a 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -1811,6 +1811,7 @@ regatta_quest(void) { plane * p = getplanebyname("Regatta"); if (p) { + fset(p, PFL_SEESPECIAL); return resize_plane(p, 40); } else { region * center; diff --git a/src/res/buildings.xml b/src/res/buildings.xml index 392e9109b..45c4ab29b 100644 --- a/src/res/buildings.xml +++ b/src/res/buildings.xml @@ -1,3 +1,9 @@ + + + + + +