einbau der bugfixes aus dem aktuellen beta-branch in die dev-version

This commit is contained in:
Enno Rehling 2001-02-25 19:31:40 +00:00
parent 8e63635098
commit 10cba7ae11
12 changed files with 247 additions and 70 deletions

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: creport.c,v 1.10 2001/02/24 12:50:47 enno Exp $ * $Id: creport.c,v 1.11 2001/02/25 19:31:38 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -53,6 +53,7 @@
#include <skill.h> #include <skill.h>
#include <teleport.h> #include <teleport.h>
#include <unit.h> #include <unit.h>
#include <save.h>
/* util includes */ /* util includes */
#include <goodies.h> #include <goodies.h>
@ -495,13 +496,7 @@ cr_output_unit(FILE * F, region * r,
fprintf(F, "COMMANDS\n"); fprintf(F, "COMMANDS\n");
if(u->lastorder[0]) fprintf(F, "\"%s\"\n", u->lastorder); if(u->lastorder[0]) fprintf(F, "\"%s\"\n", u->lastorder);
for (S = u->orders; S; S = S->next) { for (S = u->orders; S; S = S->next) {
switch (igetkeyword(S->s)) { if(is_persistent(S->s)) {
case K_LIEFERE:
case K_DEFAULT:
case K_RESERVE:
case K_KOMMENTAR:
case K_BUY:
case K_SELL:
fprintf(F, "\"%s\"\n", S->s); fprintf(F, "\"%s\"\n", S->s);
} }
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: economy.c,v 1.7 2001/02/18 10:06:08 enno Exp $ * $Id: economy.c,v 1.8 2001/02/25 19:31:38 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -827,7 +827,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere)
/* if ((race[u->race].ec_flags & NOGIVE) || fval(u,FL_LOCKED)) {*/ /* if ((race[u->race].ec_flags & NOGIVE) || fval(u,FL_LOCKED)) {*/
if (race[u->race].ec_flags & NOGIVE) { if (race[u->race].ec_flags & NOGIVE) {
sprintf(buf, "%s geben nichts weg.", race[u->race].name[1]); sprintf(buf, "%s geben nichts weg", race[u->race].name[1]);
mistake(u, S->s, buf, MSG_COMMERCE); mistake(u, S->s, buf, MSG_COMMERCE);
return; return;
} }
@ -840,7 +840,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere)
/* Übergabe aller Kräuter */ /* Übergabe aller Kräuter */
if (findparam(s) == P_HERBS) { if (findparam(s) == P_HERBS) {
if (!(race[u->race].ec_flags & GIVEITEM)) { if (!(race[u->race].ec_flags & GIVEITEM)) {
sprintf(buf, "%s geben nichts weg.", race[u->race].name[1]); sprintf(buf, "%s geben nichts weg", race[u->race].name[1]);
mistake(u, S->s, buf, MSG_COMMERCE); mistake(u, S->s, buf, MSG_COMMERCE);
return; return;
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: laws.c,v 1.28 2001/02/18 19:07:31 katze Exp $ * $Id: laws.c,v 1.29 2001/02/25 19:31:38 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -1992,9 +1992,22 @@ instant_orders(void)
s = getstrtoken(); s = getstrtoken();
if(findparam(s) == P_ANY) { if(findparam(s) == P_ANY) {
s = getstrtoken(); param_t p = getparam();
if(findparam(s) == P_ZAUBER) {
if(p == P_ZAUBER) {
a_removeall(&u->faction->attribs, &at_seenspell); a_removeall(&u->faction->attribs, &at_seenspell);
} else if(p == P_POTIONS) {
int skill = effskill(u, SK_ALCHEMY);
potion_type *pt;
int c = 0;
for(pt = potiontypes; pt; pt=pt->next) {
if(pt->level * 2 <= skill) {
c += display_potion(u->faction, u, pt);
}
}
if(c == 0) {
cmistake(u, S->s, 285, MSG_EVENT);
}
} else { } else {
cmistake(u, S->s, 222, MSG_EVENT); cmistake(u, S->s, 222, MSG_EVENT);
} }
@ -3004,9 +3017,10 @@ processorders (void)
puts(" - Jihads setzen"); puts(" - Jihads setzen");
set_jihad(); set_jihad();
puts(" - neue Nummern und Reihenfolge"); puts(" - Einheiten Sortieren");
renumber();
reorder(); reorder();
puts(" - Neue Nummern");
renumber();
puts(" - GM Kommandos"); puts(" - GM Kommandos");
gmcommands(); gmcommands();

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: eressea.c,v 1.22 2001/02/24 12:50:48 enno Exp $ * $Id: eressea.c,v 1.23 2001/02/25 19:31:39 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -109,7 +109,7 @@ const char *parameters[MAXPARAMS] =
"REGION", "REGION",
"SCHIFF", "SCHIFF",
"SILBER", "SILBER",
"Straßen", "STRAßEN",
"TEMPORÄRE", "TEMPORÄRE",
"FEIND", "FEIND",
"FREUND", "FREUND",
@ -133,7 +133,8 @@ const char *parameters[MAXPARAMS] =
"HINTER", "HINTER",
"VOR", "VOR",
"ANZAHL", "ANZAHL",
"GEGENSTÄNDE" "GEGENSTÄNDE",
"TRÄNKE"
}; };

View File

@ -483,6 +483,7 @@ enum {
P_BEFORE, P_BEFORE,
P_NUMBER, P_NUMBER,
P_ITEMS, P_ITEMS,
P_POTIONS,
MAXPARAMS, MAXPARAMS,
NOPARAM = (param_t) - 1 NOPARAM = (param_t) - 1
}; };

View File

@ -125,7 +125,6 @@ typedef struct item_type {
/* --- functions --- */ /* --- functions --- */
int (*use)(struct unit * user, const struct item_type * itype, const char * cmd); int (*use)(struct unit * user, const struct item_type * itype, const char * cmd);
int (*give)(const struct unit * src, const struct unit * dest, const struct item_type * itm, int number, const char * cmd); int (*give)(const struct unit * src, const struct unit * dest, const struct item_type * itm, int number, const char * cmd);
/* --- pointers --- */
struct item_type * next; struct item_type * next;
} item_type; } item_type;
@ -133,28 +132,25 @@ extern item_type * itemtypes;
extern const item_type * finditemtype(const char * name, const struct locale * lang); extern const item_type * finditemtype(const char * name, const struct locale * lang);
typedef struct luxury_type { typedef struct luxury_type {
struct luxury_type * next;
const item_type * itype; const item_type * itype;
int price; int price;
/* --- pointers --- */
struct luxury_type * next;
} luxury_type; } luxury_type;
extern luxury_type * luxurytypes; extern luxury_type * luxurytypes;
typedef struct herb_type { typedef struct herb_type {
struct herb_type * next;
const item_type * itype; const item_type * itype;
terrain_t terrain; terrain_t terrain;
/* --- pointers --- */
struct herb_type * next;
} herb_type; } herb_type;
extern herb_type * herbtypes; extern herb_type * herbtypes;
typedef struct potion_type { typedef struct potion_type {
struct potion_type * next;
const item_type * itype; const item_type * itype;
int level; int level;
const char * text; const char * text;
int (*use)(struct unit *, const struct potion_type *, const char *); int (*use)(struct unit *, const struct potion_type *, const char *);
/* --- pointers --- */
struct potion_type * next;
} potion_type; } potion_type;
extern potion_type * potiontypes; extern potion_type * potiontypes;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: save.c,v 1.22 2001/02/24 12:50:48 enno Exp $ * $Id: save.c,v 1.23 2001/02/25 19:31:39 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -100,8 +100,6 @@ rns(FILE * f, char *c, size_t size)
extern unsigned int __at_hashkey(const char* s); extern unsigned int __at_hashkey(const char* s);
/* ------------------------------------------------------------- */
FILE * FILE *
cfopen(const char *filename, const char *mode) cfopen(const char *filename, const char *mode)
{ {
@ -208,26 +206,20 @@ rsf(FILE * F, char *s, size_t len)
static void static void
rs(FILE * F, char *s) rs(FILE * F, char *s)
{ {
while (nextc != '"') { boolean apos = false;
if (nextc == EOF) { while (isspace(nextc)) rc(F);
puts("Die Datei bricht vorzeitig ab."); if (nextc=='"') {
abort(); apos=true;
}
rc(F); rc(F);
} }
for (;;) {
if (nextc=='"') {
rc(F); rc(F);
break;
while (nextc != '"') { } else if (!apos && isspace(nextc)) break;
if (nextc == EOF) {
puts("Die Datei bricht vorzeitig ab.");
abort();
}
*s++ = (char)nextc; *s++ = (char)nextc;
rc(F); rc(F);
} }
rc(F);
*s = 0; *s = 0;
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: killunit.c,v 1.2 2001/01/26 16:19:41 enno Exp $ * $Id: killunit.c,v 1.3 2001/02/25 19:31:39 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -48,18 +48,13 @@ static void
killunit_write(const trigger * t, FILE * F) killunit_write(const trigger * t, FILE * F)
{ {
unit * u = (unit*)t->data.v; unit * u = (unit*)t->data.v;
fprintf(F, "%s ", itoa36(u->no)); write_unit_reference(u, F);
} }
static int static int
killunit_read(trigger * t, FILE * F) killunit_read(trigger * t, FILE * F)
{ {
char zId[10]; read_unit_reference((unit**)&t->data.v, F);
int i;
fscanf(F, "%s", zId);
i = atoi36(zId);
t->data.v = findunit(i);
if (t->data.v==NULL) ur_add((void*)i, &t->data.v, resolve_unit);
return 1; return 1;
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: timeout.c,v 1.3 2001/02/20 22:54:05 enno Exp $ * $Id: timeout.c,v 1.4 2001/02/25 19:31:39 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -55,9 +55,10 @@ timeout_handle(trigger * t, void * data)
timeout_data * td = (timeout_data*)t->data.v; timeout_data * td = (timeout_data*)t->data.v;
if (--td->timer==0) { if (--td->timer==0) {
handle_triggers(&td->triggers, NULL); handle_triggers(&td->triggers, NULL);
return -1;
} }
unused(data); unused(data);
return td->timer; return 0;
} }
static void static void

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: umlaut.c,v 1.7 2001/02/17 15:52:47 enno Exp $ * $Id: umlaut.c,v 1.8 2001/02/25 19:31:39 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -63,7 +63,7 @@ addtoken(tnode * root, const char* str, void * id)
if (c<'a' || c>'z') c = (char)tolower((unsigned char)c); if (c<'a' || c>'z') c = (char)tolower((unsigned char)c);
index = ((unsigned char)c) % 32; index = ((unsigned char)c) % 32;
next = root->next[index]; next = root->next[index];
if (!root->flags) root->id = id; if (!(root->flags & LEAF)) root->id = id;
while (next && next->c != c) next = next->nexthash; while (next && next->c != c) next = next->nexthash;
if (!next) { if (!next) {
tref * ref; tref * ref;
@ -121,10 +121,32 @@ findtoken(tnode * tk, const char * str, void **result)
tk = ref->node; tk = ref->node;
} }
if (tk) { if (tk) {
if (tk->flags & LEAF || !(tk->flags & SHARED)) {
*result = tk->id; *result = tk->id;
return E_TOK_SUCCESS; return E_TOK_SUCCESS;
} }
}
return E_TOK_NOMATCH; return E_TOK_NOMATCH;
} }
#ifdef TEST_UMLAUT
#include <stdio.h>
tnode root;
int
main(int argc, char ** argv)
{
char buf[1024];
int i = 0;
for (;;) {
int k;
fgets(buf, sizeof(buf), stdin);
buf[strlen(buf)-1]=0;
if (findtoken(&root, buf, (void**)&k)==0) {
printf("%s returned %d\n", buf, k);
} else {
addtoken(&root, buf, (void*)++i);
printf("added %s=%d\n", buf, i);
}
}
return 0;
}
#endif

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: korrektur.c,v 1.28 2001/02/20 22:54:05 enno Exp $ * $Id: korrektur.c,v 1.29 2001/02/25 19:31:39 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -53,6 +53,7 @@
/* util includes */ /* util includes */
#include <attrib.h> #include <attrib.h>
#include <event.h>
#include <base36.h> #include <base36.h>
#include <cvector.h> #include <cvector.h>
#include <resolve.h> #include <resolve.h>
@ -1927,7 +1928,8 @@ undo_deadpeasants(void)
} }
#endif #endif
void #if 0
static void
fix_targetregion_resolve(void) fix_targetregion_resolve(void)
{ {
region *r; region *r;
@ -1941,18 +1943,71 @@ fix_targetregion_resolve(void)
} }
} }
} }
#endif
void static void
fix_baumringel(void) fix_herbs(void)
{ {
const char * plain_herbs[] = {"Flachwurz", "Würziger Wagemut", "Eulenauge", "Grüner Spinnerich", "Blauer Baumringel", "Elfenlieb"};
const herb_type * htypes[6];
int herbs[6];
int hneed[6];
region *r; region *r;
const item_type *itype = finditemtype("Blauer Baumringel", NULL); int i, hsum = 0, left = 0;
const herb_type *htype = resource2herb(itype->rtype);
for(r=regions; r; r=r->next) { for (i=0;i!=6;++i) {
if(rterrain(r) == T_PLAIN && rand()%6 == 5) { htypes[i] = resource2herb(finditemtype(plain_herbs[i], NULL)->rtype);
rsetherbtype(r, htype); herbs[i] = 0;
} }
for (r=regions; r; r=r->next) if (rterrain(r) == T_PLAIN) {
const herb_type *htype = rherbtype(r);
assert(htype);
for (i=0;i!=6;++i) if (htypes[i]==htype) break;
assert(i!=6);
herbs[i]++;
hsum++;
}
for (i=0;i!=6;++i) {
int hwant = hsum / (6-i);
hneed[i] = hwant - herbs[i];
if (hneed[i]>0) left += hneed[i];
hsum -= hwant;
}
for (r=regions; r; r=r->next) if (rterrain(r) == T_PLAIN) {
const herb_type *htype = rherbtype(r);
assert(htype);
for (i=0;i!=6;++i) if (htypes[i]==htype) break;
assert(i!=6);
if (hneed[i]<0) {
int p;
int k = rand() % left;
for (p=0;p!=6;++p) if (hneed[p]>0) {
k-=hneed[p];
if (k<0) break;
}
assert(p!=6);
hneed[p]--;
hneed[i]++;
left--;
rsetherbtype(r, htypes[p]);
}
hsum++;
}
for (i=0;i!=6;++i) herbs[i] = 0;
for (r=regions; r; r=r->next) if (rterrain(r) == T_PLAIN) {
const herb_type *htype = rherbtype(r);
assert(htype);
for (i=0;i!=6;++i) if (htypes[i]==htype) break;
assert(i!=6);
herbs[i]++;
}
for (i=0;i!=6;++i) {
fprintf(stderr, "%s : %d\n", locale_string(NULL, resourcename(htypes[i]->itype->rtype, 0)), herbs[i]);
} }
} }
@ -1972,6 +2027,108 @@ set_atgm(faction * f)
} }
#endif #endif
#include <event.h>
#include <triggers/timeout.h>
#include <triggers/changerace.h>
#include <triggers/changefaction.h>
#include <triggers/createcurse.h>
#include <triggers/createunit.h>
#include <triggers/killunit.h>
#include <triggers/giveitem.h>
typedef struct handler_info {
char * event;
trigger * triggers;
} handler_info;
typedef struct timeout_data {
trigger * triggers;
int timer;
variant trigger_data;
} timeout_data;
trigger *
get_timeout(trigger * td, trigger * tfind)
{
trigger * t = td;
while (t) {
if (t->type==&tt_timeout) {
timeout_data * tdata = (timeout_data *)t->data.v;
trigger * tr = tdata->triggers;
while (tr) {
if (tr==tfind) break;
tr=tr->next;
}
if (tr==tfind) break;
}
t=t->next;
}
return t;
}
static void
fix_timeouts(void)
{
region * r;
for (r=regions;r;r=r->next) {
unit * u;
for (u=r->units;u;u=u->next) {
attrib * a = a_find(u->attribs, &at_eventhandler);
boolean toad = (u->race==RC_TOAD);
boolean keeper = (u->race==RC_IRONKEEPER);
while (a!=NULL) {
trigger * t;
handler_info * td = (handler_info *)a->data.v;
for (t=td->triggers;t;t=t->next) {
trigger ** tptr=&t->next;
while (*tptr) {
/* remove duplicates */
if ((*tptr)->type==t->type) {
*tptr = (*tptr)->next;
} else tptr = &(*tptr)->next;
}
if (t->type == &tt_changerace ||
t->type == &tt_changefaction ||
t->type == &tt_createcurse ||
t->type == &tt_createunit)
{
trigger * timer = get_timeout(td->triggers, t);
if (toad && t->type == &tt_changerace) {
toad = false;
}
if (timer==NULL) {
add_trigger(&u->attribs, "timer", trigger_timeout(1+(rand()%2), t));
}
}
else if (t->type == &tt_killunit) {
if (u->race==RC_IRONKEEPER) {
trigger * timer = get_timeout(td->triggers, t);
keeper = false;
if (timer==NULL) {
add_trigger(&u->attribs, "timer", trigger_timeout(1+(rand()%2), t));
}
}
}
}
a = a->nexttype;
}
if (keeper) {
int duration = 1+ (rand() % 2);
trigger * tkill = trigger_killunit(u);
add_trigger(&u->attribs, "timer", trigger_timeout(duration, tkill));
}
if (toad) {
/* repair toad-only mage */
int duration = 1+ (rand() % 2);
trigger * trestore = trigger_changerace(u, u->faction->race, u->faction->race);
if (rand()%10>2) t_add(&trestore, trigger_giveitem(u, olditemtype[I_TOADSLIME], 1));
add_trigger(&u->attribs, "timer", trigger_timeout(duration, trestore));
}
}
}
}
void void
korrektur(void) korrektur(void)
{ {
@ -1988,6 +2145,8 @@ korrektur(void)
#endif #endif
fix_migrants(); fix_migrants();
fix_allies(); fix_allies();
do_once(atoi36("fhrb"), fix_herbs());
do_once(atoi36("ftos"), fix_timeouts());
#ifndef SKILLFIX_SAVE #ifndef SKILLFIX_SAVE
fix_skills(); fix_skills();
#endif #endif

View File

@ -1,5 +1,5 @@
# Kommentare sind erlaubt. Endlich. # Kommentare sind erlaubt. Endlich.
# $Id: messages.txt,v 1.3 2001/02/11 07:21:12 corwin Exp $ # $Id: messages.txt,v 1.4 2001/02/25 19:31:40 enno Exp $
# Fehlermeldungen: # Fehlermeldungen:
msg_errors;errors:0;de;{string} msg_errors;errors:0;de;{string}
@ -284,6 +284,7 @@ error281;errors:0;de;{unit} in {region}: '{command}' - Gegen welche Rasse soll d
error282;errors:0;de;{unit} in {region}: '{command}' - Gegen diese Rasse kann kein Jihad ausgerufen werden. error282;errors:0;de;{unit} in {region}: '{command}' - Gegen diese Rasse kann kein Jihad ausgerufen werden.
error283;events:0;de;{unit} in {region}: '{command}' - Das Passwort darf nur Buchstaben und Ziffern enthalten. error283;events:0;de;{unit} in {region}: '{command}' - Das Passwort darf nur Buchstaben und Ziffern enthalten.
error284;errors:0;de;{unit} in {region}: '{command}' - Nur noch nicht gestärkte Untote können das Ziel dieses Zaubers sein. error284;errors:0;de;{unit} in {region}: '{command}' - Nur noch nicht gestärkte Untote können das Ziel dieses Zaubers sein.
error285;errors:0;de;{unit} in {region}: '{command}' - Diese Einheit kennt keine Trankrezepte.
# Meldungen und Ereignisse # Meldungen und Ereignisse
msg_event;events:0;de;{string} msg_event;events:0;de;{string}