Gebäudetypen sind jetzt in einer XML-Datei.

Neue allgemeine Eigenschaften für Gebäude:
- Magieresistenz,
- Magieresistenz für insassen,
- Auraregenerationsmodifikator für Insassen,
- Schutz im Kampf,
- Magisch
This commit is contained in:
Enno Rehling 2002-03-27 21:49:27 +00:00
parent 61364e6044
commit 865f40ec9a
34 changed files with 571 additions and 962 deletions

View File

@ -88,6 +88,7 @@ init_game(void)
init_resources(); init_resources();
register_items(); register_items();
register_buildings();
init_weapons(); init_weapons();
init_conversion(); init_conversion();

View File

@ -8,12 +8,12 @@ CFG=attributes - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "attributes-6.mak". !MESSAGE NMAKE /f "attributes.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "attributes-6.mak" CFG="attributes - Win32 Debug" !MESSAGE NMAKE /f "attributes.mak" CFG="attributes - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # 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" /D "BETA_CODE" /FR /YX"stdafx.h" /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 BASE RSC /l 0x407
# ADD RSC /l 0x407 # ADD RSC /l 0x407
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -1206,9 +1206,9 @@ gebaeude_stuerzt_ein(region * r, building * b)
/* Falls Karawanserei, Damm oder Tunnel einstürzen, wird die schon /* Falls Karawanserei, Damm oder Tunnel einstürzen, wird die schon
* gebaute Straße zur Hälfte vernichtet */ * gebaute Straße zur Hälfte vernichtet */
for (d=0;d!=MAXDIRECTIONS;++d) if (rroad(r, d) > 0 && for (d=0;d!=MAXDIRECTIONS;++d) if (rroad(r, d) > 0 &&
(b->type == &bt_caravan || (b->type == bt_find("caravan") ||
b->type == &bt_dam || b->type == bt_find("dam") ||
b->type == &bt_tunnel)) b->type == bt_find("tunnel")))
{ {
rsetroad(r, d, rroad(r, d) / 2); rsetroad(r, d, rroad(r, d) / 2);
road = 1; road = 1;
@ -1446,7 +1446,7 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
if (itype == olditemtype[I_LAEN]) { if (itype == olditemtype[I_LAEN]) {
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype != &bt_mine) { if (btype != bt_find("mine")) {
cmistake(u, findorder(u, u->thisorder), 104, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 104, MSG_PRODUCE);
return; return;
} }
@ -1514,16 +1514,16 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
} else { } else {
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (itype == olditemtype[I_IRON] && btype == &bt_mine) { if (itype == olditemtype[I_IRON] && btype == bt_find("mine")) {
++skill; ++skill;
} }
else if (itype == olditemtype[I_STONE] && btype == &bt_quarry) { else if (itype == olditemtype[I_STONE] && btype == bt_find("quarry")) {
++skill; ++skill;
} }
else if (itype == olditemtype[I_WOOD] && btype == &bt_sawmill) { else if (itype == olditemtype[I_WOOD] && btype == bt_find("sawmill")) {
++skill; ++skill;
} }
else if (itype == olditemtype[I_MALLORN] && btype == &bt_sawmill) { else if (itype == olditemtype[I_MALLORN] && btype == bt_find("sawmill")) {
++skill; ++skill;
} }
} }
@ -1564,7 +1564,7 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
if (itype==olditemtype[I_IRON]) { if (itype==olditemtype[I_IRON]) {
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype==&bt_mine) if (btype==bt_find("mine"))
al->save *= 0.5; al->save *= 0.5;
if (u->race == new_race[RC_DWARF]) if (u->race == new_race[RC_DWARF])
#if RACE_ADJUSTMENTS #if RACE_ADJUSTMENTS
@ -1575,7 +1575,7 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
} else if (itype==olditemtype[I_STONE]) { } else if (itype==olditemtype[I_STONE]) {
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype==&bt_quarry) if (btype==bt_find("quarry"))
al->save = al->save*0.5; al->save = al->save*0.5;
#if RACE_ADJUSTMENTS #if RACE_ADJUSTMENTS
if (u->race == new_race[RC_TROLL]) if (u->race == new_race[RC_TROLL])
@ -1584,12 +1584,12 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
} else if (itype==olditemtype[I_MALLORN]) { } else if (itype==olditemtype[I_MALLORN]) {
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype==&bt_sawmill) if (btype==bt_find("sawmill"))
al->save *= 0.5; al->save *= 0.5;
} else if (itype==olditemtype[I_WOOD]) { } else if (itype==olditemtype[I_WOOD]) {
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype==&bt_sawmill) if (btype==bt_find("sawmill"))
al->save *= 0.5; al->save *= 0.5;
} }
} }
@ -2168,17 +2168,17 @@ expandselling(region * r, request * sellorders)
for (b = rbuildings(r); b; b = b->next) { for (b = rbuildings(r); b; b = b->next) {
if (b->size > maxsize && buildingowner(r, b) != NULL if (b->size > maxsize && buildingowner(r, b) != NULL
&& b->type == &bt_castle) { && b->type == bt_find("castle")) {
maxb = b; maxb = b;
maxsize = b->size; maxsize = b->size;
maxowner = buildingowner(r, b); maxowner = buildingowner(r, b);
} else if (b->size == maxsize && b->type == &bt_castle) { } else if (b->size == maxsize && b->type == bt_find("castle")) {
maxb = (building *) NULL; maxb = (building *) NULL;
maxowner = (unit *) NULL; maxowner = (unit *) NULL;
} }
} }
hafenowner = owner_buildingtyp(r, &bt_harbour); hafenowner = owner_buildingtyp(r, bt_find("harbour"));
if (maxb != (building *) NULL && maxowner != (unit *) NULL) { if (maxb != (building *) NULL && maxowner != (unit *) NULL) {
maxeffsize = buildingeffsize(maxb, false); maxeffsize = buildingeffsize(maxb, false);
@ -2198,7 +2198,7 @@ expandselling(region * r, request * sellorders)
max_products = rpeasants(r) / TRADE_FRACTION; max_products = rpeasants(r) / TRADE_FRACTION;
if (max_products <= 0) return; if (max_products <= 0) return;
if (rterrain(r) == T_DESERT && buildingtype_exists(r, &bt_caravan)) { if (rterrain(r) == T_DESERT && buildingtype_exists(r, bt_find("caravan"))) {
max_products = rpeasants(r) * 2 / TRADE_FRACTION; max_products = rpeasants(r) * 2 / TRADE_FRACTION;
} }
/* Verkauf: so programmiert, dass er leicht auf mehrere Gueter pro /* Verkauf: so programmiert, dass er leicht auf mehrere Gueter pro
@ -2328,7 +2328,7 @@ sell(region * r, unit * u, request ** sellorders, const char * cmd)
s = getstrtoken(); s = getstrtoken();
if (findparam(s, u->faction->locale) == P_ANY) { if (findparam(s, u->faction->locale) == P_ANY) {
n = rpeasants(r) / TRADE_FRACTION; n = rpeasants(r) / TRADE_FRACTION;
if (rterrain(r) == T_DESERT && buildingtype_exists(r, &bt_caravan)) if (rterrain(r) == T_DESERT && buildingtype_exists(r, bt_find("caravan")))
n *= 2; n *= 2;
if (n==0) { if (n==0) {
cmistake(u, cmd, 303, MSG_COMMERCE); cmistake(u, cmd, 303, MSG_COMMERCE);
@ -2708,7 +2708,7 @@ breedhorses(region *r, unit *u)
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype!=&bt_stables) { if (btype!=bt_find("stables")) {
cmistake(u, findorder(u, u->thisorder), 122, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 122, MSG_PRODUCE);
return; return;
} }

View File

@ -8,12 +8,12 @@ CFG=gamecode - Win32 Profile
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "gamecode-6.mak". !MESSAGE NMAKE /f "gamecode.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "gamecode-6.mak" CFG="gamecode - Win32 Profile" !MESSAGE NMAKE /f "gamecode.mak" CFG="gamecode - Win32 Profile"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
@ -65,7 +65,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # 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 "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "BETA_CODE" /FR /YX"stdafx.h" /FD /c # ADD CPP /nologo /Za /W4 /Z7 /Od /I "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x407 # ADD BASE RSC /l 0x407
# ADD RSC /l 0x407 # ADD RSC /l 0x407
BSC32=bscmake.exe BSC32=bscmake.exe
@ -73,7 +73,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"Debug\gamecode.lib" # ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "gamecode - Win32 Profile" !ELSEIF "$(CFG)" == "gamecode - Win32 Profile"

View File

@ -1012,7 +1012,7 @@ demographics(void)
if (r->land) for (dmd=r->land->demands;dmd;dmd=dmd->next) { if (r->land) for (dmd=r->land->demands;dmd;dmd=dmd->next) {
if (dmd->value>0 && dmd->value < MAXDEMAND) { if (dmd->value>0 && dmd->value < MAXDEMAND) {
int rise = DMRISE; int rise = DMRISE;
if (buildingtype_exists(r, &bt_harbour)) rise = DMRISEHAFEN; if (buildingtype_exists(r, bt_find("harbour"))) rise = DMRISEHAFEN;
if (rand() % 100 < rise) dmd->value++; if (rand() % 100 < rise) dmd->value++;
} }
} }
@ -1375,11 +1375,11 @@ set_display(region * r, unit * u, strlist * S)
cmistake(u, S->s, 5, MSG_PRODUCE); cmistake(u, S->s, 5, MSG_PRODUCE);
break; break;
} }
if (u->building->type == &bt_generic) { if (u->building->type == bt_find("generic")) {
cmistake(u, S->s, 279, MSG_PRODUCE); cmistake(u, S->s, 279, MSG_PRODUCE);
break; break;
} }
if (u->building->type == &bt_monument && u->building->display[0] != 0) { if (u->building->type == bt_find("monument") && u->building->display[0] != 0) {
cmistake(u, S->s, 29, MSG_PRODUCE); cmistake(u, S->s, 29, MSG_PRODUCE);
break; break;
} }
@ -1571,7 +1571,7 @@ set_name(region * r, unit * u, strlist * S)
break; break;
} }
if (b->type == &bt_generic) { if (b->type == bt_find("generic")) {
cmistake(u, S->s, 278, MSG_EVENT); cmistake(u, S->s, 278, MSG_EVENT);
break; break;
} }
@ -1601,12 +1601,12 @@ set_name(region * r, unit * u, strlist * S)
cmistake(u, S->s, 148, MSG_PRODUCE); cmistake(u, S->s, 148, MSG_PRODUCE);
break; break;
} }
if (u->building->type == &bt_generic) { if (u->building->type == bt_find("generic")) {
cmistake(u, S->s, 278, MSG_EVENT); cmistake(u, S->s, 278, MSG_EVENT);
break; break;
} }
sprintf(buf, "Monument %d", u->building->no); sprintf(buf, "Monument %d", u->building->no);
if (u->building->type == &bt_monument if (u->building->type == bt_find("monument")
&& !strcmp(u->building->name, buf)) { && !strcmp(u->building->name, buf)) {
cmistake(u, S->s, 29, MSG_EVENT); cmistake(u, S->s, 29, MSG_EVENT);
break; break;
@ -3265,7 +3265,7 @@ monthly_healing(void)
#ifdef NEW_TAVERN #ifdef NEW_TAVERN
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype == &bt_inn) { if (btype == bt_find("inn")) {
max_unit = max_unit * 3 / 2; max_unit = max_unit * 3 / 2;
} }
#endif #endif
@ -3348,7 +3348,7 @@ age_factions(void)
faction *f; faction *f;
for (f = factions; f; f = f->next) { for (f = factions; f; f = f->next) {
f->age = f->age + 1; ++f->age;
if (f->age < IMMUN_GEGEN_ANGRIFF) { if (f->age < IMMUN_GEGEN_ANGRIFF) {
add_message(&f->msgs, new_message(f, add_message(&f->msgs, new_message(f,
"newbieimmunity%i:turns", IMMUN_GEGEN_ANGRIFF - f->age)); "newbieimmunity%i:turns", IMMUN_GEGEN_ANGRIFF - f->age));

View File

@ -1213,7 +1213,7 @@ randomevents(void)
if (!(u->race->ec_flags & NOGIVE)) { if (!(u->race->ec_flags & NOGIVE)) {
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype == &bt_blessedstonecircle) { if (btype == bt_find("blessedstonecircle")) {
int n, c = 0; int n, c = 0;
for (n=0; n<u->number; n++) if (rand()%100 < 2) { for (n=0; n<u->number; n++) if (rand()%100 < 2) {
change_item(u, I_UNICORN, 1); change_item(u, I_UNICORN, 1);

View File

@ -1363,7 +1363,7 @@ statistics(FILE * F, region * r, faction * f)
p / RECRUITFRACTION); p / RECRUITFRACTION);
rps(F, buf); rps(F, buf);
if (buildingtype_exists(r, &bt_caravan)) { if (buildingtype_exists(r, bt_find("caravan"))) {
sprintf(buf, "Luxusgüter zum angegebenen Preis: %d", sprintf(buf, "Luxusgüter zum angegebenen Preis: %d",
(p * 2) / TRADE_FRACTION); (p * 2) / TRADE_FRACTION);
} else { } else {
@ -3156,7 +3156,7 @@ writemonument(void)
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
for (b = r->buildings; b; b = b->next) { for (b = r->buildings; b; b = b->next) {
if (b->type == &bt_monument && b->display && *b->display) { if (b->type == bt_find("monument") && b->display && *b->display) {
freset(b, FL_DH); freset(b, FL_DH);
count++; count++;
if(b->size > size[6]) { if(b->size > size[6]) {
@ -3203,7 +3203,7 @@ writemonument(void)
j = 0; j = 0;
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
for (b = r->buildings; b; b = b->next) { for (b = r->buildings; b; b = b->next) {
if (b->type == &bt_monument && b->display && *b->display && !fval(b, FL_DH)) { if (b->type == bt_find("monument") && b->display && *b->display && !fval(b, FL_DH)) {
j++; j++;
if(j == ra) { if(j == ra) {
fprintf(F, "In %s", rname(b->region, NULL)); fprintf(F, "In %s", rname(b->region, NULL));

View File

@ -186,8 +186,8 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
/* Solange Akademien größenbeschränkt sind, sollte Lehrer und /* Solange Akademien größenbeschränkt sind, sollte Lehrer und
* Student auch in unterschiedlichen Gebäuden stehen dürfen */ * Student auch in unterschiedlichen Gebäuden stehen dürfen */
if (btype == &bt_academy if (btype == bt_find("academy")
&& student->building && student->building->type == &bt_academy) && student->building && student->building->type == bt_find("academy"))
{ {
int j = study_cost(student, sk); int j = study_cost(student, sk);
j = max(50, j * 2); j = max(50, j * 2);
@ -516,7 +516,7 @@ learn(void)
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype == &bt_academy) { if (btype == bt_find("academy")) {
studycost = max(50, studycost * 2); studycost = max(50, studycost * 2);
} }
} }

View File

@ -8,12 +8,12 @@ CFG=items - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "items-6.mak". !MESSAGE NMAKE /f "items.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "items-6.mak" CFG="items - Win32 Debug" !MESSAGE NMAKE /f "items.mak" CFG="items - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # 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 "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "BETA_CODE" /FR /YX"stdafx.h" /FD /c # ADD CPP /nologo /Za /W4 /Z7 /Od /I "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x407 # ADD BASE RSC /l 0x407
# ADD RSC /l 0x407 # ADD RSC /l 0x407
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -1602,7 +1602,7 @@ skilldiff(troop at, troop dt, int dist)
#endif #endif
if (df->building) { if (df->building) {
if (df->building->type == &bt_castle) { if (df->building->type->flags & BTF_PROTECTION) {
if(fspecial(au->faction, FS_SAPPER)) { if(fspecial(au->faction, FS_SAPPER)) {
/* Halbe Schutzwirkung, aufgerundet */ /* Halbe Schutzwirkung, aufgerundet */
/* -1 because the tradepost has no protection value */ /* -1 because the tradepost has no protection value */
@ -1824,7 +1824,7 @@ damage_building(battle *b, building *bldg, int damage_abs)
/* Wenn Burg, dann gucken, ob die Leute alle noch in das Gebäude passen. */ /* Wenn Burg, dann gucken, ob die Leute alle noch in das Gebäude passen. */
if (bldg->type == &bt_castle) { if (bldg->type->flags & BTF_PROTECTION) {
fighter *fi; fighter *fi;
bldg->sizeleft = bldg->size; bldg->sizeleft = bldg->size;

View File

@ -440,24 +440,36 @@ build_road(region * r, unit * u, int size, direction_t d)
return; return;
} }
if (rterrain(r) == T_SWAMP) if (rterrain(r) == T_SWAMP) {
/* wenn kein Damm existiert */ /* wenn kein Damm existiert */
if (!buildingtype_exists(r, &bt_dam)) { static const struct building_type * bt_dam;
if (!bt_dam) bt_dam = bt_find("dam");
assert(bt_dam);
if (!buildingtype_exists(r, bt_dam)) {
cmistake(u, findorder(u, u->thisorder), 132, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 132, MSG_PRODUCE);
return; return;
} }
if (rterrain(r) == T_DESERT) }
if (rterrain(r) == T_DESERT) {
static const struct building_type * bt_caravan;
if (!bt_caravan) bt_caravan = bt_find("caravan");
assert(bt_caravan);
/* wenn keine Karawanserei existiert */ /* wenn keine Karawanserei existiert */
if (!buildingtype_exists(r, &bt_caravan)) { if (!buildingtype_exists(r, bt_caravan)) {
cmistake(u, findorder(u, u->thisorder), 133, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 133, MSG_PRODUCE);
return; return;
} }
if (rterrain(r) == T_GLACIER) }
if (rterrain(r) == T_GLACIER) {
static const struct building_type * bt_tunnel;
if (!bt_tunnel) bt_tunnel = bt_find("tunnel");
assert(bt_tunnel);
/* wenn kein Tunnel existiert */ /* wenn kein Tunnel existiert */
if (!buildingtype_exists(r, &bt_tunnel)) { if (!buildingtype_exists(r, bt_tunnel)) {
cmistake(u, findorder(u, u->thisorder), 131, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 131, MSG_PRODUCE);
return; return;
} }
}
if (!get_pooled(u, r, R_STONE) && old_race(u->race) != RC_STONEGOLEM) { if (!get_pooled(u, r, R_STONE) && old_race(u->race) != RC_STONEGOLEM) {
cmistake(u, findorder(u, u->thisorder), 151, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 151, MSG_PRODUCE);
return; return;
@ -840,8 +852,8 @@ build_building(unit * u, const building_type * btype, int want)
newbuilding = 1; newbuilding = 1;
} }
if(b->type==&bt_castle) { if (b->type->name) {
string2 = locale_string(u->faction->locale, bt_castle._name); string2 = LOC(u->faction->locale, b->type->_name);
} else { } else {
string2 = LOC(u->faction->locale, buildingtype(b, b->size)); string2 = LOC(u->faction->locale, buildingtype(b, b->size));
if( newbuilding && b->type->maxsize != -1 ) if( newbuilding && b->type->maxsize != -1 )
@ -857,8 +869,7 @@ build_building(unit * u, const building_type * btype, int want)
set_string(&u->lastorder, buffer); set_string(&u->lastorder, buffer);
b->size += built; b->size += built;
if (b->type == &bt_lighthouse) update_lighthouse(b);
update_lighthouse(b);
add_message(&u->faction->msgs, new_message( add_message(&u->faction->msgs, new_message(
u->faction, "buildbuilding%b:building%u:unit%i:size", b, u, built)); u->faction, "buildbuilding%b:building%u:unit%i:size", b, u, built));

View File

@ -26,9 +26,11 @@
/* util includes */ /* util includes */
#include <base36.h> #include <base36.h>
#include <functions.h>
#include <resolve.h> #include <resolve.h>
#include <event.h> #include <event.h>
#include <language.h> #include <language.h>
#include <xml.h>
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
@ -65,13 +67,15 @@ bt_find(const char* name)
btl = buildingtypes; btl = buildingtypes;
while (btl && strncasecmp(btl->type->_name, name, strlen(name))) btl = btl->next; while (btl && strncasecmp(btl->type->_name, name, strlen(name))) btl = btl->next;
} }
assert(btl);
return btl?btl->type:NULL; return btl?btl->type:NULL;
} }
void void
bt_register(const building_type * type) bt_register(building_type * type)
{ {
struct building_typelist * btl = malloc(sizeof(building_type)); struct building_typelist * btl = malloc(sizeof(building_type));
if (type->init) type->init(type);
btl->type = type; btl->type = type;
btl->next = buildingtypes; btl->next = buildingtypes;
buildingtypes = btl; buildingtypes = btl;
@ -98,8 +102,11 @@ buildingtype(const building * b, int bsize)
{ {
const char * s = NULL; const char * s = NULL;
const building_type * btype = b->type; const building_type * btype = b->type;
static const struct building_type * bt_generic;
if (!bt_generic) bt_generic = bt_find("generic");
assert(bt_generic);
if (btype == &bt_generic) { if (btype == bt_generic) {
const attrib *a = a_find(b->attribs, &at_building_generic_type); const attrib *a = a_find(b->attribs, &at_building_generic_type);
if (a) s = (const char*)a->data.v; if (a) s = (const char*)a->data.v;
} }
@ -191,6 +198,26 @@ enum {
}; };
#endif #endif
static int
sm_smithy(const unit * u, const region * r, skill_t sk, int value) /* skillmod */
{
if (sk==SK_WEAPONSMITH || sk==SK_ARMORER) {
if (u->region == r) return value + 1;
}
return value;
}
static int
mm_smithy(const unit * u, const resource_type * rtype, int value) /* material-mod */
{
if (rtype == oldresourcetype[R_IRON]) return value * 2;
return value;
}
static void
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 * static const char *
castle_name(int bsize) castle_name(int bsize)
{ {
@ -204,8 +231,13 @@ castle_name(int bsize)
"castle", "castle",
"fortress", "fortress",
"citadel" }; "citadel" };
const construction * ctype = bt_castle.construction; const construction * ctype;
static const struct building_type * bt_castle;
int i = 0; int i = 0;
if (!bt_castle) bt_castle = bt_find("castle");
assert(bt_castle);
ctype = bt_castle->construction;
while (ctype && while (ctype &&
ctype->maxsize != -1 ctype->maxsize != -1
&& ctype->maxsize<=bsize) { && ctype->maxsize<=bsize) {
@ -216,546 +248,6 @@ castle_name(int bsize)
return fname[i]; 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,
NULL,
&castle_bld[0],
castle_name
};
/** Building: Lighthouse */
static const maintenance lighthouse_keep[] = {
{ R_SILVER, 100, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement lighthouse_req[] = {
{ R_IRON, 1, 0.5 },
{ R_WOOD, 1, 0.5 },
{ R_STONE, 2, 0.5 },
{ R_SILVER, 100, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction lighthouse_bld = {
SK_BUILDING, 3,
-1, 1, lighthouse_req,
NULL
};
building_type bt_lighthouse = {
"lighthouse",
BFL_NONE,
1, 4, -1,
lighthouse_keep,
&lighthouse_bld
};
/** Building: Mine */
static const maintenance mine_keep[] = {
/* resource, number, flags */
{ R_SILVER, 500, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement mine_req[] = {
/* resource, number, recycle */
{ R_IRON, 1, 0.5 },
{ R_WOOD, 10, 0.5 },
{ R_STONE, 5, 0.5 },
{ R_SILVER, 250, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction mine_bld = {
SK_BUILDING, 4, /* skill, minskill */
-1, 1, mine_req, /* maxsize, reqsize, required */
NULL /* improvement */
};
building_type bt_mine = {
"mine", /* _name */
BFL_NONE, /* flags */
1, -1, -1, /* capac, maxcap, maxsize */
mine_keep, /* maintenance */
&mine_bld, /* construction */
NULL /* name() */
};
/** Building: Quarry */
static const maintenance quarry_keep[] = {
/* resource, number, flags */
{ R_SILVER, 250, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement quarry_req[] = {
/* resource, number, recycle */
{ R_IRON, 1, 0.5 },
{ R_WOOD, 5, 0.5 },
{ R_STONE, 1, 0.5 },
{ R_SILVER, 250, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction quarry_bld = {
SK_BUILDING, 2, /* skill, minskill */
-1, 1, quarry_req, /* maxsize, reqsize, required */
NULL /* improvement */
};
building_type bt_quarry = {
"quarry", /* _name */
BFL_NONE, /* flags */
1, -1, -1, /* capac, maxcap, maxsize */
quarry_keep, /* maintenance */
&quarry_bld, /* construction */
NULL /* name() */
};
/** Building: harbour */
static const maintenance harbour_keep[] = {
/* resource, number, flags */
{ R_SILVER, 250, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement harbour_req[] = {
/* resource, number, recycle */
{ R_WOOD, 125, 0.5 },
{ R_STONE, 125, 0.5 },
{ R_SILVER, 6250, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction harbour_bld = {
SK_BUILDING, 3, /* skill, minskill */
25, 25, harbour_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_harbour = {
"harbour", /* _name */
BFL_NONE, /* flags */
1, 25, 25, /* capac/size, maxcapac, maxsize */
harbour_keep, /* maintenance */
&harbour_bld, /* construction */
NULL /* name() */
};
/** Building: academy */
static const maintenance academy_keep[] = {
/* resource, number, flags */
{ R_SILVER, 1000, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement academy_req[] = {
/* resource, number, recycle */
{ R_WOOD, 125, 0.5 },
{ R_STONE, 125, 0.5 },
{ R_IRON, 25, 0.0 },
{ R_SILVER, 12500, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction academy_bld = {
SK_BUILDING, 3, /* skill, minskill */
25, 25, academy_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_academy = {
"academy", /* _name */
BFL_NONE, /* flags */
-1, 25, 25, /* capac/size, maxcapac, maxsize */
academy_keep, /* maintenance */
&academy_bld, /* construction */
NULL /* name() */
};
/** Building: magictower */
static const maintenance magictower_keep[] = {
/* resource, number, flags */
{ R_SILVER, 1000, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement magictower_req[] = {
/* resource, number, recycle */
{ R_WOOD, 150, 0.5 },
{ R_STONE, 250, 0.5 },
{ R_MALLORN, 100, 0.5 },
{ R_IRON, 150, 0.5 },
{ R_EOG, 100, 0.5 },
{ R_SILVER, 25000, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction magictower_bld = {
SK_BUILDING, 5, /* skill, minskill */
50, 50, magictower_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_magictower = {
"magictower", /* _name */
BFL_NONE, /* flags */
-1, 2, 50, /* capac/size, maxcapac, maxsize */
magictower_keep, /* maintenance */
&magictower_bld, /* construction */
NULL /* name() */
};
/** Building: smithy */
static const maintenance smithy_keep[] = {
/* resource, number, flags */
{ R_SILVER, 300, MTF_VITAL },
{ R_WOOD, 1, MTF_NONE },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement smithy_req[] = {
/* resource, number, recycle */
{ R_WOOD, 5, 0.5 },
{ R_STONE, 5, 0.5 },
{ R_IRON, 2, 0.5 },
{ R_SILVER, 200, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction smithy_bld = {
SK_BUILDING, 3, /* skill, minskill */
-1, 1, smithy_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_smithy = {
"smithy", /* _name */
BFL_NONE, /* flags */
1, -1, -1, /* capac/size, maxcapac, maxsize */
smithy_keep, /* maintenance */
&smithy_bld, /* construction */
NULL /* name() */
};
/** Building: sawmill */
static const maintenance sawmill_keep[] = {
/* resource, number, flags */
{ R_SILVER, 250, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement sawmill_req[] = {
/* resource, number, recycle */
{ R_WOOD, 5, 0.5 },
{ R_STONE, 5, 0.5 },
{ R_IRON, 3, 0.5 },
{ R_SILVER, 200, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction sawmill_bld = {
SK_BUILDING, 3, /* skill, minskill */
-1, 1, sawmill_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_sawmill = {
"sawmill", /* _name */
BFL_NONE, /* flags */
1, -1, -1, /* capac/size, maxcapac, maxsize */
sawmill_keep, /* maintenance */
&sawmill_bld, /* construction */
NULL /* name() */
};
/** Building: stables */
static const maintenance stables_keep[] = {
/* resource, number, flags */
{ R_SILVER, 150, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement stables_req[] = {
/* resource, number, recycle */
{ R_WOOD, 4, 0.5 },
{ R_STONE, 2, 0.5 },
{ R_IRON, 1, 0.5 },
{ R_SILVER, 100, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction stables_bld = {
SK_BUILDING, 2, /* skill, minskill */
-1, 1, stables_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_stables = {
"stables", /* _name */
BFL_NONE, /* flags */
1, -1, -1, /* capac/size, maxcapac, maxsize */
stables_keep, /* maintenance */
&stables_bld, /* construction */
NULL /* name() */
};
static requirement monument_req[] = {
/* resource, number, recycle */
{ R_WOOD, 1, 0.5 },
{ R_STONE, 1, 0.5 },
{ R_IRON, 1, 0.5 },
{ R_SILVER, 400, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction monument_bld = {
SK_BUILDING, 4, /* skill, minskill */
-1, 1, monument_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_monument = {
"monument", /* _name */
BFL_NONE, /* flags */
1, -1, -1, /* capac/size, maxcapac, maxsize */
NULL, /* maintenance */
&monument_bld, /* construction */
NULL /* name() */
};
/** Building: dam */
static const maintenance dam_keep[] = {
/* resource, number, flags */
{ R_WOOD, 3, MTF_NONE },
{ R_SILVER, 1000, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement dam_req[] = {
/* resource, number, recycle */
{ R_IRON, 50, 0.5 },
{ R_WOOD, 500, 0.5 },
{ R_STONE, 250, 0.5 },
{ R_SILVER, 25000, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction dam_bld = {
SK_BUILDING, 4, /* skill, minskill */
50, 50, dam_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_dam = {
"dam", /* _name */
BFL_NONE, /* flags */
1, -1, 50, /* capac/size, maxcapac, maxsize */
dam_keep, /* maintenance */
&dam_bld, /* construction */
NULL /* name() */
};
/** Building: caravan */
static const maintenance caravan_keep[] = {
/* resource, number, flags */
{ R_HORSE, 2, MTF_NONE },
{ R_SILVER, 3000, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement caravan_req[] = {
/* resource, number, recycle */
{ R_IRON, 10, 0.5 },
{ R_WOOD, 50, 0.5 },
{ R_STONE, 10, 0.5 },
{ R_SILVER, 5000, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction caravan_bld = {
SK_BUILDING, 2, /* skill, minskill */
10, 10, caravan_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_caravan = {
"caravan", /* _name */
BFL_NONE, /* flags */
1, -1, 10, /* capac/size, maxcapac, maxsize */
caravan_keep, /* maintenance */
&caravan_bld, /* construction */
NULL /* name() */
};
/** Building: tunnel */
static const maintenance tunnel_keep[] = {
/* resource, number, flags */
{ R_STONE, 2, MTF_NONE },
{ R_SILVER, 100, MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement tunnel_req[] = {
/* resource, number, recycle */
{ R_IRON, 100, 0.5 },
{ R_WOOD, 500, 0.5 },
{ R_STONE, 1000, 0.5 },
{ R_SILVER,30000, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction tunnel_bld = {
SK_BUILDING, 6, /* skill, minskill */
100, 100, tunnel_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_tunnel = {
"tunnel", /* _name */
BFL_NONE, /* flags */
1, -1, 100, /* capac/size, maxcapac, maxsize */
tunnel_keep, /* maintenance */
&tunnel_bld, /* construction */
NULL /* name() */
};
/** Building: inn */
static const maintenance inn_keep[] = {
/* resource, number, flags */
{ R_SILVER, 5, MTF_VARIABLE|MTF_VITAL },
{ NORESOURCE, 0, MTF_NONE },
};
static requirement inn_req[] = {
/* resource, number, recycle */
{ R_IRON, 10, 0.5 },
{ R_WOOD, 30, 0.5 },
{ R_STONE, 40, 0.5 },
{ R_SILVER, 2000, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction inn_bld = {
SK_BUILDING, 2, /* skill, minskill */
-1, 10, inn_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_inn = {
"inn", /* _name */
BFL_NONE, /* flags */
1, -1, -1, /* capac/size, maxcapac, maxsize */
inn_keep, /* maintenance */
&inn_bld, /* construction */
NULL /* name() */
};
/** Building: stonecircle */
static requirement stonecircle_req[] = {
/* resource, number, recycle */
{ R_WOOD, 500, 0.5 },
{ R_STONE, 500, 0.5 },
{ R_SILVER, 0, 0.0 },
{ NORESOURCE, 0, 0.0 },
};
static const construction stonecircle_bld = {
SK_BUILDING, 2, /* skill, minskill */
100, 100, stonecircle_req, /* maxsize, reqsize, required for size */
NULL /* improvement */
};
building_type bt_stonecircle = {
"stonecircle", /* _name */
BFL_NONE, /* flags */
-1, -1, 100, /* capac/size, maxcapac, maxsize */
NULL, /* maintenance */
&stonecircle_bld, /* construction */
NULL /* name() */
};
/** Building: blessedstonecircle */
building_type bt_blessedstonecircle = {
"blessedstonecircle", /* _name */
BTF_NOBUILD, /* flags */
-1, -1, 100, /* capac/size, maxcapac, maxsize */
NULL, /* maintenance */
&stonecircle_bld, /* construction */
NULL /* name() */
};
/** Building: illusion */
building_type bt_illusion = {
"illusioncastle", /* _name */
BTF_NOBUILD, /* flags */
0, 0, 0, /* capac/size, maxcapac, maxsize */
NULL, /* maintenance */
NULL, /* construction */
NULL /* name() */
};
/** Building: Generisches Gebäude */
building_type bt_generic = {
"genericbuilding", /* _name */
BTF_NOBUILD, /* flags */
-1, -1, 1, /* capac/size, maxcapac, maxsize */
NULL, /* maintenance */
NULL, /* construction */
NULL /* name() */
};
/*
name, maxsize, minskill, kapazitaet,
M_EISEN, M_HOLZ, M_STEIN, M_SILBER, M_EOG, M_MALLORN, M_MAX_MAT,
unterhalt, per_size, spezial, unterhalt_spezial, flags
buildingt buildingdaten[MAXBUILDINGTYPES] =
{
{"Burg", -1, 1, -1, {0, 0, 1, 0, 0, 0}, 0, 0, 0, 0, 0},
{"Leuchtturm", -1, 3, 4, {1, 1, 2, 100, 0, 0}, 100, 0, 0, 0, 0},
{"Bergwerk", -1, 4, -1, {1, 10, 5, 250, 0, 0}, 500, 0, 0, 0, 0},
{"Steinbruch", -1, 2, -1, {1, 5, 1, 250, 0, 0}, 250, 0, 0, 0, 0},
{"Hafen", 25, 3, -1, {0, 5, 5, 250, 0, 0}, 250, 0, 0, 0, 0},
{"Akademie", 25, 3, 25, {1, 5, 5, 500, 0, 0}, 1000, 0, 0, 0, 0},
{"Magierturm", 50, 5, 2, {3, 3, 5, 500, 2, 2}, 1000, 0, 0, 0, 0},
{"Schmiede", -1, 3, -1, {2, 5, 5, 200, 0, 0}, 300, 0, I_WOOD, 1, 0},
{"Sägewerk", -1, 3, -1, {3, 5, 5, 200, 0, 0}, 250, 0, 0, 0, 0},
{"Pferdezucht", -1, 2, -1, {1, 4, 2, 100, 0, 0}, 150, 0, 0, 0, 0},
{"Monument", -1, 4, -1, {1, 1, 1, 400, 0, 0}, 0, 0, 0, 0, 0},
{"Damm", 50, 4, -1, {1, 10, 5, 500, 0, 0}, 1000, 0, I_WOOD, 3, 0},
{"Karawanserei", 10, 2, -1, {1, 5, 1, 500, 0, 0}, 3000, 0, I_HORSE, 2, 0},
{"Tunnel", 100, 6, -1, {1, 5, 10, 300, 0, 0}, 100, 0, I_STONE, 2, 0},
{"Taverne", -1, 2, 10, {1, 3, 4, 200, 0, 0}, 0, 5, 0, 0, 0},
{"Tempel", 100, 5, -1, {0, 5, 5, 0, 0, 0}, 0, 0, 0, 0, 0},
{"Gesegneter Tempel", 100, 5, -1, {0, 5, 5, 0, 0, 0}, 0, 0, 0, 0, NO_BUILD},
{"Traumschlößchen", 0, 0, 0, {0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, NO_BUILD}
};
*/
const building_type * oldbuildings[MAXBUILDINGTYPES] = {
&bt_castle,
&bt_lighthouse,
&bt_mine,
&bt_quarry,
&bt_harbour,
&bt_academy,
&bt_magictower,
&bt_smithy,
&bt_sawmill,
&bt_stables,
&bt_monument,
&bt_dam,
&bt_caravan,
&bt_tunnel,
&bt_inn,
&bt_stonecircle,
&bt_blessedstonecircle,
&bt_illusion,
};
/* for finding out what was meant by a particular building string */ /* for finding out what was meant by a particular building string */
static local_names * bnames; static local_names * bnames;
@ -786,27 +278,139 @@ findbuildingtype(const char * name, const locale * lang)
return (const building_type*)i; return (const building_type*)i;
} }
static int static int
sm_smithy(const unit * u, const region * r, skill_t sk, int value) /* skillmod */ tagend(struct xml_stack * stack)
{ {
if (sk==SK_WEAPONSMITH || sk==SK_ARMORER) { const xml_tag * tag = stack->tag;
if (u->region == r) return value + 1; if (strcmp(tag->name, "building")==0) {
bt_register((building_type*)stack->state);
stack->state = 0;
} }
return value; return XML_OK;
} }
static int static int
mm_smithy(const unit * u, const resource_type * rtype, int value) /* material-mod */ tagbegin(struct xml_stack * stack)
{ {
if (rtype == oldresourcetype[R_IRON]) return value * 2; building_type * bt = (building_type *)stack->state;
return value; const xml_tag * tag = stack->tag;
if (strcmp(tag->name, "building")==0) {
const char * name = xml_value(tag, "name");
if (name!=NULL) {
const char * x;
bt = stack->state = calloc(sizeof(building_type), 1);
bt->_name = strdup(name);
bt->magres = xml_ivalue(tag, "magres");
bt->magresbonus = xml_ivalue(tag, "magresbonus");
bt->fumblebonus = xml_ivalue(tag, "fumblebonus");
bt->auraregen = xml_fvalue(tag, "auraregen");
if ((x = xml_value(tag, "capacity"))!=0) bt->capacity = atoi(x);
else bt->capacity = -1;
if ((x = xml_value(tag, "maxcapacity"))!=0) bt->maxcapacity = atoi(x);
else bt->maxcapacity = -1;
if ((x = xml_value(tag, "maxsize"))!=0) bt->maxsize = atoi(x);
else bt->maxsize = -1;
if (xml_bvalue(tag, "nodestroy")) bt->flags |= BTF_INDESTRUCTIBLE;
if (xml_bvalue(tag, "nobuild")) bt->flags |= BTF_NOBUILD;
if (xml_bvalue(tag, "unique")) bt->flags |= BTF_UNIQUE;
if (xml_bvalue(tag, "decay")) bt->flags |= BTF_DECAY;
if (xml_bvalue(tag, "magic")) bt->flags |= BTF_MAGIC;
if (xml_bvalue(tag, "protection")) bt->flags |= BTF_PROTECTION;
}
} else if (bt!=NULL) {
if (strcmp(tag->name, "construction")==0) {
const char * x;
construction * con = calloc(sizeof(construction), 1);
if ((x=xml_value(tag, "maxsize"))!=0) con->maxsize = atoi(x);
else con->maxsize = -1;
if ((x=xml_value(tag, "minskill"))!=0) con->minskill = atoi(x);
else con->minskill = -1;
if ((x=xml_value(tag, "reqsize"))!=0) con->reqsize = atoi(x);
else con->reqsize = -1;
con->skill = sk_find(xml_value(tag, "skill"));
bt->construction = con;
} else if (strcmp(tag->name, "function")==0) {
const char * name = xml_value(tag, "name");
const char * value = xml_value(tag, "value");
if (name && value) {
pf_generic fun = get_function(value);
if (fun==NULL) {
log_error(("unknown function value '%s=%s' for building %s\n", name, value, bt->_name));
} else {
if (strcmp(name, "name")==0) {
bt->name = (const char * (*)(int size))fun;
} else if (strcmp(name, "init")==0) {
bt->init = (void (*)(struct building_type*))fun;
} else {
log_error(("unknown function type '%s=%s' for building %s\n", name, value, bt->_name));
}
}
}
} 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;
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;
}
} else if (strcmp(tag->name, "requirement")==0) {
construction * con = (construction *)bt->construction;
if (con!=NULL) {
const resource_type * rtype;
resource_t type = NORESOURCE;
requirement * radd = con->materials;
if (radd) {
requirement * rnew;
int size;
for (size=0;radd[size++].number;);
rnew = malloc(sizeof(requirement) * (size+2));
memcpy(rnew, radd, size*sizeof(requirement));
free(radd);
con->materials = rnew;
radd = rnew+size;
} else {
radd = con->materials = calloc(sizeof(requirement), 2);
}
radd[0].number = xml_ivalue(tag, "quantity");
rtype = rt_find(xml_value(tag, "type"));
for (type=0;type!=MAX_RESOURCES;++type) {
if (oldresourcetype[type]==rtype) {
radd[0].type = type;
break;
}
}
radd[1].number = 0;
radd[1].type = 0;
}
}
}
return XML_OK;
} }
static xml_callbacks xml_buildings = {
tagbegin, tagend, NULL
};
void void
init_buildings(void) register_buildings(void)
{ {
a_add(&bt_smithy.attribs, make_skillmod(NOSKILL, SMF_PRODUCTION, sm_smithy, 0, 0)); xml_register(&xml_buildings, "eressea building", 0);
a_add(&bt_smithy.attribs, make_matmod(mm_smithy)); register_function((pf_generic)init_smithy, "init_smithy");
register_function((pf_generic)castle_name, "castle_name");
} }
void void
@ -939,7 +543,7 @@ new_building(const struct building_type * btype, region * r, const struct locale
{ {
static char buffer[IDSIZE + 1 + NAMESIZE + 1]; static char buffer[IDSIZE + 1 + NAMESIZE + 1];
if(b->type==&bt_castle) if (b->type->name)
sprintf(buffer, "%s", locale_string(lang, btype->_name)); sprintf(buffer, "%s", locale_string(lang, btype->_name));
else else
sprintf(buffer, "%s", LOC(lang, buildingtype(b, 0))); sprintf(buffer, "%s", LOC(lang, buildingtype(b, 0)));
@ -959,7 +563,7 @@ destroy_building(building * b)
} }
b->size = 0; b->size = 0;
if (b->type == &bt_lighthouse) update_lighthouse(b); update_lighthouse(b);
bunhash(b); bunhash(b);
#if 0 /* Memoryleak. Aber ohne klappt das Rendern nicht! */ #if 0 /* Memoryleak. Aber ohne klappt das Rendern nicht! */
@ -976,17 +580,20 @@ int
buildingeffsize(const building * b, boolean img) buildingeffsize(const building * b, boolean img)
{ {
int i = b->size, n = 0; int i = b->size, n = 0;
const building_type * btype = &bt_castle; const construction * cons;
const construction * cons = btype->construction; static const struct building_type * bt_castle;
if (!bt_castle) bt_castle = bt_find("castle");
assert(bt_castle);
if (b==NULL) return 0; if (b==NULL) return 0;
if (b->type!=btype) { if (b->type!=bt_castle) {
if (img) { if (img) {
const attrib * a = a_find(b->attribs, &at_icastle); const attrib * a = a_find(b->attribs, &at_icastle);
if (!a || a->data.v != btype) return 0; if (!a || a->data.v != bt_castle) return 0;
} else return 0; } else return 0;
} }
cons = bt_castle->construction;
assert(cons); assert(cons);
while (cons && cons->maxsize != -1 && i>=cons->maxsize) { while (cons && cons->maxsize != -1 && i>=cons->maxsize) {
@ -995,10 +602,7 @@ buildingeffsize(const building * b, boolean img)
++n; ++n;
} }
if (n>0) return n;
return n;
return 0;
} }
unit * unit *
@ -1029,3 +633,64 @@ buildingowner(const region * r, const building * b)
fset(first, FL_OWNER); fset(first, FL_OWNER);
return first; return first;
} }
#ifdef BETA_CODE
void
xml_writebuildings(void)
{
FILE * F = fopen("buildings.xml", "w");
building_typelist *btl= buildingtypes;
while (btl) {
int i;
const building_type * bt = btl->type;
fprintf(F, "<building name=\"%s\"", bt->_name);
if (bt->capacity>=0) fprintf(F, " capacity=\"%d\"", bt->capacity);
if (bt->maxcapacity>=0) fprintf(F, " maxcapacity=\"%d\"", bt->maxcapacity);
if (bt->maxsize>=0) fprintf(F, " maxsize=\"%d\"", bt->maxsize);
if (bt->flags & BTF_INDESTRUCTIBLE) fputs(" nodestroy", F);
if (bt->flags & BTF_NOBUILD) fputs(" nobuild", F);
if (bt->flags & BTF_UNIQUE) fputs(" unique", F);
if (bt->flags & BTF_DECAY) fputs(" decay", F);
if (bt->flags & BTF_PROTECTION) fputs(" protection", F);
if (bt->flags & BTF_MAGIC) fputs(" magic", F);
fputs(">\n", F);
if (bt->name) {
const char * name = get_functionname((pf_generic)bt->name);
assert(name);
fprintf(F, "\t<function name=\"name\" value=\"%s\"></function>\n",
name);
}
if (bt->init) {
const char * name = get_functionname((pf_generic)bt->init);
assert(name);
fprintf(F, "\t<function name=\"init\" value=\"%s\"></function>\n",
name);
}
for (i=0;bt->maintenance && bt->maintenance[i].number;++i) {
const maintenance * m = bt->maintenance + i;
fprintf(F, "\t<maintenance type=\"%s\" amount=\"%u\"",
oldresourcetype[m->type]->_name[0], m->number);
if (m->flags & MTF_VARIABLE) fputs(" variable", F);
if (m->flags & MTF_VITAL) fputs(" vital", F);
fputs(">\n", F);
}
if (bt->construction) {
fprintf(F, "\t<construction skill=\"%s\" minskill=\"%u\" reqsize=\"%u\"",
skillname(bt->construction->skill, NULL), bt->construction->minskill,
bt->construction->reqsize);
if (bt->construction->maxsize>=0) fprintf(F, " maxsize=\"%d\"", bt->construction->maxsize);
fputs(">\n", F);
for (i=0;bt->construction->materials[i].number!=0;++i) {
fprintf(F, "\t\t<requirement type=\"%s\" quantity=\"%d\"></requirement>\n",
oldresourcetype[bt->construction->materials[i].type]->_name[0],
bt->construction->materials[i].number);
}
fputs("\t</construction>\n", F);
}
fputs("</building>\n\n", F);
btl=btl->next;
}
fclose(F);
}
#endif

View File

@ -32,24 +32,31 @@ typedef struct maintenance {
#define BTF_UNIQUE 0x04 /* only one per struct region (harbour) */ #define BTF_UNIQUE 0x04 /* only one per struct region (harbour) */
#define BTF_DECAY 0x08 /* decays when not occupied */ #define BTF_DECAY 0x08 /* decays when not occupied */
#define BTF_DYNAMIC 0x10 /* dynamic type, needs bt_write */ #define BTF_DYNAMIC 0x10 /* dynamic type, needs bt_write */
#define BTF_PROTECTION 0x20 /* protection in combat */
#define BTF_MAGIC 0x40 /* magical effect */
typedef struct building_type { typedef struct building_type {
const char * _name; const char * _name;
int flags; /* flags */ int flags; /* flags */
int capacity; /* Kapazität pro Größenpunkt */ int capacity; /* Kapazität pro Größenpunkt */
int maxcapacity; /* Max. Kapazität */ int maxcapacity; /* Max. Kapazität */
int maxsize; /* how big can it get, with all the extensions? */ int maxsize; /* how big can it get, with all the extensions? */
int magres; /* how well it resists against spells */
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 */ const struct maintenance * maintenance; /* array of requirements */
const struct construction * construction; /* construction of 1 building-level */ const struct construction * construction; /* construction of 1 building-level */
const char * (*name)(int size); const char * (*name)(int size);
void (*init)(struct building_type*);
struct attrib * attribs; struct attrib * attribs;
} building_type; } building_type;
extern const building_type * bt_find(const char* name); extern const building_type * bt_find(const char* name);
extern void bt_register(const building_type * type); extern void bt_register(building_type * type);
extern void init_buildings(void); extern void register_buildings(void);
typedef struct building_typelist { typedef struct building_typelist {
struct building_typelist * next; struct building_typelist * next;
@ -99,26 +106,6 @@ void build_building(struct unit * u, const struct building_type * typ, int size)
/* Alte Gebäudetypen: */ /* Alte Gebäudetypen: */
extern struct building_type bt_castle;
extern struct building_type bt_lighthouse;
extern struct building_type bt_mine;
extern struct building_type bt_quarry;
extern struct building_type bt_harbour;
extern struct building_type bt_academy;
extern struct building_type bt_magictower;
extern struct building_type bt_smithy;
extern struct building_type bt_sawmill;
extern struct building_type bt_stables;
extern struct building_type bt_monument;
extern struct building_type bt_dam;
extern struct building_type bt_caravan;
extern struct building_type bt_tunnel;
extern struct building_type bt_inn;
extern struct building_type bt_stonecircle;
extern struct building_type bt_blessedstonecircle;
extern struct building_type bt_illusion;
extern struct building_type bt_generic;
/* old functions, still in build.c: */ /* old functions, still in build.c: */
int buildingeffsize(const building * b, boolean img); int buildingeffsize(const building * b, boolean img);
void bhash(struct building * b); void bhash(struct building * b);
@ -133,7 +120,6 @@ extern void bt_write(FILE * F, const building_type * bt);
extern struct building_type * bt_make(const char * name, int flags, int capacity, int maxcapacity, int maxsize); extern struct building_type * bt_make(const char * name, int flags, int capacity, int maxcapacity, int maxsize);
#include "build.h" #include "build.h"
extern const struct building_type * oldbuildings[MAXBUILDINGTYPES];
#define NOBUILDING NULL #define NOBUILDING NULL
extern void * resolve_building(void * data); extern void * resolve_building(void * data);

View File

@ -971,6 +971,11 @@ update_lighthouse(building * lh)
region * r = lh->region; region * r = lh->region;
int d = (int)log10(lh->size) + 1; int d = (int)log10(lh->size) + 1;
int x, y; int x, y;
static const struct building_type * bt_lighthouse;
if (!bt_lighthouse) bt_lighthouse = bt_find("lighthouse");
assert(bt_lighthouse);
if (lh->type!=bt_lighthouse) return;
for (x=-d;x<=d;++x) { for (x=-d;x<=d;++x) {
for (y=-d;y<=d;++y) { for (y=-d;y<=d;++y) {
@ -1490,8 +1495,9 @@ buildingname (const building * b)
building * building *
largestbuilding (const region * r, boolean img) largestbuilding (const region * r, boolean img)
{ {
const building_type * btype = &bt_castle; /* TODO: parameter der funktion? */ static const building_type * btype = NULL;
building *b, *best = NULL; building *b, *best = NULL;
if (!btype) btype = bt_find("castle"); /* TODO: parameter der funktion? */
/* durch die verw. von '>' statt '>=' werden die aelteren burgen /* durch die verw. von '>' statt '>=' werden die aelteren burgen
* bevorzugt. */ * bevorzugt. */
@ -1720,7 +1726,7 @@ check_leuchtturm(region * r, faction * f)
building *b = (building *)a->data.v; building *b = (building *)a->data.v;
region *r2 = b->region; region *r2 = b->region;
assert(b->type == &bt_lighthouse); assert(b->type == bt_find("lighthouse"));
if (fval(b, BLD_WORKING) && b->size >= 10) { if (fval(b, BLD_WORKING) && b->size >= 10) {
int c = 0; int c = 0;
unit *u; unit *u;
@ -2174,41 +2180,6 @@ attrib_type at_germs = {
void void
attrib_init(void) attrib_init(void)
{ {
/* Gebäudetypen registrieren */
init_buildings();
bt_register(&bt_castle);
bt_register(&bt_lighthouse);
bt_register(&bt_mine);
bt_register(&bt_quarry);
bt_register(&bt_harbour);
bt_register(&bt_academy);
bt_register(&bt_magictower);
bt_register(&bt_smithy);
bt_register(&bt_sawmill);
bt_register(&bt_stables);
bt_register(&bt_monument);
bt_register(&bt_dam);
bt_register(&bt_caravan);
bt_register(&bt_tunnel);
bt_register(&bt_inn);
bt_register(&bt_stonecircle);
bt_register(&bt_blessedstonecircle);
bt_register(&bt_illusion);
bt_register(&bt_generic);
bt_register(&bt_caldera);
#ifdef NOXMLBOATS
/* Schiffstypen registrieren: */
st_register(&st_boat);
st_register(&st_balloon);
st_register(&st_longboat);
st_register(&st_dragonship);
st_register(&st_caravelle);
st_register(&st_trireme);
#endif
/* disable: st_register(&st_transport); */
/* Alle speicherbaren Attribute müssen hier registriert werden */ /* Alle speicherbaren Attribute müssen hier registriert werden */
at_register(&at_unitdissolve); at_register(&at_unitdissolve);
at_register(&at_traveldir_new); at_register(&at_traveldir_new);

View File

@ -65,7 +65,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # 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 "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "BETA_CODE" /FR /YX"stdafx.h" /FD /c # ADD CPP /nologo /Za /W4 /Z7 /Od /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x407 # ADD BASE RSC /l 0x407
# ADD RSC /l 0x407 # ADD RSC /l 0x407
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -144,16 +144,11 @@ a_readicastle(attrib * a, FILE * f)
{ {
icastle_data * data = (icastle_data*)a->data.v; icastle_data * data = (icastle_data*)a->data.v;
if (global.data_version<TYPES_VERSION) { if (global.data_version<TYPES_VERSION) {
union {
int i;
short sa[2];
} old;
int t; int t;
fscanf(f, "%d", &old.i); fscanf(f, "%d", &t);
data->time = old.sa[1]; data->time = 0;
t = old.sa[0]; data->type = NULL;
if (t<0 || t >= MAXBUILDINGS) t = 0; return 0; /* no longer supported */
data->type = oldbuildings[t];
} else { } else {
int bno; int bno;
fscanf(f, "%s %d %d", buf, &bno, &data->time); fscanf(f, "%s %d %d", buf, &bno, &data->time);
@ -163,8 +158,8 @@ a_readicastle(attrib * a, FILE * f)
ur_add((void*)bno, (void**)&data->building, resolve_building); ur_add((void*)bno, (void**)&data->building, resolve_building);
} }
data->type = bt_find(buf); data->type = bt_find(buf);
return 1;
} }
return 1;
} }
static void static void
@ -1139,16 +1134,9 @@ spellpower(region * r, unit * u, spell * sp, int cast_level)
/* Bonus durch Magieturm und gesegneten Steinkreis */ /* Bonus durch Magieturm und gesegneten Steinkreis */
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype == &bt_magictower) { if (btype && btype->flags & BTF_MAGIC) ++force;
force++;
} else
if (btype == &bt_blessedstonecircle){
force++;
}
}
if (get_item(u, I_RING_OF_POWER) > 0) {
force++;
} }
if (get_item(u, I_RING_OF_POWER) > 0) ++force;
/* Antimagie in der Zielregion */ /* Antimagie in der Zielregion */
if (is_spell_active(r, C_ANTIMAGICZONE)) { if (is_spell_active(r, C_ANTIMAGICZONE)) {
@ -1272,10 +1260,9 @@ magic_resistance(unit *target)
{ {
struct building * b = inside_building(target); struct building * b = inside_building(target);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
/* gesegneter Steinkreis gibt 30% dazu */ /* gesegneter Steinkreis gibt 30% dazu */
if (btype == &bt_blessedstonecircle){ if (btype) chance += btype->magresbonus;
chance += 30;
}
} }
return chance; return chance;
} }
@ -1333,10 +1320,7 @@ target_resists_magic(unit *magician, void *obj, int objtyp, int t_bonus)
chance += get_curseeffect(((building *)obj)->attribs, C_RESIST_MAGIC, 0); chance += get_curseeffect(((building *)obj)->attribs, C_RESIST_MAGIC, 0);
/* Bonus durch Typ */ /* Bonus durch Typ */
if (((building *)obj)->type == &bt_magictower) chance += ((building *)obj)->type->magres;
chance += 40;
if (((building *)obj)->type == &bt_blessedstonecircle)
chance += 60;
break; break;
@ -1397,9 +1381,7 @@ fumble(region * r, unit * u, spell * sp, int cast_grade)
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype==&bt_magictower) { if (btype) patzer -= btype->fumblebonus;
patzer -= 10;
}
/* CHAOSPATZERCHANCE 10 : +10% Chance zu Patzern */ /* CHAOSPATZERCHANCE 10 : +10% Chance zu Patzern */
if (sp->magietyp == M_CHAOS) { if (sp->magietyp == M_CHAOS) {
patzer += CHAOSPATZERCHANCE; patzer += CHAOSPATZERCHANCE;
@ -1568,13 +1550,7 @@ regeneration_magiepunkte(void)
reg_aura = (double)regeneration(u); reg_aura = (double)regeneration(u);
/* Magierturm erhöht die Regeneration um 75% */ /* Magierturm erhöht die Regeneration um 75% */
if (btype == &bt_magictower) { if (btype) reg_aura*=btype->auraregen;
reg_aura *= 1.75;
}
/* gesegnerter Steinkreis erhöht die Regeneration um 50% */
if (btype == &bt_blessedstonecircle) {
reg_aura *= 1.50;
}
/* Bonus/Malus durch Zauber */ /* Bonus/Malus durch Zauber */
n = get_curseeffect(u->attribs, C_AURA, 0); n = get_curseeffect(u->attribs, C_AURA, 0);

View File

@ -1323,7 +1323,7 @@ check_takeoff(ship *sh, region *from, region *to)
coastl = (direction_t)((coast+MAXDIRECTIONS-1) % MAXDIRECTIONS); coastl = (direction_t)((coast+MAXDIRECTIONS-1) % MAXDIRECTIONS);
if(dir != coast && dir != coastl && dir != coastr if(dir != coast && dir != coastl && dir != coastr
&& check_working_buildingtype(from, &bt_harbour) == false) && check_working_buildingtype(from, bt_find("harbour")) == false)
{ {
return false; return false;
} }
@ -1336,7 +1336,7 @@ boolean
ship_allowed(const struct ship_type * type, region * r) ship_allowed(const struct ship_type * type, region * r)
{ {
int c = 0; int c = 0;
if (check_working_buildingtype(r, &bt_harbour)) return true; if (check_working_buildingtype(r, bt_find("harbour"))) return true;
for (c=0;type->coast[c]!=NOTERRAIN;++c) { for (c=0;type->coast[c]!=NOTERRAIN;++c) {
if (type->coast[c]==rterrain(r)) return true; if (type->coast[c]==rterrain(r)) return true;
} }
@ -1606,7 +1606,7 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
/* Hafengebühren ? */ /* Hafengebühren ? */
hafenmeister = owner_buildingtyp(current_point, &bt_harbour); hafenmeister = owner_buildingtyp(current_point, bt_find("harbour"));
if (sh && hafenmeister != NULL) { if (sh && hafenmeister != NULL) {
item * itm; item * itm;
assert(trans==NULL); assert(trans==NULL);

View File

@ -223,7 +223,7 @@ give_starting_equipment(struct region *r, struct unit *u)
break; break;
case RC_HUMAN: case RC_HUMAN:
{ {
building *b = new_building(&bt_castle, r, u->faction->locale); building *b = new_building(bt_find("castle"), r, u->faction->locale);
b->size = 10; b->size = 10;
u->building = b; u->building = b;
fset(u, FL_OWNER); fset(u, FL_OWNER);

View File

@ -937,8 +937,8 @@ readgame(boolean backup)
rds(F, &b->display); rds(F, &b->display);
b->size = ri(F); b->size = ri(F);
if (global.data_version < TYPES_VERSION) { if (global.data_version < TYPES_VERSION) {
int i = ri(F); assert(!"data format is no longer supported");
b->type = oldbuildings[i]; /* b->type = oldbuildings[ri(F)]; */
} }
else { else {
rs(F, buf); rs(F, buf);
@ -966,13 +966,7 @@ readgame(boolean backup)
rds(F, &sh->display); rds(F, &sh->display);
if (global.data_version < SHIPTYPE_VERSION) { if (global.data_version < SHIPTYPE_VERSION) {
#ifdef NOXMLBOATS
const ship_type * oldship[] = { &st_boat, &st_balloon, &st_longboat, &st_dragonship, &st_caravelle, &st_trireme };
int i = ri(F);
sh->type = oldship[i];
#else
assert(!"cannot read old datafile with xml ship support"); assert(!"cannot read old datafile with xml ship support");
#endif
} }
else { else {
rs(F, buf); rs(F, buf);
@ -1080,9 +1074,7 @@ readgame(boolean backup)
for (r=regions;r;r=r->next) { for (r=regions;r;r=r->next) {
building * b; building * b;
for (b=r->buildings;b;b=b->next) { for (b=r->buildings;b;b=b->next) update_lighthouse(b);
if (b->type==&bt_lighthouse) update_lighthouse(b);
}
} }
printf(" - Regionen initialisieren & verbinden...\n"); printf(" - Regionen initialisieren & verbinden...\n");
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {

View File

@ -147,126 +147,6 @@ captain(ship *sh, region *r)
/* Alte Schiffstypen: */ /* Alte Schiffstypen: */
#ifdef NOXMLBOATS
static const terrain_t coast_large[] = {
T_OCEAN, T_PLAIN, NOTERRAIN
};
static terrain_t coast_small[] = {
T_OCEAN, T_PLAIN, T_SWAMP, T_DESERT, T_HIGHLAND, T_MOUNTAIN, T_GLACIER,
T_GRASSLAND, T_VOLCANO, T_VOLCANO_SMOKING, T_ICEBERG_SLEEP, T_ICEBERG,
NOTERRAIN
};
static requirement boat_req[] = {
{I_WOOD, 1},
{0, 0}
};
static const construction boat_bld = {
SK_SHIPBUILDING, 1,
5, 1, boat_req,
NULL
};
const ship_type st_boat = {
{ "Boot", "ein Boot" }, 2,
SFL_OPENSEA, 0, 1.00, 1.00,
5, 50*100,
1, 1, 2, coast_small,
&boat_bld
};
static requirement balloon_req[] = {
{0, 0}
};
static const construction balloon_bld = {
SK_SHIPBUILDING, 100,
5, 1, balloon_req,
NULL
};
const ship_type st_balloon = {
{ "Ballon", "ein Ballon" }, 2,
SFL_OPENSEA|SFL_FLY, 0, 1.00, 1.00,
5, 50*100,
6, 6, 6, coast_small,
&balloon_bld
};
static requirement longboat_req[] = {
{I_WOOD, 1},
{0, 0}
};
static const construction longboat_bld = {
SK_SHIPBUILDING, 1,
50, 1, longboat_req,
NULL
};
const ship_type st_longboat = {
{ "Langboot", "ein Langboot" }, 3,
SFL_OPENSEA, 0, 1.00, 1.00,
50, 500*100,
1, 1, 10, coast_large,
&longboat_bld
};
static requirement dragonship_req[] = {
{I_WOOD, 1},
{0, 0}
};
static const construction dragonship_bld = {
SK_SHIPBUILDING, 2,
100, 1, dragonship_req,
NULL
};
const ship_type st_dragonship = {
{ "Drachenschiff", "ein Drachenschiff" }, 5,
SFL_OPENSEA, 0, 1.00, 1.00,
100, 1000*100,
2, 1, 50, coast_large,
&dragonship_bld
};
static requirement caravelle_req[] = {
{I_WOOD, 1},
{0, 0}
};
static const construction caravelle_bld = {
SK_SHIPBUILDING, 3,
250, 1, caravelle_req,
NULL
};
const ship_type st_caravelle = {
{ "Karavelle", "eine Karavelle" }, 5,
SFL_OPENSEA, 0, 1.00, 1.00,
300, 3000*100,
3, 1, 30, coast_large,
&caravelle_bld
};
static requirement trireme_req[] = {
{I_WOOD, 1},
{0, 0}
};
static const construction trireme_bld = {
SK_SHIPBUILDING, 4,
200, 1, trireme_req,
NULL
};
const ship_type st_trireme = {
{ "Trireme", "eine Trireme" }, 7,
SFL_OPENSEA, 0, 1.00, 1.00,
200, 2000*100,
4, 1, 120, coast_large,
&trireme_bld
};
#endif
ship * ship *
new_ship(const ship_type * stype, region * r) new_ship(const ship_type * stype, region * r)
@ -342,40 +222,6 @@ shipowner(const region * r, const ship * sh)
return first; return first;
} }
#ifdef NOXMLBOATS
void
xml_writeships(void)
{
FILE * F = fopen("ships.xml", "w");
ship_typelist *stl= shiptypes;
while (stl) {
int i;
const ship_type * st = stl->type;
fprintf(F, "<ship name=\"%s\" range=\"%u\" storm=\"%.2f\" damage=\"%.2f\" cabins=\"%u\" cargo=\"%u\" cptskill=\"%u\" minskill=\"%u\" sumskill=\"%u\"",
locale_string(find_locale("en"), st->name[0]), st->range, st->storm, st->damage, st->cabins, st->cargo,
st->cptskill, st->minskill, st->sumskill);
if (st->flags & SFL_OPENSEA) fputs(" opensea", F);
if (st->flags & SFL_FLY) fputs(" fly", F);
fputs(">\n", F);
for (i=0;st->coast[i]!=NOTERRAIN;++i) {
fprintf(F, "\t<coast terrain=\"%s\"></coast>\n", terrain[st->coast[i]].name);
}
fprintf(F, "\t<construction skill=\"%s\" minskill=\"%u\" maxsize=\"%u\" reqsize=\"%u\">\n",
skillname(st->construction->skill, NULL), st->construction->minskill,
st->construction->maxsize, st->construction->reqsize);
for (i=0;st->construction->materials[i].number!=0;++i) {
fprintf(F, "\t\t<requirement type=\"%s\" quantity=\"%d\"></requirement>\n",
oldresourcetype[st->construction->materials[i].type]->_name[0],
st->construction->materials[i].number);
}
fputs("\t</construction>\n", F);
fputs("</ship>\n\n", F);
stl=stl->next;
}
fclose(F);
}
#endif
static int static int
tagend(struct xml_stack * stack) tagend(struct xml_stack * stack)
{ {
@ -483,8 +329,6 @@ static xml_callbacks xml_ships = {
void void
register_ships(void) register_ships(void)
{ {
#ifndef NOXMLBOATS
xml_register(&xml_ships, "eressea ship", 0); xml_register(&xml_ships, "eressea ship", 0);
#endif
} }

View File

@ -53,15 +53,6 @@ typedef struct ship_typelist {
extern ship_typelist *shiptypes; extern ship_typelist *shiptypes;
/* Alte Schiffstypen: */ /* Alte Schiffstypen: */
#ifdef NOXMLBOATS
extern const ship_type st_boat;
extern const ship_type st_balloon;
extern const ship_type st_longboat;
extern const ship_type st_dragonship;
extern const ship_type st_caravelle;
extern const ship_type st_trireme;
extern const ship_type st_transport;
#endif
extern const ship_type * st_find(const char* name); extern const ship_type * st_find(const char* name);
extern void st_register(const ship_type * type); extern void st_register(const ship_type * type);

View File

@ -987,7 +987,7 @@ sp_blessstonecircle(castorder *co)
b = p->param[0]->data.b; b = p->param[0]->data.b;
if(b->type != &bt_stonecircle) { if(b->type != bt_find("stonecircle")) {
sprintf(buf, "%s in %s: 'ZAUBER \"%s\"': %s ist kein Steinkreis.", sprintf(buf, "%s in %s: 'ZAUBER \"%s\"': %s ist kein Steinkreis.",
unitname(mage), regionid(mage->region), co->order, buildingname(b)); unitname(mage), regionid(mage->region), co->order, buildingname(b));
addmessage(0, mage->faction, buf, MSG_MAGIC, ML_MISTAKE); addmessage(0, mage->faction, buf, MSG_MAGIC, ML_MISTAKE);
@ -1002,7 +1002,7 @@ sp_blessstonecircle(castorder *co)
return 0; return 0;
} }
b->type = &bt_blessedstonecircle; b->type = bt_find("blessedstonecircle");
sprintf(buf, "%s weiht %s.", unitname(mage), buildingname(b)); sprintf(buf, "%s weiht %s.", unitname(mage), buildingname(b));
addmessage(r, 0, buf, MSG_MAGIC, ML_INFO); addmessage(r, 0, buf, MSG_MAGIC, ML_INFO);
@ -2052,7 +2052,7 @@ sp_homestone(castorder *co)
int cast_level = co->level; int cast_level = co->level;
int force = co->force; int force = co->force;
if(!mage->building || mage->building->type != &bt_castle){ if(!mage->building || mage->building->type != bt_find("castle")){
cmistake(mage, strdup(co->order), 197, MSG_MAGIC); cmistake(mage, strdup(co->order), 197, MSG_MAGIC);
return 0; return 0;
} }
@ -4908,13 +4908,13 @@ sp_icastle(castorder *co)
icastle_data * data; icastle_data * data;
if((type=bt_find(pa->param[0]->data.s)) == NOBUILDING) { if((type=bt_find(pa->param[0]->data.s)) == NOBUILDING) {
type = &bt_castle; type = bt_find("castle");
} }
b = new_building(&bt_illusion, r, mage->faction->locale); b = new_building(bt_find("illusion"), r, mage->faction->locale);
/* Größe festlegen. */ /* Größe festlegen. */
if(type == &bt_illusion) { if(type == bt_find("illusion")) {
b->size = (rand()%(power*power)+1)*10; b->size = (rand()%(power*power)+1)*10;
} else if (b->type->maxsize == -1) { } else if (b->type->maxsize == -1) {
b->size = ((rand()%power)+1)*5; b->size = ((rand()%power)+1)*5;
@ -6453,7 +6453,7 @@ sp_movecastle(castorder *co)
"erheben das Gebäude und tragen es in Richtung %s.", "erheben das Gebäude und tragen es in Richtung %s.",
buildingname(b), locale_string(mage->faction->locale, directions[dir])); buildingname(b), locale_string(mage->faction->locale, directions[dir]));
if((b->type==&bt_caravan || b->type==&bt_dam || b->type==&bt_tunnel)) { if((b->type==bt_find("caravan") || b->type==bt_find("dam") || b->type==bt_find("tunnel"))) {
boolean damage = false; boolean damage = false;
direction_t d; direction_t d;
for (d=0;d!=MAXDIRECTIONS;++d) { for (d=0;d!=MAXDIRECTIONS;++d) {

View File

@ -309,7 +309,7 @@ tower_init(void)
start_region[i] = findregion(arena_center->x+delta_x[i]*2, arena_center->y+delta_y[i]*2); start_region[i] = findregion(arena_center->x+delta_x[i]*2, arena_center->y+delta_y[i]*2);
if (r->terrain!=T_DESERT) terraform(r, T_DESERT); if (r->terrain!=T_DESERT) terraform(r, T_DESERT);
if (!r->buildings) { if (!r->buildings) {
building * b = new_building(&bt_castle, r, NULL); building * b = new_building(bt_find("castle"), r, NULL);
b->size = 10; b->size = 10;
if (i!=0) sprintf(buf, "Turm des %s", neue_gebiete[i]); if (i!=0) sprintf(buf, "Turm des %s", neue_gebiete[i]);
else sprintf(buf, "Turm der Ahnungslosen"); else sprintf(buf, "Turm der Ahnungslosen");
@ -318,7 +318,7 @@ tower_init(void)
} }
} }
if (first && !arena_center->buildings) { if (first && !arena_center->buildings) {
building * b = new_building(&bt_castle, arena_center, NULL); building * b = new_building(bt_find("castle"), arena_center, NULL);
attrib * a; attrib * a;
item * items; item * items;
@ -389,15 +389,6 @@ block_create(int x1, int y1, char terrain)
} }
#ifdef CENTRAL_VOLCANO #ifdef CENTRAL_VOLCANO
building_type bt_caldera = {
"caldera", /* _name */
BTF_NOBUILD|BTF_INDESTRUCTIBLE, /* flags */
1, -1, -1, /* capac, maxcap, maxsize */
NULL, /* maintenance */
NULL, /* construction */
NULL /* name() */
};
static int static int
caldera_handle(trigger * t, void * data) caldera_handle(trigger * t, void * data)
@ -483,7 +474,7 @@ init_volcano(void)
assert(arena_center); assert(arena_center);
if (r->terrain!=T_DESERT) return; /* been done before */ if (r->terrain!=T_DESERT) return; /* been done before */
terraform(arena_center, T_VOLCANO_SMOKING); terraform(arena_center, T_VOLCANO_SMOKING);
b = new_building(&bt_caldera, r, NULL); b = new_building(bt_find("caldera"), r, NULL);
b->size = 1; b->size = 1;
b->name = strdup("Igjarjuk's Schlund"); b->name = strdup("Igjarjuk's Schlund");
b->display = strdup("Feurige Lava fließt aus dem Krater des großen Vulkans. Alles wird von ihr verschlungen."); b->display = strdup("Feurige Lava fließt aus dem Krater des großen Vulkans. Alles wird von ihr verschlungen.");

View File

@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # 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 "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "BETA_CODE" /FR /YX"stdafx.h" /FD /c # ADD CPP /nologo /Za /W4 /Z7 /Od /I "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x407 # ADD BASE RSC /l 0x407
# ADD RSC /l 0x407 # ADD RSC /l 0x407
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -262,27 +262,28 @@ create_museum(void)
r = findregion(9526, 9525); r = findregion(9526, 9525);
if(!r->buildings) { if(!r->buildings) {
b = new_building(&bt_generic, r, NULL); const building_type * bt_generic = bt_find("generic");
b = new_building(bt_generic, r, NULL);
set_string(&b->name, "Séparée im dämonischen Stil"); set_string(&b->name, "Séparée im dämonischen Stil");
set_string(&b->display, "Diese ganz im dämonischen Stil gehaltene Sitzgruppe ist ganz in dunklen Schwarztönen gehalten. Muster fremdartiger Runen bedecken das merkwürdig geformte Mobiliar, das unangenehm lebendig wirkt."); set_string(&b->display, "Diese ganz im dämonischen Stil gehaltene Sitzgruppe ist ganz in dunklen Schwarztönen gehalten. Muster fremdartiger Runen bedecken das merkwürdig geformte Mobiliar, das unangenehm lebendig wirkt.");
b = new_building(&bt_generic, r, NULL); b = new_building(bt_generic, r, NULL);
set_string(&b->name, "Séparée im elfischen Stil"); set_string(&b->name, "Séparée im elfischen Stil");
set_string(&b->display, "Ganz in Grün- und Brauntönen gehalten wirkt die Sitzgruppe fast lebendig. Bei näherer Betrachtung erschließt sich dem Betrachter, daß sie tatsächlich aus lebenden Pflanzen erstellt ist. So ist der Tisch aus einem eizigen Baum gewachsen, und die Polster bestehen aus weichen Grassoden. Ein wunderschön gemusterter Webteppich mit tausenden naturgetreu eingestickter Blumensarten bedeckt den Boden."); set_string(&b->display, "Ganz in Grün- und Brauntönen gehalten wirkt die Sitzgruppe fast lebendig. Bei näherer Betrachtung erschließt sich dem Betrachter, daß sie tatsächlich aus lebenden Pflanzen erstellt ist. So ist der Tisch aus einem eizigen Baum gewachsen, und die Polster bestehen aus weichen Grassoden. Ein wunderschön gemusterter Webteppich mit tausenden naturgetreu eingestickter Blumensarten bedeckt den Boden.");
b = new_building(&bt_generic, r, NULL); b = new_building(bt_generic, r, NULL);
set_string(&b->name, "Séparée im halblingschen Stil"); set_string(&b->name, "Séparée im halblingschen Stil");
set_string(&b->display, "Dieses rustikale Mobiliar ist aus einem einzigen, gewaltigen Baum hergestellt worden. Den Stamm haben fleißige Halblinge der Länge nach gevierteilt und aus den vier langen Viertelstämmen die Sitzbänke geschnitzt, während der verbleibende Stumpf als Tisch dient. Schon von weitem steigen dem Besucher die Gerüche der Köstlichkeiten entgegen, die auf dem Tisch stapeln."); set_string(&b->display, "Dieses rustikale Mobiliar ist aus einem einzigen, gewaltigen Baum hergestellt worden. Den Stamm haben fleißige Halblinge der Länge nach gevierteilt und aus den vier langen Viertelstämmen die Sitzbänke geschnitzt, während der verbleibende Stumpf als Tisch dient. Schon von weitem steigen dem Besucher die Gerüche der Köstlichkeiten entgegen, die auf dem Tisch stapeln.");
b = new_building(&bt_generic, r, NULL); b = new_building(bt_generic, r, NULL);
set_string(&b->name, "Séparée im orkischen Stil"); set_string(&b->name, "Séparée im orkischen Stil");
set_string(&b->display, "Grobgeschreinerte, elfenhautbespannte Stühle und ein Tisch aus Knochen, über deren Herkunft man sich lieber keine Gedanken macht, bilden die Sitzgruppe im orkischen Stil. Überall haben Orks ihre Namen, und anderes wenig zitierenswertes in das Holz und Gebein geritzt."); set_string(&b->display, "Grobgeschreinerte, elfenhautbespannte Stühle und ein Tisch aus Knochen, über deren Herkunft man sich lieber keine Gedanken macht, bilden die Sitzgruppe im orkischen Stil. Überall haben Orks ihre Namen, und anderes wenig zitierenswertes in das Holz und Gebein geritzt.");
b = new_building(&bt_generic, r, NULL); b = new_building(bt_generic, r, NULL);
set_string(&b->name, "Séparée im Meermenschenstil"); set_string(&b->name, "Séparée im Meermenschenstil");
set_string(&b->display, "Ganz in Blau- und Grüntönen gehalten, mit Algen und Muscheln verziert wirken die aus altem Meerholz geschnitzten Stühle immer ein wenig feucht. Seltsammerweise hat der schwere aus alten Planken gezimmerte Tisch einen Mast mit kompletten Segel in der Mitte."); set_string(&b->display, "Ganz in Blau- und Grüntönen gehalten, mit Algen und Muscheln verziert wirken die aus altem Meerholz geschnitzten Stühle immer ein wenig feucht. Seltsammerweise hat der schwere aus alten Planken gezimmerte Tisch einen Mast mit kompletten Segel in der Mitte.");
b = new_building(&bt_generic, r, NULL); b = new_building(bt_generic, r, NULL);
set_string(&b->name, "Séparée im Katzenstil"); set_string(&b->name, "Séparée im Katzenstil");
set_string(&b->display, "Die Wände dieses Séparée sind aus dunklem Holz. Was aus der Ferne wie ein chaotisch durchbrochenes Flechtwerk wirkt, entpuppt sich bei näherer Betrachtung als eine bis in winzige Details gestaltete dschungelartige Landschaft, in die eine Vielzahl von kleinen Bildergeschichten eingewoben sind. Wie es scheint hat sich der Künstler Mühe gegeben wirklich jedes Katzenvolk Eresseas zu porträtieren. Das schummrige Innere wird von einem Kamin dominiert, vor dem einige Sessel und weiche Kissen zu einem gemütlichen Nickerchen einladen. Feiner Anduner Sisal bezieht die Lehnen der Sessel und verlockt dazu, seine Krallen hinein zu versenken. Auf einem kleinen Ecktisch steht ein großer Korb mit roten Wollknäulen und grauen und braunen Spielmäusen."); set_string(&b->display, "Die Wände dieses Séparée sind aus dunklem Holz. Was aus der Ferne wie ein chaotisch durchbrochenes Flechtwerk wirkt, entpuppt sich bei näherer Betrachtung als eine bis in winzige Details gestaltete dschungelartige Landschaft, in die eine Vielzahl von kleinen Bildergeschichten eingewoben sind. Wie es scheint hat sich der Künstler Mühe gegeben wirklich jedes Katzenvolk Eresseas zu porträtieren. Das schummrige Innere wird von einem Kamin dominiert, vor dem einige Sessel und weiche Kissen zu einem gemütlichen Nickerchen einladen. Feiner Anduner Sisal bezieht die Lehnen der Sessel und verlockt dazu, seine Krallen hinein zu versenken. Auf einem kleinen Ecktisch steht ein großer Korb mit roten Wollknäulen und grauen und braunen Spielmäusen.");
} else { } else {

View File

@ -7,19 +7,19 @@
CFG=races - Win32 Debug CFG=races - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "races-6.mak". !MESSAGE NMAKE /f "races.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "races-6.mak" CFG="races - Win32 Debug" !MESSAGE NMAKE /f "races.mak" CFG="races - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "races - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "races - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "races - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE "races - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE !MESSAGE
# Begin Project # Begin Project
# PROP AllowPerConfigDependencies 0 # PROP AllowPerConfigDependencies 0
@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # 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 "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "BETA_CODE" /FR /YX"stdafx.h" /FD /c # ADD CPP /nologo /Za /W4 /Z7 /Od /I "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x407 # ADD BASE RSC /l 0x407
# ADD RSC /l 0x407 # ADD RSC /l 0x407
BSC32=bscmake.exe BSC32=bscmake.exe
@ -72,9 +72,9 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"Debug\races.lib" # ADD LIB32 /nologo
!ENDIF !ENDIF
# Begin Target # Begin Target

View File

@ -7,19 +7,19 @@
CFG=spells - Win32 Debug CFG=spells - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "spells-6.mak". !MESSAGE NMAKE /f "spells.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "spells-6.mak" CFG="spells - Win32 Debug" !MESSAGE NMAKE /f "spells.mak" CFG="spells - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "spells - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "spells - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "spells - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE "spells - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE !MESSAGE
# Begin Project # Begin Project
# PROP AllowPerConfigDependencies 0 # PROP AllowPerConfigDependencies 0
@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # 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 "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "BETA_CODE" /FR /YX"stdafx.h" /FD /c # ADD CPP /nologo /Za /W4 /Z7 /Od /I "../kernel" /I "../util" /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x407 # ADD BASE RSC /l 0x407
# ADD RSC /l 0x407 # ADD RSC /l 0x407
BSC32=bscmake.exe BSC32=bscmake.exe
@ -72,9 +72,9 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"Debug\spells.lib" # ADD LIB32 /nologo
!ENDIF !ENDIF
# Begin Target # Begin Target

View File

@ -8,12 +8,12 @@ CFG=triggers - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "triggers-6.mak". !MESSAGE NMAKE /f "triggers.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "triggers-6.mak" CFG="triggers - Win32 Debug" !MESSAGE NMAKE /f "triggers.mak" CFG="triggers - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # 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" /D "BETA_CODE" /FR /YX"stdafx.h" /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 BASE RSC /l 0x407
# ADD RSC /l 0x407 # ADD RSC /l 0x407
BSC32=bscmake.exe BSC32=bscmake.exe
@ -72,7 +72,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"Debug\triggers.lib" # ADD LIB32 /nologo
!ENDIF !ENDIF

View File

@ -8,12 +8,12 @@ CFG=util - Win32 Profile
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "util-6.mak". !MESSAGE NMAKE /f "util.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "util-6.mak" CFG="util - Win32 Profile" !MESSAGE NMAKE /f "util.mak" CFG="util - Win32 Profile"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
@ -65,7 +65,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # 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 "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "BETA_CODE" /FR /YX"stdafx.h" /FD /c # ADD CPP /nologo /Za /W4 /Z7 /Od /I "../.." /I ".." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x407 # ADD BASE RSC /l 0x407
# ADD RSC /l 0x407 # ADD RSC /l 0x407
BSC32=bscmake.exe BSC32=bscmake.exe
@ -73,7 +73,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"Debug\util.lib" # ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "util - Win32 Profile" !ELSEIF "$(CFG)" == "util - Win32 Profile"

View File

@ -67,7 +67,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /Za /W4 /Gm /ZI /Od /I "../common/kernel" /I "../common/gamecode" /I "../common/util" /I "../common" /I ".." /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /D "BETA_CODE" /FR /YX"stdafx.h" /FD /c # ADD CPP /nologo /Za /W4 /Gm /ZI /Od /I "../common/kernel" /I "../common/gamecode" /I "../common/util" /I "../common" /I ".." /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /FR /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x407 /d "_DEBUG" # ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG" # ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -1108,19 +1108,19 @@ fix_icastles(void)
building * b; building * b;
for (b=r->buildings; b; b=b->next) { for (b=r->buildings; b; b=b->next) {
attrib * a; attrib * a;
const building_type * btype = &bt_castle; const building_type * btype = bt_find("castle");
icastle_data * data; icastle_data * data;
a = a_find(b->attribs, &at_icastle); a = a_find(b->attribs, &at_icastle);
if (b->type!=&bt_illusion && !a) continue; if (b->type!=bt_find("illusion") && !a) continue;
if (!a) { if (!a) {
/* attribut hat gefehle */ /* attribut hat gefehle */
a = a_add(&b->attribs, a_new(&at_icastle)); a = a_add(&b->attribs, a_new(&at_icastle));
} }
if (b->type!=&bt_illusion) { if (b->type!=bt_find("illusion")) {
/* gebäudetyp war falsch */ /* gebäudetyp war falsch */
btype = b->type; btype = b->type;
b->type = &bt_illusion; b->type = bt_find("illusion");
} }
data = (icastle_data*)a->data.v; data = (icastle_data*)a->data.v;
if (data->time<=0) { if (data->time<=0) {

View File

@ -149,6 +149,7 @@ game_init(void)
debug_language("locales.log"); debug_language("locales.log");
register_races(); register_races();
register_resources(); register_resources();
register_buildings();
register_ships(); register_ships();
register_items(); register_items();
register_spells(); register_spells();
@ -517,6 +518,8 @@ read_args(int argc, char **argv)
#ifdef BETA_CODE #ifdef BETA_CODE
extern int xml_writeitems(const char * filename); extern int xml_writeitems(const char * filename);
extern int xml_writeships(void);
extern int xml_writebuildings(void);
#endif #endif
typedef struct lostdata { typedef struct lostdata {
@ -565,9 +568,10 @@ main(int argc, char *argv[])
kernel_init(); kernel_init();
game_init(); game_init();
#if defined(BETA_CODE) && 0 #if defined(BETA_CODE)
/* xml_writeships(); */ /* xml_writeships(); */
xml_writeitems("items.xml"); xml_writebuildings();
/* xml_writeitems("items.xml"); */
return 0; return 0;
#endif #endif

175
src/res/buildings.xml Normal file
View File

@ -0,0 +1,175 @@
<building name="caldera" capacity="1" nodestroy nobuild>
</building>
<building name="genericbuilding" maxsize="1" nobuild>
</building>
<building name="illusioncastle" capacity="0" maxcapacity="0" maxsize="0" nobuild>
</building>
<building name="blessedstonecircle" maxsize="100" nobuild magic magres="60" magresbonus="30" auraregen="1.50">
<construction skill="sk_building" minskill="2" reqsize="100" maxsize="100">
<requirement type="log" quantity="500"></requirement>
<requirement type="stone" quantity="500"></requirement>
</construction>
</building>
<building name="stonecircle" maxsize="100">
<construction skill="sk_building" minskill="2" reqsize="100" maxsize="100">
<requirement type="log" quantity="500"></requirement>
<requirement type="stone" quantity="500"></requirement>
</construction>
</building>
<building name="inn" capacity="1">
<maintenance type="money" amount="5" variable vital></maintenance>
<construction skill="sk_building" minskill="2" reqsize="10">
<requirement type="iron" quantity="10"></requirement>
<requirement type="log" quantity="30"></requirement>
<requirement type="stone" quantity="40"></requirement>
<requirement type="money" quantity="2000"></requirement>
</construction>
</building>
<building name="tunnel" capacity="1" maxsize="100">
<maintenance type="stone" amount="2"></maintenance>
<maintenance type="money" amount="100" vital></maintenance>
<construction skill="sk_building" minskill="6" reqsize="100" maxsize="100">
<requirement type="iron" quantity="100"></requirement>
<requirement type="log" quantity="500"></requirement>
<requirement type="stone" quantity="1000"></requirement>
<requirement type="money" quantity="30000"></requirement>
</construction>
</building>
<building name="caravan" capacity="1" maxsize="10">
<maintenance type="horse" amount="2"></maintenance>
<maintenance type="money" amount="3000" vital></maintenance>
<construction skill="sk_building" minskill="2" reqsize="10" maxsize="10">
<requirement type="iron" quantity="10"></requirement>
<requirement type="log" quantity="50"></requirement>
<requirement type="stone" quantity="10"></requirement>
<requirement type="money" quantity="5000"></requirement>
</construction>
</building>
<building name="dam" capacity="1" maxsize="50">
<maintenance type="log" amount="3"></maintenance>
<maintenance type="money" amount="1000" vital></maintenance>
<construction skill="sk_building" minskill="4" reqsize="50" maxsize="50">
<requirement type="iron" quantity="50"></requirement>
<requirement type="log" quantity="500"></requirement>
<requirement type="stone" quantity="250"></requirement>
<requirement type="money" quantity="25000"></requirement>
</construction>
</building>
<building name="monument" capacity="1">
<construction skill="sk_building" minskill="4" reqsize="1">
<requirement type="log" quantity="1"></requirement>
<requirement type="stone" quantity="1"></requirement>
<requirement type="iron" quantity="1"></requirement>
<requirement type="money" quantity="400"></requirement>
</construction>
</building>
<building name="stables" capacity="1">
<maintenance type="money" amount="150" vital></maintenance>
<construction skill="sk_building" minskill="2" reqsize="1">
<requirement type="log" quantity="4"></requirement>
<requirement type="stone" quantity="2"></requirement>
<requirement type="iron" quantity="1"></requirement>
<requirement type="money" quantity="100"></requirement>
</construction>
</building>
<building name="sawmill" capacity="1">
<maintenance type="money" amount="250" vital></maintenance>
<construction skill="sk_building" minskill="3" reqsize="1">
<requirement type="log" quantity="5"></requirement>
<requirement type="stone" quantity="5"></requirement>
<requirement type="iron" quantity="3"></requirement>
<requirement type="money" quantity="200"></requirement>
</construction>
</building>
<building name="smithy" capacity="1">
<function name="init" value="init_smithy"></function>
<maintenance type="money" amount="300" vital></maintenance>
<maintenance type="log" amount="1"></maintenance>
<construction skill="sk_building" minskill="3" reqsize="1">
<requirement type="log" quantity="5"></requirement>
<requirement type="stone" quantity="5"></requirement>
<requirement type="iron" quantity="2"></requirement>
<requirement type="money" quantity="200"></requirement>
</construction>
</building>
<building name="magictower" maxcapacity="2" maxsize="50" magic magres="40" fumblebonus="10" auraregen="1.75">
<maintenance type="money" amount="1000" vital></maintenance>
<construction skill="sk_building" minskill="5" reqsize="50" maxsize="50">
<requirement type="log" quantity="150"></requirement>
<requirement type="stone" quantity="250"></requirement>
<requirement type="mallorn" quantity="100"></requirement>
<requirement type="iron" quantity="150"></requirement>
<requirement type="laen" quantity="100"></requirement>
<requirement type="money" quantity="25000"></requirement>
</construction>
</building>
<building name="academy" maxcapacity="25" maxsize="25">
<maintenance type="money" amount="1000" vital></maintenance>
<construction skill="sk_building" minskill="3" reqsize="25" maxsize="25">
<requirement type="log" quantity="125"></requirement>
<requirement type="stone" quantity="125"></requirement>
<requirement type="iron" quantity="25"></requirement>
<requirement type="money" quantity="12500"></requirement>
</construction>
</building>
<building name="harbour" capacity="1" maxcapacity="25" maxsize="25">
<maintenance type="money" amount="250" vital></maintenance>
<construction skill="sk_building" minskill="3" reqsize="25" maxsize="25">
<requirement type="log" quantity="125"></requirement>
<requirement type="stone" quantity="125"></requirement>
<requirement type="money" quantity="6250"></requirement>
</construction>
</building>
<building name="quarry" capacity="1">
<maintenance type="money" amount="250" vital></maintenance>
<construction skill="sk_building" minskill="2" reqsize="1">
<requirement type="iron" quantity="1"></requirement>
<requirement type="log" quantity="5"></requirement>
<requirement type="stone" quantity="1"></requirement>
<requirement type="money" quantity="250"></requirement>
</construction>
</building>
<building name="mine" capacity="1">
<maintenance type="money" amount="500" vital></maintenance>
<construction skill="sk_building" minskill="4" reqsize="1">
<requirement type="iron" quantity="1"></requirement>
<requirement type="log" quantity="10"></requirement>
<requirement type="stone" quantity="5"></requirement>
<requirement type="money" quantity="250"></requirement>
</construction>
</building>
<building name="lighthouse" capacity="1" maxcapacity="4">
<maintenance type="money" amount="100" vital></maintenance>
<construction skill="sk_building" minskill="3" reqsize="1">
<requirement type="iron" quantity="1"></requirement>
<requirement type="log" quantity="1"></requirement>
<requirement type="stone" quantity="2"></requirement>
<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>

View File

@ -10,6 +10,7 @@
<include file="races.xml"></include> <include file="races.xml"></include>
<include file="resources.xml"></include> <include file="resources.xml"></include>
<include file="ships.xml"></include> <include file="ships.xml"></include>
<include file="buildings.xml"></include>
<game name="Eressea" welcome="eressea"> <game name="Eressea" welcome="eressea">
<comment>Game specific</comment> <comment>Game specific</comment>