From 3ab91b969de5f5621c508a6344e44f55cd12df17 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 28 Jan 2002 01:55:31 +0000 Subject: [PATCH] =?UTF-8?q?*=20ZEIGE=20lokalisiert=20und=20im=20CR=20*=20U?= =?UTF-8?q?rsprung=20f=C3=BCr=20Astralebene=20wird=20initialisiert=20*=20d?= =?UTF-8?q?oppelte=20GM=20Attribute=20l=C3=B6schen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/gamecode/laws.c | 5 ++- src/common/gamecode/randenc.c | 2 +- src/common/items/weapons.c | 2 +- src/common/kernel/plane.c | 24 +++++++++------ src/common/kernel/plane.h | 2 -- src/eressea/korrektur.c | 57 +++++++++++++++++++++++++++++------ src/res/de/messages.xml | 11 ++++++- 7 files changed, 76 insertions(+), 27 deletions(-) diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 81d29b7af..f261f1c9f 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -2093,8 +2093,7 @@ display_item(faction *f, unit *u, const item_type * itype) } if (!fp) return false; - sprintf(buf, "%s: ", LOC(f->locale, name)); - + buf[0]='\0'; while (fgets(t, NAMESIZE, fp) != NULL) { if (t[strlen(t) - 1] == '\n') { t[strlen(t) - 1] = 0; @@ -2104,7 +2103,7 @@ display_item(faction *f, unit *u, const item_type * itype) fclose(fp); name = buf; } - addmessage(0, f, name, MSG_EVENT, ML_IMPORTANT); + ADDMSG(&f->msgs, msg_message("displayitem", "item description", itype, name)); return true; } diff --git a/src/common/gamecode/randenc.c b/src/common/gamecode/randenc.c index 8a394a1a5..fffb54a4b 100644 --- a/src/common/gamecode/randenc.c +++ b/src/common/gamecode/randenc.c @@ -1200,7 +1200,7 @@ randomevents(void) } for (r = regions; r; r = r->next) { -#ifdef RACE_ADJUSTMENTS == 0 +#if (RACE_ADJUSTMENTS==0) /* Elfen generieren Wald, Personen in Steinkreisen können Einhörner * bekommen. */ diff --git a/src/common/items/weapons.c b/src/common/items/weapons.c index 7c77e440c..81058ab6d 100644 --- a/src/common/items/weapons.c +++ b/src/common/items/weapons.c @@ -250,7 +250,7 @@ init_oldweapons(void) item_type * itype = olditemtype[weapontable[w].item]; int minskill = 1, wflags = WTF_NONE; weapon_mod * modifiers = NULL; - int (*attack)(const troop *, int * deaths) = NULL; + int (*attack)(const troop *, int * deaths, int row) = NULL; switch (w) { case WP_RUNESWORD: diff --git a/src/common/kernel/plane.c b/src/common/kernel/plane.c index cafa239ae..9af550a4d 100644 --- a/src/common/kernel/plane.c +++ b/src/common/kernel/plane.c @@ -97,8 +97,8 @@ getplaneid(const region *r) return 0; } -int -ursprung_x(const faction *f, const plane *pl) +static int +ursprung_x(const faction *f, const plane *pl, const region * rdefault) { ursprung *ur; int id = 0; @@ -113,11 +113,13 @@ ursprung_x(const faction *f, const plane *pl) if(ur->id == id) return ur->x; } - return 0; + if (!rdefault) return 0; + set_ursprung((faction*)f, pl->id, rdefault->x - plane_center_x(pl), rdefault->y - plane_center_y(pl)); + return rdefault->x - plane_center_x(pl); } -int -ursprung_y(const faction *f, const plane *pl) +static int +ursprung_y(const faction *f, const plane *pl, const region * rdefault) { ursprung *ur; int id = 0; @@ -132,7 +134,9 @@ ursprung_y(const faction *f, const plane *pl) if(ur->id == id) return ur->y; } - return 0; + if (!rdefault) return 0; + set_ursprung((faction*)f, id, rdefault->x - plane_center_x(pl), rdefault->y - plane_center_y(pl)); + return rdefault->y - plane_center_y(pl); } int @@ -159,7 +163,7 @@ region_x(const region *r, const faction *f) plane *pl; pl = getplane(r); - return r->x - ursprung_x(f, pl) - plane_center_x(pl); + return r->x - ursprung_x(f, pl, r) - plane_center_x(pl); } int @@ -168,7 +172,7 @@ region_y(const region *r, const faction *f) plane *pl; pl = getplane(r); - return r->y - ursprung_y(f, pl) - plane_center_y(pl); + return r->y - plane_center_y(pl) - ursprung_y(f, pl, r); } void @@ -220,9 +224,9 @@ rel_to_abs(const struct plane *pl, const struct faction * f, int rel, unsigned c assert(index == 0 || index == 1); if(index == 0) - return (rel + ursprung_x(f,pl) + plane_center_x(pl)); + return (rel + ursprung_x(f, pl, NULL) + plane_center_x(pl)); - return (rel + ursprung_y(f,pl) + plane_center_y(pl)); + return (rel + ursprung_y(f, pl, NULL) + plane_center_y(pl)); } diff --git a/src/common/kernel/plane.h b/src/common/kernel/plane.h index 3b568e82d..38eddd52a 100644 --- a/src/common/kernel/plane.h +++ b/src/common/kernel/plane.h @@ -58,8 +58,6 @@ int region_x(const struct region *r, const struct faction *f); int region_y(const struct region *r, const struct faction *f); int plane_center_x(const struct plane *pl); int plane_center_y(const struct plane *pl); -int ursprung_x(const struct faction *f, const plane *pl); -int ursprung_y(const struct faction *f, const plane *pl); void set_ursprung(struct faction *f, int id, int x, int y); plane * create_new_plane(int id, const char *name, int minx, int maxx, int miny, int maxy, int flags); plane * getplanebyname(const char *); diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index 1a43fe243..c89e1ebe1 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -1388,15 +1388,13 @@ update_gms(void) for (f=factions;f;f=f->next) { attrib * permissions = a_find(f->attribs, &at_permissions); if (permissions) { + const char * keys[] = { "gmgate", "gmmsgr", "gmmsgu", NULL }; + int k; item_t i; - if (!find_key((attrib*)permissions->data.v, atoi36("gmgate"))) { - a_add((attrib**)&permissions->data.v, make_key(atoi36("gmgate"))); - } - if (!find_key((attrib*)permissions->data.v, atoi36("gmmsgr"))) { - a_add((attrib**)&permissions->data.v, make_key(atoi36("gmmsgr"))); - } - if (!find_key((attrib*)permissions->data.v, atoi36("gmmsgu"))) { - a_add((attrib**)&permissions->data.v, make_key(atoi36("gmmsgu"))); + for (k=0;keys[k];++k) { + if (!find_key((attrib*)permissions->data.v, atoi36(keys[k]))) { + a_add((attrib**)&permissions->data.v, make_key(atoi36(keys[k]))); + } } for (i=I_GREATSWORD;i!=I_KEKS;++i) { attrib * a = a_find(permissions, &at_gmcreate); @@ -1407,6 +1405,44 @@ update_gms(void) } } +static int +fix_gms(void) +{ + faction * f; + for (f=factions;f;f=f->next) { + attrib * permissions = a_find(f->attribs, &at_permissions); + if (permissions) { + const char * keys[] = { "gmgate", "gmmsgr", "gmmsgr", "gmmsgu", NULL }; + int k; + item_t i; + for (k=0;keys[k];++k) { + attrib * a = find_key((attrib*)permissions->data.v, atoi36("gmgate")); + if (a) { + attrib ** ap = &a->nexttype; + while (*ap) { + attrib * an = *ap; + if (a->data.i==an->data.i) a_remove(ap, an); + else ap = &an->next; + } + } + } + for (i=I_GREATSWORD;i!=I_KEKS;++i) { + attrib * a = a_find(permissions, &at_gmcreate); + while (a && a->data.v!=(void*)olditemtype[i]) a=a->nexttype; + if (a) { + attrib ** ap = &a->nexttype; + while (*ap) { + attrib * an = *ap; + if (a->data.v==an->data.v) a_remove(ap, an); + else ap = &an->next; + } + } + } + } + } + return 0; +} + #if 1 static int fix_demand(void) @@ -2779,11 +2815,13 @@ heal_all(void) return 0; } -static void +static int fix_astralplane(void) { plane * astralplane = getplanebyname("Astralraum"); freset(astralplane, PFL_NOCOORDS); + set_ursprung(findfaction(MONSTER_FACTION), astralplane->id, 0, 0); + return 0; } void @@ -2828,6 +2866,7 @@ korrektur(void) do_once("grat", fix_ratfamiliar()); do_once("fdmd", fix_demand()); + do_once("fgms", fix_gms()); #if NEW_RESOURCEGROWTH do_once("rndr", randomized_resources()); #endif diff --git a/src/res/de/messages.xml b/src/res/de/messages.xml index 64636ad23..c30ac3179 100644 --- a/src/res/de/messages.xml +++ b/src/res/de/messages.xml @@ -3,7 +3,7 @@ - "Deine Partei ist noch $int($turns) Wochen immun gegen Angriffe." + "Deine Partei ist noch $int($turns) Wochen immun gegen Angriffe." @@ -7282,4 +7282,13 @@ "Life itself touches the world and all beings are healed." + + + + + + "$resource($item,1): $description" + "$resource($item,1): $description" + +