Implemented BSD string.h extensions (strlcat, strlcpy).

Big items in astral space crumble (disabled by define).
Chaossog verursacht 3/4 Schaden beim durchgehen (ungetestet).
Überladeschutz bei Schiffen abgeschaltet.
This commit is contained in:
Enno Rehling 2005-05-06 22:30:19 +00:00
parent 1381d330c5
commit 2e9e7f1e23
18 changed files with 319 additions and 165 deletions

View File

@ -295,6 +295,38 @@ get_food(region *r)
}
}
static void
age_unit(region * r, unit * u)
{
if (u->race == new_race[RC_SPELL]) {
if (--u->age <= 0) {
destroy_unit(u);
}
} else {
++u->age;
if (u->race->age) {
u->race->age(u);
}
}
#ifdef ASTRAL_ITEM_RESTRICTIONS
if (u->region->planep==astral_plane) {
item ** itemp = &u->items;
while (*itemp) {
item * itm = *itemp;
if (itm->type->flags & ITF_NOTLOST == 0) {
if (itm->type->flags & (ITF_BIG|ITF_ANIMAL|ITF_CURSED)) {
i_free(i_remove(itemp, itm));
continue;
}
}
itemp=&itm->next;
}
}
#endif
}
static void
live(region * r)
{

View File

@ -986,18 +986,3 @@ plan_monsters(void)
}
}
}
void
age_unit(region * r, unit * u)
{
if (u->race == new_race[RC_SPELL]) {
if (--u->age <= 0) {
destroy_unit(u);
}
} else {
++u->age;
if (u->race->age) {
u->race->age(u);
}
}
}

View File

@ -31,7 +31,6 @@ void age_illusion(struct unit *u);
void monsters_kill_peasants(void);
void plan_monsters(void);
void age_unit(struct region * r, struct unit * u);
struct unit *random_unit(const struct region * r);
#ifdef __cplusplus

View File

@ -109,7 +109,7 @@ char *agename;
int seasons;
static size_t
strlcpy(char * dst, const char * src) {
strxcpy(char * dst, const char * src) {
size_t s = 0;
while ((*dst++ = *src++)!=0) ++s;
return s;
@ -477,13 +477,13 @@ report_spell(FILE * F, spellid_t id, const struct locale * lang)
bufp = strcpy(buf, "Art: ");
if (sp->sptyp & PRECOMBATSPELL) {
bufp += strlcpy(bufp, "Präkampfzauber");
bufp += strxcpy(bufp, "Präkampfzauber");
} else if (sp->sptyp & COMBATSPELL) {
bufp += strlcpy(bufp, "Kampfzauber");
bufp += strxcpy(bufp, "Kampfzauber");
} else if (sp->sptyp & POSTCOMBATSPELL) {
bufp += strlcpy(bufp, "Postkampfzauber");
bufp += strxcpy(bufp, "Postkampfzauber");
} else {
bufp += strlcpy(bufp, "Normaler Zauber");
bufp += strxcpy(bufp, "Normaler Zauber");
}
rps(F, buf);
@ -497,7 +497,7 @@ report_spell(FILE * F, spellid_t id, const struct locale * lang)
if (sp->sptyp & SPELLLEVEL) {
bufp = buf + sprintf(buf, " %d %s", itemanz, LOC(lang, resname(res, itemanz!=1)));
if (costtyp == SPC_LEVEL || costtyp == SPC_LINEAR ) {
bufp += strlcpy(bufp, " * Stufe");
bufp += strxcpy(bufp, " * Stufe");
}
} else {
if (costtyp == SPC_LEVEL || costtyp == SPC_LINEAR ) {
@ -509,35 +509,35 @@ report_spell(FILE * F, spellid_t id, const struct locale * lang)
}
}
bufp = buf + strlcpy(buf, "Modifikationen: ");
bufp = buf + strxcpy(buf, "Modifikationen: ");
if (sp->sptyp & FARCASTING) {
bufp += strlcpy(bufp, "Fernzauber");
bufp += strxcpy(bufp, "Fernzauber");
dh = 1;
}
if (sp->sptyp & OCEANCASTABLE) {
if (dh == 1){
bufp += strlcpy(bufp, ", ");
bufp += strxcpy(bufp, ", ");
}
bufp += strlcpy(bufp, "Seezauber");
bufp += strxcpy(bufp, "Seezauber");
dh = 1;
}
if (sp->sptyp & ONSHIPCAST) {
if (dh == 1){
bufp += strlcpy(bufp, ", ");
bufp += strxcpy(bufp, ", ");
}
bufp += strlcpy(bufp, "Schiffszauber");
bufp += strxcpy(bufp, "Schiffszauber");
dh = 1;
}
if (sp->sptyp & NOTFAMILIARCAST) {
if (dh == 1){
bufp += strlcpy(bufp, ", k");
bufp += strxcpy(bufp, ", k");
} else {
bufp += strlcpy(bufp, "K");
bufp += strxcpy(bufp, "K");
}
bufp += strlcpy(bufp, "ann nicht vom Vertrauten gezaubert werden");
bufp += strxcpy(bufp, "ann nicht vom Vertrauten gezaubert werden");
dh = 1;
}
if(dh == 0) bufp += strlcpy(bufp, "Keine");
if(dh == 0) bufp += strxcpy(bufp, "Keine");
rps(F, buf);
@ -553,39 +553,39 @@ report_spell(FILE * F, spellid_t id, const struct locale * lang)
if (!sp->syntax) {
if (sp->sptyp & ISCOMBATSPELL) {
bufp = buf + strlcpy(buf, "KAMPFZAUBER ");
bufp = buf + strxcpy(buf, "KAMPFZAUBER ");
} else {
bufp = buf + strlcpy(buf, "ZAUBERE ");
bufp = buf + strxcpy(buf, "ZAUBERE ");
}
/* Reihenfolge beachten: Erst REGION, dann STUFE! */
if (sp->sptyp & FARCASTING) {
bufp += strlcpy(bufp, "[REGION x y] ");
bufp += strxcpy(bufp, "[REGION x y] ");
}
if (sp->sptyp & SPELLLEVEL) {
bufp += strlcpy(bufp, "[STUFE n] ");
bufp += strxcpy(bufp, "[STUFE n] ");
}
bufp += strlcpy(bufp, "\"");
bufp += strlcpy(bufp, spell_name(sp, lang));
bufp += strlcpy(bufp, "\" ");
bufp += strxcpy(bufp, "\"");
bufp += strxcpy(bufp, spell_name(sp, lang));
bufp += strxcpy(bufp, "\" ");
if (sp->sptyp & ONETARGET){
if (sp->sptyp & UNITSPELL) {
bufp += strlcpy(bufp, "<Einheit-Nr>");
bufp += strxcpy(bufp, "<Einheit-Nr>");
} else if (sp->sptyp & SHIPSPELL) {
bufp += strlcpy(bufp, "<Schiff-Nr>");
bufp += strxcpy(bufp, "<Schiff-Nr>");
} else if (sp->sptyp & BUILDINGSPELL) {
bufp += strlcpy(bufp, "<Gebäude-Nr>");
bufp += strxcpy(bufp, "<Gebäude-Nr>");
}
} else {
if (sp->sptyp & UNITSPELL) {
bufp += strlcpy(bufp, "<Einheit-Nr> [<Einheit-Nr> ...]");
bufp += strxcpy(bufp, "<Einheit-Nr> [<Einheit-Nr> ...]");
} else if (sp->sptyp & SHIPSPELL) {
bufp += strlcpy(bufp, "<Schiff-Nr> [<Schiff-Nr> ...]");
bufp += strxcpy(bufp, "<Schiff-Nr> [<Schiff-Nr> ...]");
} else if (sp->sptyp & BUILDINGSPELL) {
bufp += strlcpy(bufp, "<Gebäude-Nr> [<Gebäude-Nr> ...]");
bufp += strxcpy(bufp, "<Gebäude-Nr> [<Gebäude-Nr> ...]");
}
}
} else {
bufp += strlcpy(bufp, sp->syntax);
bufp += strxcpy(bufp, sp->syntax);
}
rps(F, buf);
rnl(F);
@ -996,9 +996,9 @@ prices(FILE * F, const region * r, const faction * f)
if (n > 0) {
char * bufp = buf + strlen(buf);
bufp += strlcpy(bufp, " ");
bufp += strlcpy(bufp, LOC(f->locale, "nr_trade_intro"));
bufp += strlcpy(bufp, " ");
bufp += strxcpy(bufp, " ");
bufp += strxcpy(bufp, LOC(f->locale, "nr_trade_intro"));
bufp += strxcpy(bufp, " ");
for (dmd=r->land->demands;dmd;dmd=dmd->next) if(dmd->value > 0) {
m = msg_message("nr_market_price", "product price",
@ -1008,14 +1008,14 @@ prices(FILE * F, const region * r, const faction * f)
n--;
bufp += strlen(bufp);
if (n == 0) {
bufp += strlcpy(bufp, LOC(f->locale, "nr_trade_end"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_trade_end"));
}
else if (n == 1) {
strcpy(bufp++, " ");
bufp += strlcpy(bufp, LOC(f->locale, "nr_trade_final"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_trade_final"));
strcpy(bufp++, " ");
} else {
bufp += strlcpy(bufp, LOC(f->locale, "nr_trade_next"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_trade_next"));
strcpy(bufp++, " ");
}
}
@ -1134,27 +1134,27 @@ describe(FILE * F, const region * r, int partial, faction * f)
}
}
bufp += strlcpy(bufp, f_regionid(r, f));
bufp += strxcpy(bufp, f_regionid(r, f));
if (partial == 1) {
bufp += strlcpy(bufp, " (durchgereist)");
bufp += strxcpy(bufp, " (durchgereist)");
}
else if (partial == 3) {
bufp += strlcpy(bufp, " (benachbart)");
bufp += strxcpy(bufp, " (benachbart)");
}
else if (partial == 2) {
bufp += strlcpy(bufp, " (vom Turm erblickt)");
bufp += strxcpy(bufp, " (vom Turm erblickt)");
}
/* Terrain */
bufp += strlcpy(bufp, ", ");
bufp += strxcpy(bufp, ", ");
if(is_cursed(r->attribs,C_MAELSTROM, 0))
tname = "maelstrom";
else {
if (r_isforest(r)) tname = "forest";
else tname = terrain[rterrain(r)].name;
}
bufp += strlcpy(bufp, LOC(f->locale, tname));
bufp += strxcpy(bufp, LOC(f->locale, tname));
/* Bäume */
@ -1166,14 +1166,14 @@ describe(FILE * F, const region * r, int partial, faction * f)
bufp += sprintf(bufp, ", %d/%d ", trees, ytrees);
if (fval(r, RF_MALLORN)) {
if (trees == 1)
bufp += strlcpy(bufp, LOC(f->locale, "nr_mallorntree"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree"));
else
bufp += strlcpy(bufp, LOC(f->locale, "nr_mallorntree_p"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree_p"));
}
else if (trees == 1)
bufp += strlcpy(bufp, LOC(f->locale, "nr_tree"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_tree"));
else
bufp += strlcpy(bufp, LOC(f->locale, "nr_tree_p"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_tree_p"));
}
}
#else
@ -1182,14 +1182,14 @@ describe(FILE * F, const region * r, int partial, faction * f)
bufp += sprintf(bufp, ", %d ", trees);
if (fval(r, RF_MALLORN)) {
if (trees == 1)
bufp += strlcpy(bufp, LOC(f->locale, "nr_mallorntree"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree"));
else
bufp += strlcpy(bufp, LOC(f->locale, "nr_mallorntree_p"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree_p"));
}
else if (trees == 1)
bufp += strlcpy(bufp, LOC(f->locale, "nr_tree"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_tree"));
else
bufp += strlcpy(bufp, LOC(f->locale, "nr_tree_p"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_tree_p"));
}
#endif
@ -1251,15 +1251,15 @@ describe(FILE * F, const region * r, int partial, faction * f)
if(fval(r, RF_ORCIFIED)) {
strcpy(bufp++, " ");
bufp += strlcpy(bufp, LOC(f->locale, rpeasants(r)==1?"rc_orc":"rc_orc_p"));
bufp += strxcpy(bufp, LOC(f->locale, rpeasants(r)==1?"rc_orc":"rc_orc_p"));
} else {
strcpy(bufp++, " ");
bufp += strlcpy(bufp, LOC(f->locale, resourcename(oldresourcetype[R_PEASANTS], rpeasants(r)!=1)));
bufp += strxcpy(bufp, LOC(f->locale, resourcename(oldresourcetype[R_PEASANTS], rpeasants(r)!=1)));
}
if (rmoney(r) && partial == 0) {
bufp += sprintf(bufp, ", %d ", rmoney(r));
bufp += strlcpy(bufp, LOC(f->locale, resourcename(oldresourcetype[R_SILVER], rmoney(r)!=1)));
bufp += strxcpy(bufp, LOC(f->locale, resourcename(oldresourcetype[R_SILVER], rmoney(r)!=1)));
}
}
/* Pferde */
@ -1267,16 +1267,16 @@ describe(FILE * F, const region * r, int partial, faction * f)
if (rhorses(r)) {
bufp += sprintf(bufp, ", %d ", rhorses(r));
#ifdef NEW_ITEMS
bufp += strlcpy(bufp, LOC(f->locale, resourcename(oldresourcetype[R_HORSE], (rhorses(r)>1)?GR_PLURAL:0)));
bufp += strxcpy(bufp, LOC(f->locale, resourcename(oldresourcetype[R_HORSE], (rhorses(r)>1)?GR_PLURAL:0)));
#else
bufp += strlcpy(bufp, itemdata[I_HORSE].name[rhorses(r) > 1]);
bufp += strxcpy(bufp, itemdata[I_HORSE].name[rhorses(r) > 1]);
#endif
}
strcpy(bufp++, ".");
if (r->display && r->display[0]) {
strcpy(bufp++, " ");
bufp += strlcpy(bufp, r->display);
bufp += strxcpy(bufp, r->display);
n = r->display[strlen(r->display) - 1];
if (n != '!' && n != '?' && n != '.')
@ -1286,8 +1286,8 @@ describe(FILE * F, const region * r, int partial, faction * f)
{
const unit * u = region_owner(r);
if (u) {
bufp += strlcpy(bufp, " Die Region ist im Besitz von ");
bufp += strlcpy(bufp, factionname(u->faction));
bufp += strxcpy(bufp, " Die Region ist im Besitz von ");
bufp += strxcpy(bufp, factionname(u->faction));
strcpy(bufp++, ".");
}
}
@ -1296,7 +1296,7 @@ describe(FILE * F, const region * r, int partial, faction * f)
attrib *a_do = a_find(r->attribs, &at_overrideroads);
if(a_do) {
strcpy(bufp++, " ");
bufp += strlcpy(bufp, (char *)a_do->data.v);
bufp += strxcpy(bufp, (char *)a_do->data.v);
} else {
int nrd = 0;
@ -1314,11 +1314,11 @@ describe(FILE * F, const region * r, int partial, faction * f)
if (dh) {
if (nrd == 0) {
strcpy(bufp++, " ");
bufp += strlcpy(bufp, LOC(f->locale, "nr_nb_final"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_nb_final"));
} else {
bufp += strlcpy(bufp, LOC(f->locale, "nr_nb_next"));
bufp += strxcpy(bufp, LOC(f->locale, "nr_nb_next"));
}
bufp += strlcpy(bufp, LOC(f->locale, directions[d]));
bufp += strxcpy(bufp, LOC(f->locale, directions[d]));
strcpy(bufp++, " ");
bufp += sprintf(bufp, trailinto(r2, f->locale),
f_regionid(r2, f));
@ -1334,17 +1334,17 @@ describe(FILE * F, const region * r, int partial, faction * f)
for (a = a_find(r->attribs, &at_direction);a;a = a->nexttype) {
spec_direction * d = (spec_direction *)(a->data.v);
strcpy(bufp++, " ");
bufp += strlcpy(bufp, d->desc);
bufp += strlcpy(bufp, " (\"");
bufp += strlcpy(bufp, d->keyword);
bufp += strlcpy(bufp, "\")");
bufp += strxcpy(bufp, d->desc);
bufp += strxcpy(bufp, " (\"");
bufp += strxcpy(bufp, d->keyword);
bufp += strxcpy(bufp, "\")");
strcpy(bufp++, ".");
dh = 1;
}
if (dh) strcpy(bufp++, ".");
}
} else {
bufp += strlcpy(bufp, " Große Verwirrung befällt alle Reisenden in dieser Region.");
bufp += strxcpy(bufp, " Große Verwirrung befällt alle Reisenden in dieser Region.");
}
rnl(F);
rparagraph(F, buf, 0, 0);
@ -1389,18 +1389,18 @@ describe(FILE * F, const region * r, int partial, faction * f)
boolean first = true;
for (d=0;d!=MAXDIRECTIONS;++d) {
if (!e->exist[d]) continue;
if (first) bufp += strlcpy(bufp, "Im ");
if (first) bufp += strxcpy(bufp, "Im ");
else {
if (e->lastd==d) bufp += strlcpy(bufp, " und im ");
else bufp += strlcpy(bufp, ", im ");
if (e->lastd==d) bufp += strxcpy(bufp, " und im ");
else bufp += strxcpy(bufp, ", im ");
}
bufp += strlcpy(bufp, LOC(f->locale, directions[d]));
bufp += strxcpy(bufp, LOC(f->locale, directions[d]));
first = false;
}
if (!e->transparent) bufp += strlcpy(bufp, " versperrt ");
else bufp += strlcpy(bufp, " befindet sich ");
bufp += strlcpy(bufp, e->name);
if (!e->transparent) bufp += strlcpy(bufp, " die Sicht.");
if (!e->transparent) bufp += strxcpy(bufp, " versperrt ");
else bufp += strxcpy(bufp, " befindet sich ");
bufp += strxcpy(bufp, e->name);
if (!e->transparent) bufp += strxcpy(bufp, " die Sicht.");
else strcpy(bufp++, ".");
rparagraph(F, buf, 0, 0);
}

View File

@ -100,7 +100,6 @@ struct building_type;
#define NEW_RECEIPIES /* Vereinfachte, besser verteilte Kräuterzutaten für Tränke */
#define GOBLINKILL
#define USE_FIREWALL 1
#undef COMPATIBILITY
#define MONSTER_FACTION 0 /* Die Partei, in der die Monster sind. */

View File

@ -1159,15 +1159,15 @@ static t_item itemdata[MAXITEMS] = {
},
{ /* I_PEGASUS 60 */
{"Pegasus", "Pegasi", "Pegasus", "Pegasi" }, G_M,
IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 5000, 0, FL_ITEM_ANIMAL | FL_ITEM_NOTINBAG, NULL
IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 5000, 0, FL_ITEM_ANIMAL | FL_ITEM_NOTINBAG | FL_ITEM_NOTLOST, NULL
},
{ /* I_UNICORN 61 */
{"Elfenpferd", "Elfenpferde", "Elfenpferd", "Elfenpferde"}, G_N,
IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 5000, 0, FL_ITEM_ANIMAL | FL_ITEM_NOTINBAG, NULL
IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 5000, 0, FL_ITEM_ANIMAL | FL_ITEM_NOTINBAG | FL_ITEM_NOTLOST, NULL
},
{ /* I_DOLPHIN 62 */
{"Delphin", "Delphine", "Delphin", "Delphine"}, G_M,
IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 5000, 0, FL_ITEM_ANIMAL | FL_ITEM_NOTINBAG, NULL
IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 5000, 0, FL_ITEM_ANIMAL | FL_ITEM_NOTINBAG | FL_ITEM_NOTLOST, NULL
},
{ /* I_ANTIMAGICCRYSTAL 63 */
{"Antimagiekristall", "Antimagiekristalle", "Amulett", "Amulette"}, G_M,
@ -1216,7 +1216,7 @@ static t_item itemdata[MAXITEMS] = {
},
{
{"Zauberbeutel", "Zauberbeutel", "Zauberbeutel", "Zauberbeutel"}, G_M,
IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 100, 0, FL_ITEM_NOTINBAG, NULL
IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 100, 0, FL_ITEM_NOTINBAG|FL_ITEM_NOTLOST, NULL
},
{ /* I_RUSTY_SWORD */
{"Schartiges Schwert", "Schartige Schwerter", "Schartiges Schwert", "Schartige Schwerter"}, G_N,

View File

@ -56,14 +56,9 @@
#include <attributes/otherfaction.h>
#include <attributes/racename.h>
const char * g_reportdir;
#include <util/bsdstring.h>
static size_t
strlcpy(char * dst, const char * src) {
size_t s = 0;
while ((*dst++ = *src++)!=0) ++s;
return s;
}
const char * g_reportdir;
const char *neue_gebiete[] = {
"none",
@ -191,7 +186,7 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
if (fspecial(u->faction, FS_HIDDEN))
a_fshidden = a_find(u->attribs, &at_fshidden);
bufp += strlcpy(bufp, unitname(u));
bufp += strlcpy(bufp, unitname(u), sizeof(buf));
if (!isbattle) {
attrib *a_otherfaction = a_find(u->attribs, &at_otherfaction);
@ -199,30 +194,30 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
attrib *a = a_find(u->attribs, &at_group);
if (a) {
group * g = (group*)a->data.v;
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, groupid(g, f));
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, groupid(g, f), sizeof(buf)-(bufp-buf));
}
if (getarnt) {
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, LOC(f->locale, "anonymous"));
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, LOC(f->locale, "anonymous"), sizeof(buf)-(bufp-buf));
} else if (a_otherfaction) {
faction * otherfaction = get_otherfaction(a_otherfaction);
if (otherfaction) {
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, factionname(otherfaction));
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, factionname(otherfaction), sizeof(buf)-(bufp-buf));
}
}
} else {
if (getarnt) {
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, LOC(f->locale, "anonymous"));
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, LOC(f->locale, "anonymous"), sizeof(buf)-(bufp-buf));
} else {
if (a_otherfaction && alliedunit(u, f, HELP_FSTEALTH)) {
faction * f = get_otherfaction(a_otherfaction);
bufp += sprintf(bufp, ", %s (%s)", factionname(f), factionname(u->faction));
} else {
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, factionname(fv));
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, factionname(fv), sizeof(buf)-(bufp-buf));
}
}
}
@ -235,15 +230,15 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
if (is_ugroupleader(u, ug)) {
strcpy(bufp++, "*");
}
bufp += strlcpy(bufp, itoa36(ug->id));
bufp += strlcpy(bufp, itoa36(ug->id), sizeof(buf)-(bufp-buf));
}
}
#endif
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
if (u->faction != f && a_fshidden && a_fshidden->data.ca[0] == 1 && effskill(u, SK_STEALTH) >= 6) {
bufp += strlcpy(bufp, "? ");
bufp += strlcpy(bufp, "? ", sizeof(buf)-(bufp-buf));
} else {
bufp += sprintf(bufp, "%d ", u->number);
}
@ -252,56 +247,56 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
if (pzTmp) {
scat(pzTmp);
if (u->faction==f && fval(u->race, RCF_SHAPESHIFTANY)) {
bufp += strlcpy(bufp, " (");
bufp += strlcpy(bufp, racename(f->locale, u, u->race));
bufp += strlcpy(bufp, " (", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, racename(f->locale, u, u->race), sizeof(buf)-(bufp-buf));
strcpy(bufp++, ")");
}
} else {
bufp += strlcpy(bufp, racename(f->locale, u, u->irace));
bufp += strlcpy(bufp, racename(f->locale, u, u->irace), sizeof(buf)-(bufp-buf));
if (u->faction==f && u->irace!=u->race) {
bufp += strlcpy(bufp, " (");
bufp += strlcpy(bufp, racename(f->locale, u, u->race));
bufp += strlcpy(bufp, " (", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, racename(f->locale, u, u->race), sizeof(buf)-(bufp-buf));
strcpy(bufp++, ")");
}
}
#ifdef HEROES
if (fval(u, UFL_HERO) && (u->faction == f || omniscient(f))) {
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, LOC(f->locale, "hero"));
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, LOC(f->locale, "hero"), sizeof(buf)-(bufp-buf));
}
#endif
/* status */
if (u->number && (u->faction == f || telepath_see || isbattle)) {
const char * c = locale_string(f->locale, hp_status(u));
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, report_kampfstatus(u, f->locale));
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, report_kampfstatus(u, f->locale), sizeof(buf)-(bufp-buf));
if (c || fval(u, UFL_HUNGER)) {
bufp += strlcpy(bufp, " (");
if (c) bufp += strlcpy(bufp, c);
bufp += strlcpy(bufp, " (", sizeof(buf)-(bufp-buf));
if (c) bufp += strlcpy(bufp, c, sizeof(buf)-(bufp-buf));
if (fval(u, UFL_HUNGER)) {
if (c) bufp += strlcpy(bufp, ", hungert");
else bufp += strlcpy(bufp, "hungert");
if (c) bufp += strlcpy(bufp, ", hungert", sizeof(buf)-(bufp-buf));
else bufp += strlcpy(bufp, "hungert", sizeof(buf)-(bufp-buf));
}
strcpy(bufp++, ")");
}
}
if (getguard(u)) bufp += strlcpy(bufp, ", bewacht die Region");
if (getguard(u)) bufp += strlcpy(bufp, ", bewacht die Region", sizeof(buf)-(bufp-buf));
if (u->faction==f || telepath_see) {
attrib * a = a_find(u->attribs, &at_follow);
if (a) {
unit * uf = (unit*)a->data.v;
if (uf) {
bufp += strlcpy(bufp, ", folgt ");
bufp += strlcpy(bufp, itoa36(uf->no));
bufp += strlcpy(bufp, ", folgt ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, itoa36(uf->no), sizeof(buf)-(bufp-buf));
}
}
}
if ((b = usiege(u))!=NULL) {
bufp += strlcpy(bufp, ", belagert ");
bufp += strlcpy(bufp, buildingname(b));
bufp += strlcpy(bufp, ", belagert ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, buildingname(b), sizeof(buf)-(bufp-buf));
}
dh = 0;
@ -347,14 +342,14 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
int in;
report_item(u, itm, f, &ic, NULL, &in, false);
if (in==0 || ic==NULL) continue;
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
if (!dh) {
bufp += sprintf(bufp, "%s: ", LOC(f->locale, "nr_inventory"));
dh = 1;
}
if (in == 1) {
bufp += strlcpy(bufp, ic);
bufp += strlcpy(bufp, ic, sizeof(buf)-(bufp-buf));
} else {
bufp += sprintf(bufp, "%d %s", in, ic);
}
@ -377,9 +372,9 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
bufp += sprintf(bufp, ", %s: ", LOC(f->locale, "nr_spells"));
dh = 1;
} else {
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
}
bufp += strlcpy(bufp, spell_name(sp, f->locale));
bufp += strlcpy(bufp, spell_name(sp, f->locale), sizeof(buf)-(bufp-buf));
}
}
dh = 0;
@ -396,17 +391,17 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
if (!dh){
dh = 1;
} else {
bufp += strlcpy(bufp, ", ");
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
}
sp = get_combatspell(u,i);
if (sp) {
int sl;
bufp += strlcpy(bufp, spell_name(sp, u->faction->locale));
bufp += strlcpy(bufp, spell_name(sp, u->faction->locale), sizeof(buf)-(bufp-buf));
if ((sl = get_combatspelllevel(u,i)) > 0) {
bufp += sprintf(bufp, " (%d)", sl);
}
} else {
bufp += strlcpy(bufp, LOC(f->locale, "nr_nospells"));
bufp += strlcpy(bufp, LOC(f->locale, "nr_nospells"), sizeof(buf)-(bufp-buf));
}
}
}
@ -414,8 +409,8 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
#ifdef LASTORDER
if (!isbattle && u->lastorder) {
char * cmd = getcommand(u->lastorder);
bufp += strlcpy(bufp, ", \"");
bufp += strlcpy(bufp, cmd);
bufp += strlcpy(bufp, ", \"", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, cmd, sizeof(buf)-(bufp-buf));
strcpy(bufp++, "\"");
free(cmd);
}
@ -424,8 +419,8 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
i = 0;
if (u->display && u->display[0]) {
bufp += strlcpy(bufp, "; ");
bufp += strlcpy(bufp, u->display);
bufp += strlcpy(bufp, "; ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, u->display, sizeof(buf)-(bufp-buf));
i = u->display[strlen(u->display) - 1];
}
@ -434,9 +429,9 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
pzTmp = uprivate(u);
if (u->faction == f && pzTmp) {
bufp += strlcpy(bufp, " (Bem: ");
bufp += strlcpy(bufp, pzTmp);
bufp += strlcpy(bufp, ")");
bufp += strlcpy(bufp, " (Bem: ", sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, pzTmp, sizeof(buf)-(bufp-buf));
bufp += strlcpy(bufp, ")", sizeof(buf)-(bufp-buf));
}
dh=0;
@ -611,19 +606,19 @@ spskill(char * buffer, const struct locale * lang, const struct unit * u, skill_
if (!has_skill(u, sk)) return 0;
pbuf += strlcpy(pbuf, ", ");
pbuf += strlcpy(pbuf, ", ", sizeof(buf));
if (!*dh) {
pbuf += strlcpy(pbuf, LOC(lang, "nr_skills"));
pbuf += strlcpy(pbuf, ": ");
pbuf += strlcpy(pbuf, LOC(lang, "nr_skills"), sizeof(buf)-(bufp-buf));
pbuf += strlcpy(pbuf, ": ", sizeof(buf)-(bufp-buf));
*dh = 1;
}
pbuf += strlcpy(pbuf, skillname(sk, lang));
pbuf += strlcpy(pbuf, skillname(sk, lang), sizeof(buf)-(bufp-buf));
strcpy(pbuf++, " ");
if (sk == SK_MAGIC){
if (find_magetype(u) != M_GRAU){
pbuf += strlcpy(pbuf, LOC(lang, mkname("school", magietypen[find_magetype(u)])));
pbuf += strlcpy(pbuf, LOC(lang, mkname("school", magietypen[find_magetype(u)])), sizeof(buf)-(bufp-buf));
strcpy(pbuf++, " ");
}
}

View File

@ -2817,7 +2817,6 @@ sp_summondragon(castorder *co)
return cast_level;
}
#if USE_FIREWALL
/* ------------------------------------------------------------- */
/* Name: Feuerwand
* Stufe:
@ -3170,7 +3169,6 @@ sp_wisps(castorder *co)
return cast_level;
}
#endif
/* ------------------------------------------------------------- */
/* Name: Unheilige Kraft
@ -3614,6 +3612,7 @@ sp_chaossuction(castorder *co)
create_special_direction(rt, r, 2,
"Ein Wirbel aus reinem Chaos zieht über die Region.",
"Wirbel");
new_border(&bt_chaosgate, r, rt);
for (f = factions; f; f = f->next) freset(f, FL_DH);
for (u = r->units; u; u = u->next) {
@ -10546,3 +10545,40 @@ init_spells(void)
register_spell(spelldaten+i);
}
}
static boolean
chaosgate_valid(const border * b)
{
const attrib * a = a_findc(b->from->attribs, &at_direction);
if (!a) a = a_findc(b->to->attribs, &at_direction);
if (!a) return false;
return true;
}
struct region *
chaosgate_move(const border * b, struct unit * u, struct region * from, struct region * to, boolean routing)
{
if (!routing) {
int maxhp = u->hp / 4;
if (maxhp<u->number) maxhp = u->number;
u->hp = maxhp;
}
return to;
}
border_type bt_chaosgate = {
"chaosgate",
b_transparent, /* transparent */
NULL, /* init */
NULL, /* destroy */
NULL, /* read */
NULL, /* write */
b_blocknone, /* block */
NULL, /* name */
b_rinvisible, /* rvisible */
b_finvisible, /* fvisible */
b_uinvisible, /* uvisible */
chaosgate_valid,
chaosgate_move
};

View File

@ -265,11 +265,11 @@ extern "C" {
/* ------------------------------------------------------------- */
#if USE_FIREWALL
/* für Feuerwände: in movement muß das noch explizit getestet werden.
* besser wäre eine blcok_type::move() routine, die den effekt
* der Bewegung auf eine struct unit anwendet.
*/
extern struct border_type bt_chaosgate;
extern struct border_type bt_firewall;
extern struct border_type bt_wisps;
typedef struct wall_data {
@ -277,7 +277,6 @@ extern "C" {
int force;
boolean active;
} wall_data;
#endif
extern struct attrib_type at_cursewall;
extern struct attrib_type at_unitdissolve;

View File

@ -27,16 +27,17 @@
#define GUARD_DISABLES_RECRUIT 1
#define GUARD_DISABLES_PRODUCTION 1
#define RESOURCE_QUANTITY 0.5
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define CHANGED_CROSSBOWS 1
#define COMBAT_TURNS 5
#define PEASANTS_DO_NOT_STARVE 0
#define NEW_MIGRATION 1
#define ASTRAL_HUNGER
#define NEWATSROI 0
#define HUNGER_REDUCES_SKILL /* Hunger reduziert den Talentwert
auf die Hälfte */
auf die Hälfte */
#undef ASTRAL_ITEM_RESTRICTIONS /* keine grossen dinge im astralraum */
#define MUSEUM_MODULE
#define ARENA_MODULE

View File

@ -6,7 +6,7 @@
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
@ -27,10 +27,12 @@
#define GUARD_DISABLES_RECRUIT 1
#define GUARD_DISABLES_PRODUCTION 1
#define RESOURCE_QUANTITY 0.5
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define CHANGED_CROSSBOWS 1
#define NEWATSROI 0
#define COMBAT_TURNS 5
#define PEASANTS_DO_NOT_STARVE 0
#define NEW_MIGRATION 1
#define ASTRAL_HUNGER
#undef ASTRAL_ITEM_RESTRICTIONS /* keine grossen dinge im astralraum */

View File

@ -12,6 +12,7 @@ SOURCES =
#<dl>malloc.c
attrib.c
base36.c
bsdstring.c
command.c
crmessage.c
cvector.c

View File

@ -0,0 +1,61 @@
#include <config.h>
#include "bsdstring.h"
#include <string.h>
#if !defined(HAVE_STRLCPY)
INLINE_FUNCTION size_t
strlcpy(char *dst, const char *src, size_t siz) /* copied from OpenBSD source code */
{
register char *d = dst;
register const char *s = src;
register size_t n = siz;
/* Copy as many bytes as will fit */
if (n != 0 && --n != 0) {
do {
if ((*d++ = *s++) == 0)
break;
} while (--n != 0);
}
/* Not enough room in dst, add NUL and traverse rest of src */
if (n == 0) {
if (siz != 0)
*d = '\0'; /* NUL-terminate dst */
while (*s++)
;
}
return(s - src - 1); /* count does not include NUL */
}
INLINE_FUNCTION size_t
strlcat(char * dst, const char * src, size_t siz)
{
register char *d = dst;
register const char *s = src;
register size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (*d != '\0' && n-- != 0)
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + strlen(s));
while (*s != '\0') {
if (n != 1) {
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src)); /* count does not include NUL */
}
#endif

View File

@ -0,0 +1,13 @@
#ifndef UTIL_BSDSTRING_H
#define UTIL_BSDSTRING_H
#if !defined(HAVE_STRLCPY)
# ifdef HAVE_INLINE
# include "bsdstring.c"
# else
extern size_t strlcpy(char *dst, const char *src, size_t siz);
extern size_t strlcat(char * dst, const char * src, size_t siz);
# endif
#endif
#endif

View File

@ -179,6 +179,9 @@
<File
RelativePath=".\base36.h">
</File>
<File
RelativePath=".\bsdstring.h">
</File>
<File
RelativePath=".\command.h">
</File>

View File

@ -148,6 +148,9 @@ typedef struct stat stat_type;
# define R_OK 4
# define HAVE__MKDIR_WITHOUT_PERMISSION
#define HAVE_INLINE
#define INLINE_FUNCTION __inline
# define snprintf _snprintf
# define HAVE_SNPRINTF

View File

@ -1010,6 +1010,30 @@ nothing(void)
return 0;
}
static int
fix_chaosgates(void)
{
region * r;
for (r = regions; r; r=r->next) {
const attrib *a = a_findc(r->attribs, &at_direction);
while (a!=NULL) {
spec_direction * sd = (spec_direction *)a->data.v;
region * r2 = findregion(sd->x, sd->y);
border * b = get_borders(r, r2);
while (b) {
if (b->type==&bt_chaosgate) break;
b = b->next;
}
if (b==NULL) {
b = new_border(&bt_chaosgate, r, r2);
}
a = a->nexttype;
}
}
return 0;
}
void
korrektur(void)
{
@ -1024,6 +1048,7 @@ korrektur(void)
do_once("zvrm", nothing());
}
do_once("chgt", fix_chaosgates());
fix_astralplane();
fix_firewalls();
fix_gates();

View File

@ -24,7 +24,7 @@
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="1"/>
<param name="database.gameid" value="0"/>
<param name="rules.check_overload" value="1"/>
<param name="rules.check_overload" value="0"/>
<param name="firstturn" value="184"/>
<param name="report.mailit" value="/usr/sbin:$HOME/eressea/bin:/bin:/usr/bin:/usr/local/bin"/>
</game>
@ -42,7 +42,7 @@
</string>
<string name="newbie_info_1">
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff ERESSEA BEFEHLE an eressea-server@eressea.upb.de zu senden. Am besten, du verwendest die Befehlsvorlage am Ende des Reports.</text>
<text locale="en">Remember to send your orders to eressea-server@eressea.upb.de with the subject ERESSEA ORDERS.</text>
<text locale="en">Remember to send your orders to eressea-server@eressea.upb.de with the subject ERESSEA ORDERS.</text>
</string>
<string name="mailcmd">
<text locale="de">ERESSEA BEFEHLE</text>