- bugfix maintenance

- bugfix burgen
This commit is contained in:
Enno Rehling 2002-03-31 12:04:46 +00:00
parent 1cc9b5fc3e
commit 2f447ac0e4
5 changed files with 73 additions and 44 deletions

View File

@ -1,34 +1,32 @@
# Microsoft Developer Studio Project File - Name="attributes" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** NICHT BEARBEITEN **
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=attributes - Win32 Debug
!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 This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "attributes.mak".
!MESSAGE
!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "attributes.mak" CFG="attributes - Win32 Debug"
!MESSAGE
!MESSAGE Für die Konfiguration stehen zur Auswahl:
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "attributes - Win32 Release" (basierend auf\
"Win32 (x86) Static Library")
!MESSAGE "attributes - Win32 Debug" (basierend auf\
"Win32 (x86) Static Library")
!MESSAGE "attributes - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "attributes - Win32 Debug" (based on "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"
@ -42,11 +40,10 @@ CPP=cl.exe
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
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
# ADD BASE RSC /l 0x407
# ADD RSC /l 0x407
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
@ -66,11 +63,10 @@ LIB32=link.exe -lib
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
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
# ADD BASE RSC /l 0x407
# ADD RSC /l 0x407
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo

View File

@ -2638,7 +2638,6 @@ view_neighbours(region * r, faction * f)
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) {

View File

@ -218,6 +218,7 @@ init_smithy(struct building_type * bt)
a_add(&bt->attribs, make_skillmod(NOSKILL, SMF_PRODUCTION, sm_smithy, 0, 0));
a_add(&bt->attribs, make_matmod(mm_smithy));
}
static const char *
castle_name(int bsize)
{
@ -248,6 +249,42 @@ castle_name(int bsize)
return fname[i];
}
static requirement castle_req[] = {
{ R_STONE, 1, 0.5 },
{ NORESOURCE, 0, 0.0 },
};
#if LARGE_CASTLES
static construction castle_bld[MAXBUILDINGS] = {
{ SK_BUILDING, 1, 2, 1, castle_req, &castle_bld[1] },
{ SK_BUILDING, 1, 8, 1, castle_req, &castle_bld[2] },
{ SK_BUILDING, 2, 40, 1, castle_req, &castle_bld[3] },
{ SK_BUILDING, 3, 200, 1, castle_req, &castle_bld[4] },
{ SK_BUILDING, 4, 1000, 1, castle_req, &castle_bld[5] },
{ SK_BUILDING, 5, 5000, 1, castle_req, &castle_bld[6] },
{ SK_BUILDING, 6, -1, 1, castle_req, NULL }
};
#else
static construction castle_bld[MAXBUILDINGS] = {
{ SK_BUILDING, 1, 2, 1, castle_req, &castle_bld[1] },
{ SK_BUILDING, 2, 8, 1, castle_req, &castle_bld[2] },
{ SK_BUILDING, 3, 40, 1, castle_req, &castle_bld[3] },
{ SK_BUILDING, 4, 200, 1, castle_req, &castle_bld[4] },
{ SK_BUILDING, 5, 1000, 1, castle_req, &castle_bld[5] },
{ SK_BUILDING, 6, -1, 1, castle_req, NULL }
};
#endif
building_type bt_castle = {
"castle",
BFL_NONE,
1, 4, -1,
0, 0, 0, 0.0,
NULL,
&castle_bld[0],
castle_name
};
/* for finding out what was meant by a particular building string */
static local_names * bnames;
@ -349,24 +386,28 @@ tagbegin(struct xml_stack * stack)
}
} else if (strcmp(tag->name, "maintenance")==0) {
size_t len = 0;
if (bt->maintenance) {
const resource_type * rtype;
maintenance * mt = (maintenance*)bt->maintenance;
resource_t type = NORESOURCE;
const resource_type * rtype;
maintenance * mt;
resource_t type = NORESOURCE;
if (bt->maintenance==NULL) {
mt = bt->maintenance = calloc(sizeof(maintenance), 2);
len = 0;
} else {
mt = bt->maintenance;
while (mt[len].number) ++len;
mt = realloc(mt, sizeof(maintenance)*(len+1));
mt[len+1].number = 0;
mt[len].number = xml_ivalue(tag, "amount");
rtype = rt_find(xml_value(tag, "type"));
for (type=0;type!=MAX_RESOURCES;++type) {
if (oldresourcetype[type]==rtype) {
mt[len].type = type;
break;
}
}
if (xml_bvalue(tag, "variable")) mt[len].flags |= MTF_VARIABLE;
if (xml_bvalue(tag, "vital")) mt[len].flags |= MTF_VITAL;
}
mt[len+1].number = 0;
mt[len].number = xml_ivalue(tag, "amount");
rtype = rt_find(xml_value(tag, "type"));
for (type=0;type!=MAX_RESOURCES;++type) {
if (oldresourcetype[type]==rtype) {
mt[len].type = type;
break;
}
}
if (xml_bvalue(tag, "variable")) mt[len].flags |= MTF_VARIABLE;
if (xml_bvalue(tag, "vital")) mt[len].flags |= MTF_VITAL;
} else if (strcmp(tag->name, "requirement")==0) {
construction * con = (construction *)bt->construction;
if (con!=NULL) {
@ -411,6 +452,7 @@ register_buildings(void)
xml_register(&xml_buildings, "eressea building", 0);
register_function((pf_generic)init_smithy, "init_smithy");
register_function((pf_generic)castle_name, "castle_name");
bt_register(&bt_castle);
}
void

View File

@ -46,7 +46,7 @@ typedef struct building_type {
int magresbonus; /* bonus it gives the target against spells */
int fumblebonus; /* bonus that reduces fumbling */
double auraregen; /* modifier for aura regeneration inside building */
const struct maintenance * maintenance; /* array of requirements */
struct maintenance * maintenance; /* array of requirements */
const struct construction * construction; /* construction of 1 building-level */
const char * (*name)(int size);

View File

@ -171,11 +171,3 @@
<requirement type="money" quantity="100"></requirement>
</construction>
</building>
<building name="castle" capacity="1" maxcapacity="4" protection>
<function name="name" value="castle_name"></function>
<construction skill="sk_building" minskill="1" reqsize="1" maxsize="2">
<requirement type="stone" quantity="1"></requirement>
</construction>
</building>