* dynamictypes raus. endgültig.

* SEE_FAR ersetzt durch plane-abhängige sichtfunktionen.
* regatta-queste hat eine sichtweite abhaengig von Wahrnehmung
This commit is contained in:
Enno Rehling 2002-03-29 04:23:51 +00:00
parent 6617c133c5
commit 153f461668
8 changed files with 133 additions and 128 deletions

View file

@ -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

View file

@ -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;

View file

@ -23,6 +23,7 @@
/* attributes includes */
#include <attributes/overrideroads.h>
#include <attributes/viewrange.h>
#include <attributes/otherfaction.h>
#ifdef AT_OPTION
# include <attributes/option.h>
@ -65,6 +66,7 @@
#endif
/* util includes */
#include <functions.h>
#include <goodies.h>
#include <base36.h>
#include <nrmessage.h>
@ -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 (ndist<maxdist) {
if (add_seen(r2, see_far, false)) {
recurse_regatta(center, r2, f, maxdist);
}
} else add_seen(r2, see_neighbour, false);
}
}
}
}
}
static void
view_regatta(region * r, faction * f)
{
unit *u;
int skill = 0;
for (u=r->units; 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");
}

View file

@ -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

View file

@ -73,9 +73,7 @@ enum {
see_neighbour,
see_lighthouse,
see_travel,
#ifdef SEE_FAR
see_far,
#endif
see_unit,
see_battle
};

View file

@ -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)

View file

@ -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;

View file

@ -1,3 +1,9 @@
<building name="temple" maxsize="50" maxcapacity=2 nobuild nodestroy unique>
</building>
<building name="xmas_exit" maxsize="10" maxcapacity=2 nobuild nodestroy unique>
</building>
<building name="caldera" capacity="1" nodestroy nobuild>
</building>