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:
*
* $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
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -53,6 +53,7 @@
#include <skill.h>
#include <teleport.h>
#include <unit.h>
#include <save.h>
/* util includes */
#include <goodies.h>
@ -495,13 +496,7 @@ cr_output_unit(FILE * F, region * r,
fprintf(F, "COMMANDS\n");
if(u->lastorder[0]) fprintf(F, "\"%s\"\n", u->lastorder);
for (S = u->orders; S; S = S->next) {
switch (igetkeyword(S->s)) {
case K_LIEFERE:
case K_DEFAULT:
case K_RESERVE:
case K_KOMMENTAR:
case K_BUY:
case K_SELL:
if(is_persistent(S->s)) {
fprintf(F, "\"%s\"\n", S->s);
}
}

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.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) {
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);
return;
}
@ -840,7 +840,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere)
/* Übergabe aller Kräuter */
if (findparam(s) == P_HERBS) {
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);
return;
}

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -1992,9 +1992,22 @@ instant_orders(void)
s = getstrtoken();
if(findparam(s) == P_ANY) {
s = getstrtoken();
if(findparam(s) == P_ZAUBER) {
param_t p = getparam();
if(p == P_ZAUBER) {
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 {
cmistake(u, S->s, 222, MSG_EVENT);
}
@ -3004,9 +3017,10 @@ processorders (void)
puts(" - Jihads setzen");
set_jihad();
puts(" - neue Nummern und Reihenfolge");
renumber();
puts(" - Einheiten Sortieren");
reorder();
puts(" - Neue Nummern");
renumber();
puts(" - GM Kommandos");
gmcommands();

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -109,7 +109,7 @@ const char *parameters[MAXPARAMS] =
"REGION",
"SCHIFF",
"SILBER",
"Straßen",
"STRAßEN",
"TEMPORÄRE",
"FEIND",
"FREUND",
@ -133,7 +133,8 @@ const char *parameters[MAXPARAMS] =
"HINTER",
"VOR",
"ANZAHL",
"GEGENSTÄNDE"
"GEGENSTÄNDE",
"TRÄNKE"
};

View File

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

View File

@ -125,7 +125,6 @@ typedef struct item_type {
/* --- functions --- */
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);
/* --- pointers --- */
struct item_type * next;
} item_type;
@ -133,28 +132,25 @@ extern item_type * itemtypes;
extern const item_type * finditemtype(const char * name, const struct locale * lang);
typedef struct luxury_type {
struct luxury_type * next;
const item_type * itype;
int price;
/* --- pointers --- */
struct luxury_type * next;
} luxury_type;
extern luxury_type * luxurytypes;
typedef struct herb_type {
struct herb_type * next;
const item_type * itype;
terrain_t terrain;
/* --- pointers --- */
struct herb_type * next;
} herb_type;
extern herb_type * herbtypes;
typedef struct potion_type {
struct potion_type * next;
const item_type * itype;
int level;
const char * text;
int (*use)(struct unit *, const struct potion_type *, const char *);
/* --- pointers --- */
struct potion_type * next;
} potion_type;
extern potion_type * potiontypes;

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.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);
/* ------------------------------------------------------------- */
FILE *
cfopen(const char *filename, const char *mode)
{
@ -208,26 +206,20 @@ rsf(FILE * F, char *s, size_t len)
static void
rs(FILE * F, char *s)
{
while (nextc != '"') {
if (nextc == EOF) {
puts("Die Datei bricht vorzeitig ab.");
abort();
}
boolean apos = false;
while (isspace(nextc)) rc(F);
if (nextc=='"') {
apos=true;
rc(F);
}
rc(F);
while (nextc != '"') {
if (nextc == EOF) {
puts("Die Datei bricht vorzeitig ab.");
abort();
}
for (;;) {
if (nextc=='"') {
rc(F);
break;
} else if (!apos && isspace(nextc)) break;
*s++ = (char)nextc;
rc(F);
}
rc(F);
*s = 0;
}

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -48,18 +48,13 @@ static void
killunit_write(const trigger * t, FILE * F)
{
unit * u = (unit*)t->data.v;
fprintf(F, "%s ", itoa36(u->no));
write_unit_reference(u, F);
}
static int
killunit_read(trigger * t, FILE * F)
{
char zId[10];
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);
read_unit_reference((unit**)&t->data.v, F);
return 1;
}

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.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;
if (--td->timer==0) {
handle_triggers(&td->triggers, NULL);
return -1;
}
unused(data);
return td->timer;
return 0;
}
static void

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.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);
index = ((unsigned char)c) % 32;
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;
if (!next) {
tref * ref;
@ -121,10 +121,32 @@ findtoken(tnode * tk, const char * str, void **result)
tk = ref->node;
}
if (tk) {
if (tk->flags & LEAF || !(tk->flags & SHARED)) {
*result = tk->id;
return E_TOK_SUCCESS;
}
*result = tk->id;
return E_TOK_SUCCESS;
}
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:
*
* $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
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -53,6 +53,7 @@
/* util includes */
#include <attrib.h>
#include <event.h>
#include <base36.h>
#include <cvector.h>
#include <resolve.h>
@ -1927,7 +1928,8 @@ undo_deadpeasants(void)
}
#endif
void
#if 0
static void
fix_targetregion_resolve(void)
{
region *r;
@ -1941,18 +1943,71 @@ fix_targetregion_resolve(void)
}
}
}
#endif
void
fix_baumringel(void)
static 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;
const item_type *itype = finditemtype("Blauer Baumringel", NULL);
const herb_type *htype = resource2herb(itype->rtype);
int i, hsum = 0, left = 0;
for(r=regions; r; r=r->next) {
if(rterrain(r) == T_PLAIN && rand()%6 == 5) {
rsetherbtype(r, htype);
for (i=0;i!=6;++i) {
htypes[i] = resource2herb(finditemtype(plain_herbs[i], NULL)->rtype);
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
#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
korrektur(void)
{
@ -1988,6 +2145,8 @@ korrektur(void)
#endif
fix_migrants();
fix_allies();
do_once(atoi36("fhrb"), fix_herbs());
do_once(atoi36("ftos"), fix_timeouts());
#ifndef SKILLFIX_SAVE
fix_skills();
#endif

View File

@ -1,5 +1,5 @@
# 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:
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.
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.
error285;errors:0;de;{unit} in {region}: '{command}' - Diese Einheit kennt keine Trankrezepte.
# Meldungen und Ereignisse
msg_event;events:0;de;{string}