From b917430561dfea65367924d93dc1eb2231239f35 Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Sun, 11 Sep 2005 20:16:04 +0000 Subject: [PATCH] =?UTF-8?q?Diverser=20Kleinkram=20f=C3=BCr=20WdW:=20-=20Pa?= =?UTF-8?q?pyrus-Dummy-Item=20-=20NO=5FRANDOM=5FBRAINEATERS=20-=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/attributes/alliance.c | 32 ++++++++++ src/common/attributes/alliance.h | 26 ++++++++ src/common/attributes/attributes.c | 3 + src/common/gamecode/report.c | 13 ++++ src/common/kernel/build.c | 8 +++ src/common/kernel/building.c | 84 +++++++++++++++++++++++- src/common/kernel/building.h | 5 ++ src/common/kernel/teleport.c | 3 + src/common/settings-wdw.h | 3 +- src/res/buildings.xml | 7 ++ src/res/de/strings.xml | 19 +++++- src/res/messages.xml | 2 +- src/res/resources.xml | 2 +- src/res/vinyambar/wdw-races.xml | 99 ++++++++++++++++++++++++++++- src/res/vinyambar/wdw-resources.xml | 4 ++ 15 files changed, 304 insertions(+), 6 deletions(-) create mode 100644 src/common/attributes/alliance.c create mode 100644 src/common/attributes/alliance.h diff --git a/src/common/attributes/alliance.c b/src/common/attributes/alliance.c new file mode 100644 index 000000000..37d604e2d --- /dev/null +++ b/src/common/attributes/alliance.c @@ -0,0 +1,32 @@ +/* vi: set ts=2: + * + * Eressea PB(E)M host Copyright (C) 1998-2005 + * Christian Schlittchen (corwin@amber.kn-bremen.de) + * Katja Zedel (katze@felidae.kn-bremen.de) + * Enno Rehling (enno@eressea-pbem.de) + * + * This program may not be used, modified or distributed without + * prior permission by the authors of Eressea. + */ + +#include +#include "eressea.h" +#include "alliance.h" + +#include + +attrib_type at_alliance = { + "alliance", + NULL, + NULL, + NULL, + a_writedefault, + a_readdefault, + ATF_UNIQUE +}; + +void +init_alliance(void) +{ + at_register(&at_alliance); +} diff --git a/src/common/attributes/alliance.h b/src/common/attributes/alliance.h new file mode 100644 index 000000000..aa76d7296 --- /dev/null +++ b/src/common/attributes/alliance.h @@ -0,0 +1,26 @@ +/* vi: set ts=2: + * + * + * Eressea PB(E)M host Copyright (C) 1998-2005 + * Christian Schlittchen (corwin@amber.kn-bremen.de) + * Katja Zedel (katze@felidae.kn-bremen.de) + * Enno Rehling (enno@eressea-pbem.de) + * + * This program may not be used, modified or distributed without + * prior permission by the authors of Eressea. + */ + +#ifndef H_ATTRIBUTE_ALLIANCE +#define H_ATTRIBUTE_ALLIANCE +#ifdef __cplusplus +extern "C" { +#endif + +extern struct attrib_type at_alliance; +extern void init_alliance(void); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/src/common/attributes/attributes.c b/src/common/attributes/attributes.c index 08f71f91c..3f56485a2 100644 --- a/src/common/attributes/attributes.c +++ b/src/common/attributes/attributes.c @@ -74,4 +74,7 @@ init_attributes(void) init_ugroup(); #endif init_variable(); +#ifdef WDW_PYRAMID + init_alliance(); +#endif } diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 86a8f7ab1..b6134426d 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -1873,6 +1873,19 @@ report_building(FILE *F, const region * r, const building * b, const faction * f if (i != '!' && i != '?' && i != '.') scat("."); +#if WDW_PYRAMID + if(b->type == bt_find("wdw_pyramid")) { + attrib *a = a_find(b->attribs, &at_alliance)); + if(f->alliance && f->alliance->id == a->data.i) { + scat("Die Größenstufe dieser Pyramide ist "); + icat(wdw_pyramid_level(b)); + scat(". Die nächste Größenstufe wird mit "); + icat(wdw_pyramid_size_for_next_level(b)); + scat(" Größenpunkten erreicht. Baukosten pro Größenpunkt: "); + } + } +#endif + rparagraph(F, buf, 2, 0); if (modebuilding = b; fset(u, UFL_OWNER); +#if WDW_PYRAMID + if(b->type == bt_find("wdw_pyramid") && u->faction->alliance != NULL) { + attrib * a = a_add(&b->attribs, a_new(&at_alliance)); + a->data.i = u->faction->alliance->id; + } +#endif + newbuilding = true; } @@ -947,6 +954,7 @@ build_building(unit * u, const building_type * btype, int want, order * ord) b->size += built; update_lighthouse(b); + ADDMSG(&u->faction->msgs, msg_message("buildbuilding", "building unit size", b, u, built)); } diff --git a/src/common/kernel/building.c b/src/common/kernel/building.c index 883de00bb..1780b4de0 100644 --- a/src/common/kernel/building.c +++ b/src/common/kernel/building.c @@ -330,7 +330,7 @@ static construction castle_bld[MAXBUILDINGS] = { building_type bt_castle = { "castle", - BFL_NONE, + BTF_NONE, 1, 4, -1, 0, 0, 0, 1.0, NULL, @@ -338,6 +338,83 @@ building_type bt_castle = { castle_name }; +#if WDW_PYRAMID +static requirement wdw_pyramid_req[][] = { + {{R_STONE, 100, 0}, {R_WOOD, 100, 0}, {R_IRON, 100, 0}, {NORESOURCE, 0, 0.0 }}, + {{R_STONE, 1, 0}, {R_WOOD, 1, 0}, {R_IRON, 1, 0}, {NORESOURCE, 0, 0.0 }}, + {{R_STONE, 1, 0}, {R_WOOD, 1, 0}, {R_IRON, 1, 0}, + {R_MALLORN, 1, 0}, {NORESOURCE, 0, 0.0 }}, + {{R_STONE, 1, 0}, {R_WOOD, 1, 0}, {R_IRON, 1, 0}, + {R_LAEN, 1, 0}, {NORESOURCE, 0, 0.0 }}, + {{R_STONE, 1, 0}, {R_WOOD, 1, 0}, {R_IRON, 1, 0}, + {R_TOADSLIME, 1, 0}, {NORESOURCE, 0, 0.0 }}, + {{R_STONE, 1, 0}, {R_WOOD, 1, 0}, {R_IRON, 1, 0}, + {R_BALM, 1, 0.0 }, {R_SPICES, 1, 0.0 }, {R_JEWELERY, 1, 0.0 }, + {R_MYRRH, 1, 0.0 }, {R_OIL, 1, 0.0 }, {R_SILK, 1, 0.0 }, + {R_INCENSE, 1, 0.0 }, {NORESOURCE, 0, 0.0 }} +} + + +static construction wdw_pyramid_bld[] = { + { SK_BUILDING, 10, 1, 1, pyramid_req[0], wdw_pyramid_bld[0] }, /* 0 -> 1 */ + { SK_BUILDING, 3, 6, 1, pyramid_req[1], wdw_pyramid_bld[1] }, /* -> 7 */ + { SK_BUILDING, 4, 1, 1, pyramid_req[2], wdw_pyramid_bld[2] }, /* -> 8 */ + { SK_BUILDING, 5, 13, 1, pyramid_req[1], wdw_pyramid_bld[3] }, /* -> 21 */ + { SK_BUILDING, 6, 1, 1, pyramid_req[3], wdw_pyramid_bld[4] }, /* -> 22 */ + { SK_BUILDING, 7, 41, 1, pyramid_req[1], wdw_pyramid_bld[5] }, /* -> 63 */ + { SK_BUILDING, 8, 1, 1, pyramid_req[4], wdw_pyramid_bld[6] }, /* -> 64 */ + { SK_BUILDING, 9, 125, 1, pyramid_req[1], wdw_pyramid_bld[7] }, /* -> 189 */ + { SK_BUILDING, 10, 1, 1, pyramid_req[5], wdw_pyramid_bld[8] }, /* -> 190 */ + { SK_BUILDING, 100, 100000, 1, pyramid_req[0], NULL } /* should never be seen */ +} + +int +wdw_pyramid_level(const struct building *b) +{ + int size = 0; + int level; + + for(level=0; wdw_pyramid_bld[level].improvement != NULL; level++) { + size += wdw_pyramid_bld[level].maxsize; + if(size > b->size) break; + } + + return level; +} + +int +wdw_pyramid_size_for_next_level(const struct building *b) +{ + int size = 0; + int level; + + for(level=0; wdw_pyramid_bld[level].improvement != NULL; level++) { + size += wdw_pyramid_bld[level].maxsize; + if(size > b->size) { + return size - b->size; + } + } + + return INT_MAX; +} + +static const char * +wdw_pyramid_name(int bsize) +{ + return "wdw_pyramid"; +} + +building_type bt_wdw_pyramid = { + "wdw_pyramid", + BTF_INDESTRUCTIBLE, + 1, 4, -1, + 0, 0, 0, 1.0, + NULL, + &wdw_pyramid_bld[0], + wdw_pyramid_name +}; +#endif + /* for finding out what was meant by a particular building string */ static local_names * bnames; @@ -376,6 +453,11 @@ register_buildings(void) register_function((pf_generic)init_smithy, "init_smithy"); register_function((pf_generic)castle_name, "castle_name"); bt_register(&bt_castle); + +#if WDW_PYRAMID + register_function((pf_generic)wdw_pyramid_name, "wdw_pyramid_name"); + bt_register(&bt_wdw_pyramid); +#endif } building_type * diff --git a/src/common/kernel/building.h b/src/common/kernel/building.h index 3509c76d3..347eed1f1 100644 --- a/src/common/kernel/building.h +++ b/src/common/kernel/building.h @@ -143,6 +143,11 @@ extern struct unit * buildingowner(const struct region * r, const struct buildin extern attrib_type at_nodestroy; extern attrib_type at_building_action; +#if WDW_PYRAMID +extern int wdw_pyramid_size(const struct building *b); +extern int wdw_pyramid_size_for_next_level(const struct building *b); +#endif + typedef struct building_action { building * b; char * fname; diff --git a/src/common/kernel/teleport.c b/src/common/kernel/teleport.c index cf9856386..99339677f 100644 --- a/src/common/kernel/teleport.c +++ b/src/common/kernel/teleport.c @@ -145,6 +145,8 @@ random_in_teleport_plane(void) if (f0==NULL) return; + /* Für WDW abschaltbar machen */ +#if NO_RANDOM_BRAINEATERS == 1 for (r=regions; r; r=r->next) { if (rplane(r) != get_astralplane() || rterrain(r) != T_ASTRAL) continue; @@ -159,6 +161,7 @@ random_in_teleport_plane(void) next = rand() % 100; } } +#endif } plane * diff --git a/src/common/settings-wdw.h b/src/common/settings-wdw.h index 8d5186466..62677d4ef 100644 --- a/src/common/settings-wdw.h +++ b/src/common/settings-wdw.h @@ -55,6 +55,7 @@ #undef XECMD_MODULE #define WDW_PHOENIX #define WDW_PYRAMIDSPELL +/* #define WDW_PYRAMID 1 */ #define KEEP_UNZIPPED 1 - +#define NO_RANDOM_BRAINEATERS 1 diff --git a/src/res/buildings.xml b/src/res/buildings.xml index 500e09dfa..0b5b0bfda 100644 --- a/src/res/buildings.xml +++ b/src/res/buildings.xml @@ -149,5 +149,12 @@ + + + + + + + diff --git a/src/res/de/strings.xml b/src/res/de/strings.xml index 2e5f2a182..8f5fce85d 100644 --- a/src/res/de/strings.xml +++ b/src/res/de/strings.xml @@ -814,6 +814,16 @@ Zitadelle + + + + Pyramide + pyramid + + + Pyramide + pyramid + @@ -852,7 +862,14 @@ Sonnensegel solar sails - + + Papyrus + papyrus + + + Papyri + papyri + Elfenohr elven ear diff --git a/src/res/messages.xml b/src/res/messages.xml index 16bed48db..86a0d8f1f 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -2561,7 +2561,7 @@ - "$unit($spy) gelang es Informationen über $unit($target) herauszubekommen: '$report'." + "$unit($spy) gelang es, Informationen über $unit($target) herauszubekommen: '$report'." "$unit($spy) managed to gather information about $unit($target): '$report'." "$unit($spy) managed to gather information about $unit($target): '$report'." diff --git a/src/res/resources.xml b/src/res/resources.xml index 0171ee4cc..e4b6bca5d 100644 --- a/src/res/resources.xml +++ b/src/res/resources.xml @@ -32,7 +32,7 @@ - + diff --git a/src/res/vinyambar/wdw-races.xml b/src/res/vinyambar/wdw-races.xml index 25b558241..1adecdad8 100644 --- a/src/res/vinyambar/wdw-races.xml +++ b/src/res/vinyambar/wdw-races.xml @@ -2,7 +2,6 @@ - @@ -65,4 +64,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/res/vinyambar/wdw-resources.xml b/src/res/vinyambar/wdw-resources.xml index 81f24a549..45b776b81 100644 --- a/src/res/vinyambar/wdw-resources.xml +++ b/src/res/vinyambar/wdw-resources.xml @@ -30,4 +30,8 @@ + + + +