Include cleanup.

This commit is contained in:
Enno Rehling 2007-06-20 00:34:02 +00:00
parent 878914636d
commit 96a2b1c779
105 changed files with 1258 additions and 1328 deletions

View file

@ -10,7 +10,7 @@
*/
#include <config.h>
#include <eressea.h>
#include <types.h>
#include "alliance.h"
#include <kernel/save.h>

View file

@ -16,7 +16,8 @@
#include "follow.h"
#include <eressea.h>
#include <unit.h>
#include <kernel/unit.h>
#include <kernel/version.h>
#include <attrib.h>
#include <resolve.h>

View file

@ -16,10 +16,11 @@
#include <eressea.h>
#include "hate.h"
#include <unit.h>
#include <kernel/unit.h>
#include <kernel/version.h>
#include <attrib.h>
#include <resolve.h>
#include <util/attrib.h>
#include <util/resolve.h>
static int
verify_hate(attrib * a)

View file

@ -21,7 +21,7 @@ extern "C" {
struct attrib;
struct attrib_type;
extern boolean get_moved(attrib ** alist);
extern boolean get_moved(struct attrib ** alist);
extern void set_moved(struct attrib ** alist);
extern void init_moved(void);

View file

@ -13,10 +13,11 @@
*/
#include <config.h>
#include <eressea.h>
#include <attrib.h>
#include <kernel/eressea.h>
#include "movement.h"
#include <util/attrib.h>
static void
write_movement(const attrib * a, FILE * F)
{

View file

@ -18,7 +18,7 @@
extern "C" {
#endif
extern boolean get_movement(attrib * const * alist, int type);
extern boolean get_movement(struct attrib * const * alist, int type);
extern void set_movement(struct attrib ** alist, int type);
extern void init_movement(void);

View file

@ -24,7 +24,7 @@ typedef enum {
TUNIT = 10, TFACTION = 11, TREGION = 12, TBUILDING = 13, TSHIP = 14,
} object_type;
extern attrib_type at_object;
extern struct attrib_type at_object;
extern struct attrib * object_create(const char * name, object_type type, variant value);
extern void object_get(const struct attrib * a, object_type * type, variant * value);

View file

@ -13,9 +13,11 @@
*/
#include <config.h>
#include <eressea.h>
#include <kernel/eressea.h>
#include "overrideroads.h"
#include <kernel/save.h>
#include <util/attrib.h>
attrib_type at_overrideroads = {
"roads_override", NULL, NULL, NULL, &a_writestring, &a_readstring

View file

@ -18,7 +18,7 @@
#include <kernel/eressea.h>
#include <kernel/region.h>
#include <kernel/save.h>
#include <kernel/version.h>
#include <util/attrib.h>
#include <util/resolve.h>

View file

@ -9,6 +9,7 @@
#include <kernel/xmlreader.h>
/* util includes */
#include <util/attrib.h>
#include <util/umlaut.h>
#include <util/language.h>
#include <util/xml.h>

View file

@ -40,6 +40,7 @@
/* util includes */
#include <util/goodies.h>
#include <util/lists.h>
#include <util/vmap.h>
#include <util/vset.h>

View file

@ -60,12 +60,13 @@
#include <kernel/save.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/crmessage.h>
#include <util/goodies.h>
#include <util/language.h>
#include <util/message.h>
#include <goodies.h>
#include <crmessage.h>
#include <nrmessage.h>
#include <base36.h>
#include <language.h>
#include <util/nrmessage.h>
/* libc includes */
#include <assert.h>

View file

@ -59,6 +59,7 @@
#include <util/base36.h>
#include <util/event.h>
#include <util/goodies.h>
#include <util/lists.h>
#include <util/message.h>
#include <util/rng.h>
@ -854,17 +855,17 @@ give_cmd(unit * u, order * ord)
static int
forget_cmd(unit * u, order * ord)
{
skill_t talent;
skill_t sk;
const char *s;
init_tokens(ord);
skip_token();
s = getstrtoken();
if ((talent = findskill(s, u->faction->locale)) != NOSKILL) {
if ((sk = findskill(s, u->faction->locale)) != NOSKILL) {
ADDMSG(&u->faction->msgs,
msg_message("forget", "unit skill", u, talent));
set_level(u, talent, 0);
msg_message("forget", "unit skill", u, sk));
set_level(u, sk, 0);
}
return 0;
}
@ -920,12 +921,12 @@ maintain(building * b, boolean first)
else need -= get_pooled(u, m->rtype, GET_DEFAULT, need);
if (!first && need > 0) {
unit * ua;
for (ua=r->units;ua;ua=ua->next) freset(ua->faction, FL_DH);
fset(u->faction, FL_DH); /* hat schon */
for (ua=r->units;ua;ua=ua->next) freset(ua->faction, FFL_SELECT);
fset(u->faction, FFL_SELECT); /* hat schon */
for (ua=r->units;ua;ua=ua->next) {
if (!fval(ua->faction, FL_DH) && (ua->faction == u->faction || alliedunit(ua, u->faction, HELP_MONEY))) {
if (!fval(ua->faction, FFL_SELECT) && (ua->faction == u->faction || alliedunit(ua, u->faction, HELP_MONEY))) {
need -= get_pooled(ua, m->rtype, GET_ALL, need);
fset(ua->faction, FL_DH);
fset(ua->faction, FFL_SELECT);
if (need<=0) break;
}
}
@ -961,14 +962,14 @@ maintain(building * b, boolean first)
else cost -= use_pooled(u, m->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, cost);
if (!first && cost > 0) {
unit * ua;
for (ua=r->units;ua;ua=ua->next) freset(ua->faction, FL_DH);
fset(u->faction, FL_DH); /* hat schon */
for (ua=r->units;ua;ua=ua->next) freset(ua->faction, FFL_SELECT);
fset(u->faction, FFL_SELECT); /* hat schon */
for (ua=r->units;ua;ua=ua->next) {
if (!fval(ua->faction, FL_DH) && alliedunit(ua, u->faction, HELP_MONEY)) {
if (!fval(ua->faction, FFL_SELECT) && alliedunit(ua, u->faction, HELP_MONEY)) {
int give = use_pooled(ua, m->rtype, GET_ALL, cost);
if (!give) continue;
cost -= give;
fset(ua->faction, FL_DH);
fset(ua->faction, FFL_SELECT);
if (m->rtype==r_silver) add_spende(ua->faction, u->faction, give, r);
if (cost<=0) break;
}
@ -997,12 +998,12 @@ gebaeude_stuerzt_ein(region * r, building * b)
if (u->building == b) {
int loss = 0;
fset(u->faction, FL_MARK);
fset(u->faction, FFL_MARK);
freset(u, UFL_OWNER);
leave(r,u);
n = u->number;
for (i = 0; i < n; i++) {
if (rng_int() % 100 >= EINSTURZUEBERLEBEN) {
if (rng_double() >= COLLAPSE_SURVIVAL) {
++loss;
}
}
@ -1015,8 +1016,8 @@ gebaeude_stuerzt_ein(region * r, building * b)
add_message(&r->msgs, msg);
for (u=r->units; u; u=u->next) {
faction * f = u->faction;
if (fval(f, FL_MARK)) {
freset(u->faction, FL_MARK);
if (fval(f, FFL_MARK)) {
freset(u->faction, FFL_MARK);
add_message(&f->msgs, msg);
}
}
@ -1034,7 +1035,7 @@ maintain_buildings(region * r, boolean crash)
/* the second time, send a message */
if (crash) {
if (!maintained && (rng_int() % 100 < EINSTURZCHANCE)) {
if (!maintained && (rng_double() < COLLAPSE_CHANCE)) {
gebaeude_stuerzt_ein(r, b);
continue;
} else if (!fval(b, BLD_WORKING)) {
@ -1636,7 +1637,7 @@ void
split_allocations(region * r)
{
allocation_list ** p_alist=&allocations;
freset(r, RF_DH);
freset(r, RF_SELECT);
while (*p_alist) {
allocation_list * alist = *p_alist;
const resource_type * rtype = alist->type;
@ -1644,7 +1645,7 @@ split_allocations(region * r)
const item_type * itype = resource2item(rtype);
allocation ** p_al = &alist->data;
freset(r, RF_DH);
freset(r, RF_SELECT);
alloc(rtype, r, alist->data);
while (*p_al) {
@ -1653,7 +1654,7 @@ split_allocations(region * r)
assert(itype || !"not implemented for non-items");
i_change(&al->unit->items, itype, al->get);
produceexp(al->unit, itype->construction->skill, al->unit->number);
fset(r, RF_DH);
fset(r, RF_SELECT);
}
if (al->want==INT_MAX) al->want = al->get;
if (fval(al, AFL_LOWSKILL)) {
@ -2403,7 +2404,7 @@ expandstealing(region * r, request * stealorders)
if (oa[i].type.goblin) { /* Goblin-Spezialklau */
int uct = 0;
unit *u2;
assert(effskill(oa[i].unit, SK_STEALTH)>=4 || !"this goblin\'s talent is too low");
assert(effskill(oa[i].unit, SK_STEALTH)>=4 || !"this goblin\'s skill is too low");
for (u2 = r->units; u2; u2 = u2->next) {
if (u2->faction == u->faction) {
uct += maintenance_cost(u2);
@ -2992,7 +2993,7 @@ expandwork(region * r)
/* Der Rest wird von den Bauern verdient. n ist das uebriggebliebene
* Geld. */
#if AFFECT_SALARY
#ifdef AFFECT_SALARY
{
attrib * a = a_find(r->attribs, &at_salary);
if (a) verdienst = a->data.i;

View file

@ -40,7 +40,7 @@ extern "C" {
#define TRADE_FRACTION 100
extern attrib_type at_reduceproduction;
extern struct attrib_type at_reduceproduction;
extern int income(const struct unit * u);

View file

@ -36,6 +36,7 @@
#include <attributes/orcification.h>
/* util includes */
#include <util/attrib.h>
#include <util/event.h>
#include <util/base36.h>

View file

@ -71,10 +71,12 @@
#include <attributes/variable.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/bsdstring.h>
#include <util/event.h>
#include <util/goodies.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/rand.h>
#include <util/rng.h>
@ -656,7 +658,7 @@ count_race(const region *r, const race *rc)
return c;
}
extern attrib_type at_germs;
extern struct attrib_type at_germs;
static void
trees(region * r, const int current_season, const int last_weeks_season)
@ -1848,13 +1850,13 @@ mail_cmd(unit * u, struct order * ord)
break;
}
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
for(u2=r->units; u2; u2=u2->next) {
if(u2->building == b && !fval(u2->faction, FL_DH)
if(u2->building == b && !fval(u2->faction, FFL_SELECT)
&& cansee(u->faction, r, u2, 0)) {
mailunit(r, u, u2->no, ord, s);
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
}
}
}
@ -1876,13 +1878,13 @@ mail_cmd(unit * u, struct order * ord)
break;
}
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
for(u2=r->units; u2; u2=u2->next) {
if(u2->ship == sh && !fval(u2->faction, FL_DH)
if(u2->ship == sh && !fval(u2->faction, FFL_SELECT)
&& cansee(u->faction, r, u2, 0)) {
mailunit(r, u, u2->no, ord, s);
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
}
}
}
@ -2536,9 +2538,10 @@ guard_on_cmd(unit * u, struct order * ord)
static void
sinkships(region * r)
{
ship *sh;
ship **shp = &r->ships;
list_foreach(ship, r->ships, sh) {
while (*shp) {
ship * sh = *shp;
if (fval(r->terrain, SEA_REGION) && (!enoughsailors(sh, r) || get_captain(sh)==NULL)) {
/* Schiff nicht seetüchtig */
damage_ship(sh, 0.30);
@ -2546,10 +2549,11 @@ sinkships(region * r)
if (shipowner(sh)==NULL) {
damage_ship(sh, 0.05);
}
if (sh->damage >= sh->size * DAMAGE_SCALE)
if (sh->damage >= sh->size * DAMAGE_SCALE) {
destroy_ship(sh);
}
if (*shp==sh) shp=&sh->next;
}
list_next(sh);
}
/* The following functions do not really belong here: */
@ -2638,7 +2642,7 @@ reorder(void)
boolean sorted=false;
while (*up) {
unit * u = *up;
if (!fval(u, FL_MARK)) {
if (!fval(u, UFL_MARK)) {
struct order * ord;
for (ord = u->orders;ord;ord=ord->next) {
if (get_keyword(ord)==K_SORT) {
@ -2681,7 +2685,7 @@ reorder(void)
}
break;
}
fset(u, FL_MARK);
fset(u, UFL_MARK);
sorted = true;
}
break;
@ -2692,7 +2696,7 @@ reorder(void)
}
if (sorted) {
unit * u;
for (u=r->units;u;u=u->next) freset(u, FL_MARK);
for (u=r->units;u;u=u->next) freset(u, UFL_MARK);
}
}
}

View file

@ -37,7 +37,7 @@ void update_guards(void);
/* eressea-specific. put somewhere else, please. */
#include "resolve.h"
void processorders(void);
extern attrib_type at_germs;
extern struct attrib_type at_germs;
#ifdef __cplusplus
}

View file

@ -60,6 +60,7 @@
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/lists.h>
#include <util/rand.h>
#include <util/rng.h>
@ -725,7 +726,7 @@ random_growl(void)
return "";
}
extern attrib_type at_direction;
extern struct attrib_type at_direction;
static order *
monster_learn(unit *u)
@ -1110,12 +1111,12 @@ spawn_dragons(void)
/* create new message to add to units */
msg = msg_message("sighting", "region race number",
u->region, u->race, u->number);
for (u=r->units;u;u=u->next) freset(u->faction, FL_DH);
for (u=r->units;u;u=u->next) freset(u->faction, FFL_SELECT);
for (u=r->units;u;u=u->next) {
faction * f = u->faction;
if (!fval(f, FL_DH)) {
if (!fval(f, FFL_SELECT)) {
add_message(&f->msgs, msg);
fset(f, FL_DH);
fset(f, FFL_SELECT);
}
}
msg_release(msg);
@ -1182,10 +1183,10 @@ spawn_undead(void)
{
message * msg = msg_message("undeadrise", "region", r);
add_message(&r->msgs, msg);
for (u=r->units;u;u=u->next) freset(u->faction, FL_DH);
for (u=r->units;u;u=u->next) freset(u->faction, FFL_SELECT);
for (u=r->units;u;u=u->next) {
if (fval(u->faction, FL_DH)) continue;
fset(u->faction, FL_DH);
if (fval(u->faction, FFL_SELECT)) continue;
fset(u->faction, FFL_SELECT);
add_message(&u->faction->msgs, msg);
}
msg_release(msg);

View file

@ -55,7 +55,9 @@
#include <attributes/racename.h>
/* util includes */
#include <util/attrib.h>
#include <util/rand.h>
#include <util/lists.h>
#include <util/message.h>
#include <util/rng.h>
@ -67,8 +69,8 @@
#include <stdlib.h>
#include <attributes/iceberg.h>
extern attrib_type at_unitdissolve;
extern attrib_type at_orcification;
extern struct attrib_type at_unitdissolve;
extern struct attrib_type at_orcification;
/* In a->data.ca[1] steht der Prozentsatz mit dem sich die Einheit
* auflöst, in a->data.ca[0] kann angegeben werden, wohin die Personen
@ -743,7 +745,7 @@ volcano_outbreak(region *r)
for (u=r->units; u; u=u->next) {
f = u->faction;
freset(f, FL_DH);
freset(f, FFL_SELECT);
}
rn = rrandneighbour(r);
@ -771,8 +773,8 @@ volcano_outbreak(region *r)
ADDMSG(&u->faction->msgs, msg_message("volcano_dead",
"unit region dead", u, r, dead));
}
if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
if (rn) {
ADDMSG(&u->faction->msgs, msg_message("volcanooutbreak",
"regionv regionn", r, rn));
@ -826,9 +828,9 @@ melt_iceberg(region *r)
unit *u;
building *b, *b2;
for (u=r->units; u; u=u->next) freset(u->faction, FL_DH);
for (u=r->units; u; u=u->next) if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
for (u=r->units; u; u=u->next) freset(u->faction, FFL_SELECT);
for (u=r->units; u; u=u->next) if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
ADDMSG(&u->faction->msgs, msg_message("iceberg_melt", "region", r));
}
@ -879,9 +881,9 @@ move_iceberg(region *r)
short x, y;
for (u=r->units; u; u=u->next) freset(u->faction, FL_DH);
for (u=r->units; u; u=u->next) if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
for (u=r->units; u; u=u->next) freset(u->faction, FFL_SELECT);
for (u=r->units; u; u=u->next) if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
ADDMSG(&u->faction->msgs, msg_message("iceberg_drift",
"region dir", r, dir));
}
@ -903,12 +905,12 @@ move_iceberg(region *r)
/* Schiffe aus dem Zielozean werden in den Eisberg transferiert
* und nehmen Schaden. */
for (sh = r->ships; sh; sh=sh->next) freset(sh, FL_DH);
for (sh = r->ships; sh; sh=sh->next) freset(sh, SF_SELECT);
for (sh = r->ships; sh; sh = sh->next) {
/* Meldung an Kapitän */
damage_ship(sh, 0.10);
fset(sh, FL_DH);
fset(sh, SF_SELECT);
}
/* Personen, Schiffe und Gebäude verschieben */
@ -917,7 +919,7 @@ move_iceberg(region *r)
translist(&rc->buildings, &r->buildings, rc->buildings);
}
while (rc->ships) {
fset(rc->ships, FL_DH);
fset(rc->ships, SF_SELECT);
damage_ship(rc->ships, 0.10);
move_ship(rc->ships, rc, r, NULL);
}
@ -932,7 +934,7 @@ move_iceberg(region *r)
for (sh = r->ships; sh;) {
shn = sh->next;
if (fval(sh, FL_DH)) {
if (fval(sh, SF_SELECT)) {
u = captain(sh, r);
if (sh->damage>=sh->size * DAMAGE_SCALE) {
if (u!=NULL) {
@ -954,9 +956,9 @@ move_iceberg(region *r)
rsetterrain(r, T_GLACIER);
a_remove(&r->attribs, a);
for (u=r->units; u; u=u->next) freset(u->faction, FL_DH);
for (u=r->units; u; u=u->next) if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
for (u=r->units; u; u=u->next) freset(u->faction, FFL_SELECT);
for (u=r->units; u; u=u->next) if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
ADDMSG(&u->faction->msgs, msg_message("iceberg_land", "region", r));
}
}
@ -969,15 +971,15 @@ move_icebergs(void)
region *r;
for (r=regions; r; r=r->next) {
if (rterrain(r) == T_ICEBERG && !fval(r, RF_DH)) {
if (rterrain(r) == T_ICEBERG && !fval(r, RF_SELECT)) {
int select = rng_int() % 10;
if (select < 4) {
/* 4% chance */
fset(r, RF_DH);
fset(r, RF_SELECT);
melt_iceberg(r);
} else if (select<64) {
/* 60% chance */
fset(r, RF_DH);
fset(r, RF_SELECT);
move_iceberg(r);
}
}
@ -996,7 +998,7 @@ create_icebergs(void)
region *rc;
unit *u;
freset(r, RF_DH);
freset(r, RF_SELECT);
for (dir=0; dir < MAXDIRECTIONS; dir++) {
rc = rconnect(r, dir);
if (rc && fval(rc->terrain, SEA_REGION)) {
@ -1008,15 +1010,15 @@ create_icebergs(void)
rsetterrain(r, T_ICEBERG);
fset(r, RF_DH);
fset(r, RF_SELECT);
move_iceberg(r);
for (u=r->units; u; u=u->next) {
freset(u->faction, FL_DH);
freset(u->faction, FFL_SELECT);
}
for (u=r->units; u; u=u->next) {
if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
ADDMSG(&u->faction->msgs, msg_message("iceberg_create", "region", r));
}
}

View file

@ -13,6 +13,7 @@
*/
#define INDENT 0
#define ECHECK_VERSION "4.01"
#include <config.h>
#include <eressea.h>
@ -67,20 +68,23 @@
#include <kernel/alliance.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/bsdstring.h>
#include <util/goodies.h>
#include <util/base36.h>
#include <util/nrmessage.h>
#include <util/translation.h>
#include <util/message.h>
#include <util/rng.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/message.h>
#include <util/nrmessage.h>
#include <util/rng.h>
#include <util/translation.h>
/* libc includes */
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
#include <stddef.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
@ -2378,7 +2382,7 @@ make_summary(void)
/* Einheiten Info. nregions darf nur einmal pro Partei
* incrementiert werden. */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next) {
f = u->faction;
if (u->faction->no != MONSTER_FACTION) {
@ -2409,9 +2413,9 @@ make_summary(void)
int aktskill = eff_skill(u, sk, r);
if (aktskill > s->maxskill) s->maxskill = aktskill;
}
if (!fval(f, FL_DH)) {
if (!fval(f, FFL_SELECT)) {
f->nregions++;
fset(f, FL_DH);
fset(f, FFL_SELECT);
}
}
@ -2455,7 +2459,7 @@ writemonument(void)
for (r = regions; r; r = r->next) {
for (b = r->buildings; b; b = b->next) {
if (b->type == bt_find("monument") && b->display && *b->display) {
freset(b, FL_DH);
freset(b, BLD_SELECT);
count++;
if(b->size > size[6]) {
for(i=0; i <= 6; i++) if(b->size >= size[i]) {
@ -2473,7 +2477,7 @@ writemonument(void)
}
for(i=0; i <= 6; i++) if(buildings[i]) {
fset(buildings[i], FL_DH);
fset(buildings[i], BLD_SELECT);
}
{
char zText[MAX_PATH];
@ -2501,7 +2505,7 @@ writemonument(void)
j = 0;
for (r = regions; r; r = r->next) {
for (b = r->buildings; b; b = b->next) {
if (b->type == bt_find("monument") && b->display && *b->display && !fval(b, FL_DH)) {
if (b->type == bt_find("monument") && b->display && *b->display && !fval(b, BLD_SELECT)) {
j++;
if(j == ra) {
fprintf(F, "In %s", rname(b->region, NULL));

View file

@ -44,6 +44,7 @@
#include <kernel/unit.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/rand.h>
@ -100,11 +101,11 @@ magic_lowskill(unit *u)
/* ------------------------------------------------------------- */
int
study_cost(unit *u, skill_t talent)
study_cost(unit *u, skill_t sk)
{
int stufe, k = 50;
switch (talent) {
switch (sk) {
case SK_SPY:
return 100;
break;
@ -617,13 +618,8 @@ learn_cmd(unit * u, order * ord)
studycost = p; /* Ohne Univertreurung */
money = min(money, studycost);
if (p>0 && money < studycost * u->number) {
#ifdef PARTIAL_STUDY
cmistake(u, ord, 65, MSG_EVENT);
multi = money / (double)(studycost * u->number);
#else
cmistake(u, ord, 65, MSG_EVENT);
return 0; /* nein, Silber reicht auch so nicht */
#endif
}
}

View file

@ -28,6 +28,7 @@
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -28,6 +28,7 @@
#include <kernel/ship.h>
/* util includes */
#include <util/attrib.h>
#include <util/functions.h>
#include <util/rand.h>

View file

@ -11,18 +11,20 @@
*/
#include <config.h>
#include <eressea.h>
#include <kernel/eressea.h>
#include "seed.h"
#include <build.h>
#include <region.h>
#include <kernel/build.h>
#include <kernel/eressea.h>
#include <kernel/region.h>
/* kernel includes */
#include <item.h>
/* util includes */
#include <functions.h>
#include <util/attrib.h>
#include <util/functions.h>
/* libc includes */
#include <assert.h>

View file

@ -36,7 +36,8 @@
#include "movement.h"
/* util includes */
#include <rand.h>
#include <util/attrib.h>
#include <util/rand.h>
/* libc includes */
#include <stdio.h>

View file

@ -48,18 +48,16 @@ enum {
P_WAHRHEIT,
P_MACHT,
P_HEAL,
MAX_POTIONS,
NOPOTION = (potion_t) - 1
MAX_POTIONS
};
herb_t rherb2herb(struct region *r);
void herbsearch(struct region * r, struct unit * u, int max);
int use_potion(struct unit * u, const struct item_type * itype, int amount, struct order *);
void init_potions(void);
extern int get_effect(const struct unit * u, const struct potion_type * effect);
extern int change_effect(struct unit * u, const struct potion_type * effect, int value);
extern attrib_type at_effect;
extern struct attrib_type at_effect;
/* rausnehmen, sobald man attribute splitten kann: */
typedef struct effect_data {

View file

@ -26,9 +26,11 @@
#include <kernel/item.h>
/* util includes */
#include <util/command.h>
#include <util/umlaut.h>
#include <util/attrib.h>
#include <util/base36.h>
#include <util/command.h>
#include <util/lists.h>
#include <util/umlaut.h>
/* libc includes */
#include <assert.h>
@ -255,7 +257,7 @@ alliancevictory(void)
if (b->type==btype) {
unit * u = buildingowner(r, b);
if (u) {
fset(u->faction->alliance, FL_MARK);
fset(u->faction->alliance, FFL_MARK);
}
}
b = b->next;
@ -263,7 +265,7 @@ alliancevictory(void)
r=r->next;
}
while (al!=NULL) {
if (!fval(al, FL_MARK)) {
if (!fval(al, FFL_MARK)) {
faction_list * flist = al->members;
while (flist!=0) {
faction * f = flist->data;
@ -275,7 +277,7 @@ alliancevictory(void)
flist = flist->next;
}
} else {
freset(al, FL_MARK);
freset(al, FFL_MARK);
}
al = al->next;
}

View file

@ -52,12 +52,14 @@
#include <items/demonseye.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/bsdstring.h>
#include <util/cvector.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/rand.h>
#include <util/rng.h>
#include <util/log.h>
/* libc includes */
#include <assert.h>
@ -3366,7 +3368,6 @@ make_battle(region * r)
{
battle *b = calloc(1, sizeof(struct battle));
unit *u;
faction *lastf = NULL;
bfaction * bf;
static int max_fac_no = 0; /* need this only once */
@ -3388,27 +3389,28 @@ make_battle(region * r)
b->region = r;
b->plane = getplane(r);
/* Finde alle Parteien, die den Kampf beobachten können: */
list_foreach(unit, r->units, u)
for (u = r->units; u; u=u->next) {
if (u->number > 0) {
if (lastf != u->faction) { /* Speed optimiert, aufeinanderfolgende
* * gleiche nicht getestet */
lastf = u->faction;
for (bf=b->factions;bf;bf=bf->next)
if (bf->faction==lastf) break;
if (!bf) {
bf = calloc(sizeof(bfaction), 1);
++b->nfactions;
bf->faction = lastf;
bf->next = b->factions;
b->factions = bf;
if (!fval(u->faction, FFL_MARK)) {
fset(u->faction, FFL_MARK);
for (bf=b->factions;bf;bf=bf->next) {
if (bf->faction==u->faction) break;
}
if (!bf) {
bf = calloc(sizeof(bfaction), 1);
++b->nfactions;
bf->faction = u->faction;
bf->next = b->factions;
b->factions = bf;
}
}
}
}
list_next(u);
for (bf=b->factions;bf;bf=bf->next) {
faction * f = bf->faction;
max_fac_no = max(max_fac_no, f->no);
freset(f, FFL_MARK);
}
return b;
}

View file

@ -17,6 +17,8 @@
extern "C" {
#endif
#include <util/cvector.h>
#define SHOW_KILLS
#undef SMALL_BATTLE_MESSAGES

View file

@ -22,6 +22,7 @@
#include "unit.h"
#include <util/rng.h>
#include <util/attrib.h>
/* libc includes */
#include <assert.h>

View file

@ -30,7 +30,7 @@ extern "C" {
struct border * next; /* next border between these regions */
struct border * nexthash; /* next border between these regions */
struct region * from, * to; /* borders can be directed edges */
attrib * attribs;
struct attrib * attribs;
variant data;
unsigned int id; /* unique id */
} border;
@ -126,7 +126,7 @@ extern "C" {
extern border_type bt_road;
extern border_type bt_questportal;
extern attrib_type at_countdown;
extern struct attrib_type at_countdown;
#ifdef __cplusplus
}

View file

@ -267,13 +267,13 @@ siege_cmd(unit * u, order * ord)
ADDMSG(&u->faction->msgs, msg_message("siege",
"unit building destruction", u, b, d));
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
fset(u->faction, FL_DH);
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
fset(u->faction, FFL_SELECT);
/* Meldung fuer Burginsassen */
for (u2 = r->units; u2; u2 = u2->next) {
if (u2->building == b && !fval(u2->faction, FL_DH)) {
fset(u2->faction, FL_DH);
if (u2->building == b && !fval(u2->faction, FFL_SELECT)) {
fset(u2->faction, FFL_SELECT);
ADDMSG(&u2->faction->msgs, msg_message("siege",
"unit building destruction", u, b, d));
}

View file

@ -53,7 +53,7 @@ typedef struct construction {
* last level of a building points to NULL, as do objects of
* an unlimited size.
*/
attrib * attribs;
struct attrib * attribs;
/* stores skill modifiers and other attributes */
} construction;

View file

@ -13,6 +13,7 @@
*/
#include <config.h>
#include "eressea.h"
#include "building.h"
#include "attrib.h"
@ -25,12 +26,14 @@
#include "skill.h"
#include "magic.h"
#include "save.h"
#include "version.h"
/* util includes */
#include <util/base36.h>
#include <util/event.h>
#include <util/functions.h>
#include <util/language.h>
#include <util/lists.h>
#include <util/resolve.h>
#include <util/umlaut.h>
@ -490,7 +493,7 @@ destroy_building(building * b)
handle_event(b->attribs, "destroy", b);
}
extern attrib_type at_icastle;
extern struct attrib_type at_icastle;
int
buildingeffsize(const building * b, boolean img)

View file

@ -79,6 +79,8 @@ extern void bt_register(building_type * type);
#define BLD_UNGUARDED 0x04 /* you can enter this building anytime */
#define BLD_EXPANDED 0x08 /* has been expanded this turn */
#define BLD_SELECT 0x10 /* formerly FL_DH */
#define BLD_SAVEMASK 0x00 /* mask for persistent flags */
typedef struct building {
@ -134,7 +136,7 @@ extern struct building *findbuilding(int n);
extern struct unit * buildingowner(const struct region * r, const struct building * b);
extern attrib_type at_building_action;
extern struct attrib_type at_building_action;
#ifdef WDW_PYRAMID
extern int wdw_pyramid_level(const struct building *b);

View file

@ -5,6 +5,14 @@
extern "C" {
#endif
enum {
SEASON_WINTER,
SEASON_SPRING,
SEASON_SUMMER,
SEASON_AUTUMN
};
extern char *agename;
extern int first_turn;
extern int first_month;

View file

@ -24,16 +24,18 @@
#include "curse.h"
/* kernel includes */
#include "magic.h"
#include "skill.h"
#include "unit.h"
#include "region.h"
#include "race.h"
#include "faction.h"
#include "attrib.h"
#include "building.h"
#include "ship.h"
#include "faction.h"
#include "magic.h"
#include "message.h"
#include "objtypes.h"
#include "race.h"
#include "region.h"
#include "ship.h"
#include "skill.h"
#include "unit.h"
#include "version.h"
/* util includes */
#include <util/resolve.h>
@ -656,12 +658,12 @@ is_cursed_internal(attrib *ap, const curse_type *ct)
boolean
is_cursed_with(attrib *ap, curse *c)
is_cursed_with(const attrib *ap, const curse *c)
{
attrib *a = ap;
const attrib *a = ap;
while (a) {
if ((a->type->flags & ATF_CURSE) && (c == (curse *)a->data.v)) {
if ((a->type->flags & ATF_CURSE) && (c == (const curse *)a->data.v)) {
return true;
}
a = a->next;

View file

@ -218,17 +218,17 @@ typedef struct curse_type {
unsigned int mergeflags;
const char *info_str; /* Wirkung des curse, wird bei einer gelungenen
Zauberanalyse angezeigt */
struct message * (*curseinfo)(const void*, typ_t, const curse*, int);
struct message * (*curseinfo)(const void*, typ_t, const struct curse*, int);
void (*change_vigour)(curse*, double);
int (*read)(FILE * F, curse * c);
int (*write)(FILE * F, const curse * c);
int (*cansee)(const struct faction*, const void*, typ_t, const curse *, int);
int (*write)(FILE * F, const struct curse * c);
int (*cansee)(const struct faction*, const void*, typ_t, const struct curse *, int);
int (*age)(curse *);
} curse_type;
extern attrib_type at_curse;
extern void curse_write(const attrib * a,FILE * f);
extern int curse_read(struct attrib * a,FILE * f);
extern struct attrib_type at_curse;
extern void curse_write(const struct attrib * a, FILE * f);
extern int curse_read(struct attrib * a, FILE * f);
/* ------------------------------------------------------------- */
@ -257,11 +257,11 @@ extern void destroy_curse(curse * c);
boolean is_cursed_internal(struct attrib *ap, const curse_type * ctype);
/* ignoriert CURSE_ISNEW */
extern void remove_curse(struct attrib **ap, const curse * c);
extern void remove_curse(struct attrib **ap, const struct curse * c);
/* löscht einen konkreten Spruch auf einem Objekt.
*/
extern int curse_geteffect(const curse * c);
extern int curse_geteffect(const struct curse * c);
/* gibt die Auswirkungen der Verzauberungen zurück. zB bei
* Skillmodifiziernden Verzauberungen ist hier der Modifizierer
* gespeichert. Wird automatisch beim Anlegen eines neuen curse
@ -286,12 +286,12 @@ void transfer_curse(struct unit * u, struct unit * u2, int n);
* unterschiedlich gewünscht sein
* */
extern curse * get_cursex(attrib *ap, const curse_type * ctype, variant data,
boolean(*compare)(const curse *, variant));
extern struct curse * get_cursex(struct attrib *ap, const curse_type * ctype, variant data,
boolean(*compare)(const struct curse *, variant));
/* gibt pointer auf die erste curse-struct zurück, deren Typ ctype ist,
* und für die compare() true liefert, oder einen NULL-pointer.
* */
extern curse * get_curse(struct attrib *ap, const curse_type * ctype);
extern struct curse * get_curse(struct attrib *ap, const curse_type * ctype);
/* gibt pointer auf die erste curse-struct zurück, deren Typ ctype ist,
* oder einen NULL-pointer
* */
@ -310,13 +310,13 @@ extern void curse_init(struct attrib * a);
extern void curse_done(struct attrib * a);
extern int curse_age(struct attrib * a);
extern boolean cmp_curse(const attrib * a, const void * data);
extern boolean cmp_cursetype(const attrib * a, const void * data);
extern boolean cmp_curse(const struct attrib * a, const void * data);
extern boolean cmp_cursetype(const struct attrib * a, const void * data);
extern void * resolve_curse(variant data);
extern boolean is_cursed_with(attrib *ap, curse *c);
extern boolean is_cursed_with(const struct attrib *ap, const struct curse *c);
extern boolean curse_active(const curse * c);
extern boolean curse_active(const struct curse * c);
/* gibt true, wenn der Curse nicht NULL oder inaktiv ist */
/*** COMPATIBILITY MACROS. DO NOT USE FOR NEW CODE, REPLACE IN OLD CODE: */
@ -329,6 +329,9 @@ extern struct message * cinfo_simple(const void * obj, typ_t typ, const struct c
#define get_curseeffect(a, id, id2) \
curse_geteffect(get_curse(a, ct_find(oldcursename(id))))
/* eressea-defined attribute-type flags */
#define ATF_CURSE ATF_USER_DEFINED
#ifdef __cplusplus
}
#endif

View file

@ -26,8 +26,6 @@
/* attributes includes */
#include <attributes/reduceproduction.h>
#include <attributes/otherfaction.h>
#include <attributes/racename.h>
#include <attributes/gm.h>
/* kernel includes */
@ -59,11 +57,13 @@
#include "unit.h"
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/crmessage.h>
#include <util/event.h>
#include <util/functions.h>
#include <util/log.h>
#include <util/lists.h>
#include <util/rng.h>
#include <util/sql.h>
#include <util/translation.h>
@ -97,11 +97,6 @@ const struct race * new_race[MAXRACES];
boolean sqlpatch = false;
int turn;
static attrib_type at_creator = {
"creator"
/* Rest ist NULL; temporäres, nicht alterndes Attribut */
};
int
NewbieImmunity(void) {
static int value = -1;
@ -1529,9 +1524,7 @@ findkeyword(const char *s, const struct locale * lang)
struct tnode * tokens = get_translations(lang, UT_KEYWORDS);
variant token;
#ifdef AT_PERSISTENT
if (*s == '@') s++;
#endif
if (findtoken(tokens, s, &token)==E_TOK_NOMATCH) return NOKEYWORD;
if (global.disabled[token.i]) return NOKEYWORD;
return (keyword_t) token.i;
@ -1886,16 +1879,6 @@ newcontainerid(void)
return random_no;
}
static void
createunitid(unit *u, int id)
{
if (id<=0 || id > MAX_UNIT_NR || ufindhash(id) || dfindhash(id) || forbiddenid(id))
u->no = newunitid();
else
u->no = id;
uhash(u);
}
unit *
createunit(region * r, faction * f, int number, const struct race * rc)
{
@ -1903,111 +1886,6 @@ createunit(region * r, faction * f, int number, const struct race * rc)
return create_unit(r, f, number, rc, 0, NULL, NULL);
}
/** creates a new unit.
*
* @param dname: name, set to NULL to get a default.
* @param creator: unit to inherit stealth, group, building, ship, etc. from
*/
unit *
create_unit(region * r, faction * f, int number, const struct race *urace, int id, const char * dname, unit *creator)
{
unit * u = calloc(1, sizeof(unit));
order * deford = default_order(f->locale);
assert(urace);
assert(deford);
assert(f->alive);
u_setfaction(u, f);
set_order(&u->thisorder, NULL);
#ifdef LASTORDER
set_order(&u->lastorder, deford);
#else
addlist(&u->orders, deford);
#endif
u_seteffstealth(u, -1);
u->race = urace;
u->irace = urace;
set_number(u, number);
/* die nummer der neuen einheit muss vor name_unit generiert werden,
* da der default name immer noch 'Nummer u->no' ist */
createunitid(u, id);
/* zuerst in die Region setzen, da zb Drachennamen den Regionsnamen
* enthalten */
move_unit(u, r, NULL);
/* u->race muss bereits gesetzt sein, wird für default-hp gebraucht */
/* u->region auch */
u->hp = unit_max_hp(u) * number;
if (!dname) {
name_unit(u);
}
else set_string(&u->name, dname);
set_string(&u->display, "");
if (count_unit(u)) f->no_units++;
if (creator) {
attrib * a;
/* erbt Kampfstatus */
setstatus(u, creator->status);
/* erbt Gebäude/Schiff*/
if (creator->region==r) {
u->building = creator->building;
assert(creator->ship==NULL || fval(u->race, RCF_CANSAIL));
u->ship = creator->ship;
}
/* Tarnlimit wird vererbt */
if (fval(creator, UFL_STEALTH)) {
attrib * a = a_find(creator->attribs, &at_stealth);
if (a) {
int stealth = a->data.i;
a = a_add(&u->attribs, a_new(&at_stealth));
a->data.i = stealth;
}
}
/* Temps von parteigetarnten Einheiten sind wieder parteigetarnt */
if (fval(creator, UFL_PARTEITARNUNG)) {
fset(u, UFL_PARTEITARNUNG);
}
/* Daemonentarnung */
set_racename(&u->attribs, get_racename(creator->attribs));
if (fval(u->race, RCF_SHAPESHIFT) && fval(creator->race, RCF_SHAPESHIFT)) {
u->irace = creator->irace;
}
/* Gruppen */
if (fval(creator, UFL_GROUP)) {
a = a_find(creator->attribs, &at_group);
if (a) {
group * g = (group*)a->data.v;
a_add(&u->attribs, a_new(&at_group))->data.v = g;
fset(u, UFL_GROUP);
}
}
a = a_find(creator->attribs, &at_otherfaction);
if (a) {
a_add(&u->attribs, make_otherfaction(get_otherfaction(a)));
}
a = a_add(&u->attribs, a_new(&at_creator));
a->data.v = creator;
}
/* Monster sind grundsätzlich parteigetarnt */
if (f->no <= 0) fset(u, UFL_PARTEITARNUNG);
return u;
}
/* Setzt Default Befehle -------------------------------------- */
boolean
idle (faction * f)
{
@ -2419,7 +2297,7 @@ init_locales(void)
}
/* TODO: soll hier weg */
extern attrib_type at_shiptrail;
extern struct attrib_type at_shiptrail;
attrib_type at_germs = {
"germs",
@ -2763,16 +2641,16 @@ plagues(region * r, boolean ismagic)
if (!ismagic) {
double mwp = max(maxworkingpeasants(r), 1);
double prob = pow(rpeasants(r) / (mwp * wage(r, NULL, NULL) * 0.13), 4.0)
* SEUCHE;
* PLAGUE_CHANCE;
if (rng_double() >= prob) return;
}
peasants = rpeasants(r);
dead = (int)(0.5F + SEUCHENOPFER * peasants);
dead = (int)(0.5F + PLAGUE_VICTIMS * peasants);
for (i = dead; i != 0; i--) {
if (rng_int() % 100 < HEILCHANCE && rmoney(r) >= HEILKOSTEN) {
rsetmoney(r, rmoney(r) - HEILKOSTEN);
if (rng_double() < PLAGUE_HEALCHANCE && rmoney(r) >= PLAGUE_HEALCOST) {
rsetmoney(r, rmoney(r) - PLAGUE_HEALCOST);
} else {
--dead;
}

View file

@ -32,225 +32,27 @@ extern "C" {
* your game to use) in there.
* !!! DO NOT COMMIT THE SETTINGS.H FILE TO CVS !!!
*/
#include <settings.h>
#include "types.h"
/* basic types used in the eressea "kernel" */
#ifdef __TINYC__
#define order_t short
#define terrain_t short
#define direction_t short
#define race_t short
#define magic_t short
#define skill_t short
#define typ_t short
#define herb_t short
#define luxury_t short
#define weapon_t short
#define item_t short
#define spellid_t unsigned int
#else
typedef short order_t;
typedef short terrain_t;
typedef short direction_t;
typedef short race_t;
typedef short magic_t;
typedef short skill_t;
typedef short typ_t;
typedef short herb_t;
typedef short potion_t;
typedef short luxury_t;
typedef short weapon_t;
typedef short item_t;
typedef unsigned int spellid_t;
#endif
struct equipment;
struct plane;
struct order;
struct spell;
struct region;
struct curse;
struct fighter;
struct region_list;
struct race;
struct ship;
struct terrain_type;
struct building;
struct faction;
struct party;
struct unit;
struct unit_list;
struct item;
struct skill;
/* item */
struct strlist;
struct resource_type;
struct item_type;
struct potion_type;
struct luxury_type;
struct weapon_type;
/* types */
struct ship_type;
struct building_type;
#include <util/attrib.h>
#include <util/cvector.h>
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/variant.h>
#include <util/vmap.h>
#include <util/vset.h>
#define AT_PERSISTENT
#define ALLIED(f1, f2) (f1==f2 || (f1->alliance && f1->alliance==f2->alliance))
/* eressea-defined attribute-type flags */
#define ATF_CURSE ATF_USER_DEFINED
/* experimental gameplay features (that don't affect the savefile) */
#define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */
#define HERBS_ROT /* herbs owned by units have a chance to rot. */
#define SHIPDAMAGE /* Schiffsbeschädigungen */
#define INSECT_POTION /* Spezialtrank für Insekten */
#define ORCIFICATION /* gioving snotlings to the peasants gets counted */
#undef TROLLSAVE /* saving throw for dead trolls */
#undef AFFECT_SALARY /* gibt es ein attribut at_salary (ist noch nicht fertig!) */
#define OLD_FAMILIAR_MOD /* conversion required */
/* feature-dis/en-able */
#define NEW_DRIVE /* Neuer Algorithmus Transportiere/Fahre */
#define PARTIAL_STUDY /* Wenn nicht genug Silber vorhanden, wird ein Talent anteilig gelernt */
#define GOBLINKILL
#include <settings.h>
#define MONSTER_FACTION 0 /* Die Partei, in der die Monster sind. */
#define MAXPEASANTS_PER_AREA 10 /* number of peasants per region-size */
#define TREESIZE (MAXPEASANTS_PER_AREA-2) /* space used by trees (in #peasants) */
/**
* heaps and heaps of unsupported versions:
#define RACES_VERSION 91
#define MAGIEGEBIET_VERSION 92
#define FATTRIBS_VERSION 94
#define ATNORD_VERSION 95
#define NEWMAGIC 100
#define MEMSAVE_VERSION 101
#define BORDER_VERSION 102
#define ATNAME_VERSION 103
#define ATTRIBFIX_VERSION 104
#define BORDERID_VERSION 105
#define NEWROAD_VERSION 106
#define GUARD_VERSION 107
#define TIMEOUT_VERSION 108
#define GUARDFIX_VERSION 109
#define NEW_FACTIONID_VERSION 110
#define ACTIONFIX1_VERSION 111
#define SHIPTYPE_VERSION 112
#define GROUPS_VERSION 113
#define MSGLEVEL_VERSION 114
#define DISABLE_ROADFIX 114
#define FACTIONFLAGS_VERSION 114
#define KARMA_VERSION 114
#define FULL_BASE36_VERSION 115
**/
#define TYPES_VERSION 117
#define ITEMTYPE_VERSION 190
#define NOFOREST_VERSION 191
#define REGIONAGE_VERSION 192
#define CURSE_NO_VERSION 193
#define EFFSTEALTH_VERSION 194
#define MAGE_ATTRIB_VERSION 195
#define GLOBAL_ATTRIB_VERSION 196
#define BASE36IDS_VERSION 197
#define NEWSOURCE_VERSION 197
#define NEWSTATUS_VERSION 198
#define NEWNAMES_VERSION 199
#define LOCALE_VERSION 300
#define GROUPATTRIB_VERSION 301
#define NEWRESOURCE_VERSION 303
#define GROWTREE_VERSION 305
#define RANDOMIZED_RESOURCES_VERSION 306 /* should be the same, but doesn't work */
#define NEWRACE_VERSION 307
#define INTERIM_VERSION 309
#define NEWSKILL_VERSION 309
#define WATCHERS_VERSION 310
#define OVERRIDE_VERSION 311
#define CURSETYPE_VERSION 312
#define ALLIANCES_VERSION 313
#define DBLINK_VERSION 314
#define CURSEVIGOURISFLOAT_VERSION 315
#define SAVEXMLNAME_VERSION 316
#define SAVEALLIANCE_VERSION 317
#define CLAIM_VERSION 318
#define BACTION_VERSION 319 /* building action gets a param string */
#define NOLASTORDER_VERSION 320 /* do not use lastorder */
#define SPELLNAME_VERSION 321 /* reference spells by name */
#define TERRAIN_VERSION 322 /* terrains are a full type and saved by name */
#define REGIONITEMS_VERSION 323 /* regions have items */
#define ATTRIBREAD_VERSION 324 /* remove a_readint */
#define CURSEFLAGS_VERSION 325 /* remove a_readint */
#define MIN_VERSION CURSETYPE_VERSION
#define REGIONOWNERS_VERSION 400
#ifdef ENEMIES
# define RELEASE_VERSION ENEMIES_VERSION
#else
# define RELEASE_VERSION CURSEFLAGS_VERSION
#endif
#define RESOURCE_CONVERSION
#ifdef RESOURCE_CONVERSION
extern void init_resourcefix(void);
extern void read_iron(struct region * r, int iron);
extern void read_laen(struct region * r, int laen);
#endif
#define ECHECK_VERSION "4.01"
/* changes from->to: 72->73: struct unit::lock entfernt.
* 73->74: struct unit::flags eingeführt.
* 74->75: parteitarnung als flag.
* 75->76: #ifdef NEW_HP: hp
* 76->77: ship->damage
* 77->78: neue Message-Option "Orkvermehrung" (MAX_MSG +1)
* 78->79: showdata nicht mehr speichern
* 79->HEX_VERSION: hex
* 80->82: ATTRIB_VERSION
* 90: Ebenen
* 92: Magiegebiet-Auswahl f->magiegebiet
* 94: f->attribs wird gespeichert
* 100: NEWMAGIC, neue Message-Option "Zauber" (MAX_MSG +1)
* 108: Speichern von Timeouts
* 193: curse bekommen id aus struct unit-nummernraum
*/
/* NEWMAIL benutzt ein spezielles Skript zum Erstellen der Reportmails */
#define MAIL "eresseamail"
#define DEFAULT_LOCALE "de"
#define MAXPEASANTS_PER_AREA 10
/* So lange kann die Partei nicht angegriffen werden */
#undef STUDY_IF_NOT_WORKING
/** Attackierende Einheiten können keine langen Befehle ausführen */
#define DISALLOW_ATTACK_AND_WORK
/* Vermehrung trotz 90% Auslastung */
#define PEASANTFORCE 0.75
#define TREESIZE (MAXPEASANTS_PER_AREA-2)
/* Eisen in Bergregionen bei Erschaffung */
#define IRONSTART 250
/* Zuwachs Eisen in Bergregionen */
#define IRONPERTURN 25
#define MAXLAENPERTURN 6
/* Eisen in Gletschern */
#define GLIRONSTART 20
/* Zuwachs Eisen in Gletschern */
#define GLIRONPERTURN 3
/* Maximales Eisen in Gletschern */
#define MAXGLIRON 80
/* Verrottchance für Kräuter */
#define HERBROTCHANCE 5
#define HERBS_ROT
#define STUDYCOST 200
#define PEASANTFORCE 0.75 /* Chance einer Vermehrung trotz 90% Auslastung */
#define HERBROTCHANCE 5 /* Verrottchance für Kräuter (ifdef HERBS_ROT) */
/* Gebäudegröße = Minimalbelagerer */
#define SIEGEFACTOR 2
@ -260,56 +62,22 @@ extern void read_laen(struct region * r, int laen);
#define MAXALCHEMISTS 3
/** Plagues **/
/* Seuchenwahrscheinlichkeit (siehe plagues()) */
#define SEUCHE 0.1F
/* % Betroffene */
#define SEUCHENOPFER 0.2F
extern void plagues(struct region * r, boolean ismagic);
/** Healing **/
/* Wahrscheinlichkeit Heilung */
#define HEILCHANCE 25
/* Heilkosten */
#define HEILKOSTEN 30
#define PLAGUE_CHANCE 0.1F /* Seuchenwahrscheinlichkeit (siehe plagues()) */
#define PLAGUE_VICTIMS 0.2F /* % Betroffene */
#define PLAGUE_HEALCHANCE 0.25F /* Wahrscheinlichkeit Heilung */
#define PLAGUE_HEALCOST 30 /* Heilkosten */
/** Monster */
/* Chance für Monsterangriff */
#define MONSTERATTACK 0.4
#define MONSTERATTACK 0.4F /* Chance für Monsterangriff */
/** Gebäude */
/* Chance für Einsturz bei unversorgtem Gebaeude */
#define EINSTURZCHANCE 40
/* Soviele % überleben den Einsturz */
#define EINSTURZUEBERLEBEN 50
/** Geographie. Nicht im laufenden Spiel ändern!!! */
#define BLOCKSIZE 9
/* Nur Bewaffnete bewachen */
#undef TROLLSAVE
/* Spezialtrank für Insekten */
#define INSECT_POTION
/* Schiffsbeschädigungen */
#define SHIPDAMAGE
/* regionen im Report der Parteien werden nur einmal berechnet: */
#define FAST_REGION
#define COLLAPSE_CHANCE 0.4F /* Chance für Einsturz bei unversorgtem Gebaeude */
#define COLLAPSE_SURVIVAL 0.5F /* Soviele % überleben den Einsturz */
/* Magiesystem */
#define NIGHT_EYE_TALENT 5
/* gibt es ein attribut at_salary */
#undef AFFECT_SALARY
/* ist noch nicht fertig! */
#define ARENA_PLANE
#undef UNDERWORLD_PLANE
#define ORCIFICATION
/* Bewegungsweiten: */
#define BP_WALKING 4
#define BP_RIDING 6
@ -335,448 +103,25 @@ extern void plagues(struct region * r, boolean ismagic);
#define KEYWORDSIZE 15 /* max. Länge eines Keyword, ohne trailing 0 */
#define OBJECTIDSIZE (NAMESIZE+5+IDSIZE) /* max. Länge der Strings, die
* von struct unitname, etc. zurückgegeben werden. ohne die 0 */
#define CMDSIZE (DISPLAYSIZE*2+1)
#define STARTMONEY 5000
#define TAVERN_MAINTENANCE 14
/* Man gibt in einer Taverne mehr Geld aus! */
#define BAGCAPACITY 20000 /* soviel paßt in einen Bag of Holding */
#define STRENGTHCAPACITY 50000 /* zusätzliche Tragkraft beim Kraftzauber (deprecated) */
#define STRENGTHMULTIPLIER 50 /* multiplier for trollbelt */
typedef struct ursprung {
struct ursprung *next;
int id;
short x, y;
} ursprung;
/* ----------------- Befehle ----------------------------------- */
typedef unsigned char keyword_t;
enum {
K_KOMMENTAR,
K_BANNER,
K_WORK,
K_ATTACK,
K_STEAL,
K_BESIEGE,
K_NAME,
K_USE,
K_DISPLAY,
K_ENTER,
K_GUARD,
K_MAIL,
K_END,
K_DRIVE,
K_NUMBER,
K_WAR,
K_PEACE,
K_FOLLOW,
K_RESEARCH,
K_GIVE,
K_ALLY,
K_STATUS,
K_COMBAT,
K_BUY,
K_CONTACT,
K_TEACH,
K_STUDY,
K_LIEFERE,
K_MAKE,
K_MOVE,
K_PASSWORD,
K_RECRUIT,
K_RESERVE,
K_ROUTE,
K_SABOTAGE,
K_SEND,
K_SPY,
K_QUIT,
K_SETSTEALTH,
K_TRANSPORT,
K_TAX,
K_ENTERTAIN,
K_SELL,
K_LEAVE,
K_FORGET,
K_CAST,
K_RESHOW,
K_DESTROY,
K_BREED,
K_DEFAULT,
K_URSPRUNG,
K_EMAIL,
K_VOTE,
K_MAGIEGEBIET,
K_PIRACY,
K_RESTART,
K_GROUP,
K_SACRIFICE,
K_PRAY,
K_SORT,
K_SETJIHAD,
K_GM, /* perform GM commands */
K_INFO, /* set player-info */
K_PREFIX,
K_SYNONYM,
K_PLANT,
K_WEREWOLF,
K_XE,
K_ALLIANCE,
K_CLAIM,
#ifdef HEROES
K_PROMOTION,
#endif
MAXKEYWORDS,
NOKEYWORD = (keyword_t) - 1
};
extern const char *keywords[MAXKEYWORDS];
/* ------------------ Status von Einheiten --------------------- */
typedef unsigned char status_t;
enum {
ST_AGGRO,
ST_FIGHT,
ST_BEHIND,
ST_CHICKEN,
ST_AVOID,
ST_FLEE
};
/* ----------------- Parameter --------------------------------- */
typedef unsigned char param_t;
enum {
P_LOCALE,
P_ANY,
P_EACH,
P_PEASANT,
P_BUILDING,
P_UNIT,
P_PRIVAT,
P_BEHIND,
P_CONTROL,
P_HERBS,
P_NOT,
P_NEXT,
P_FACTION,
P_GAMENAME,
P_PERSON,
P_REGION,
P_SHIP,
P_SILVER,
P_ROAD,
P_TEMP,
P_FLEE,
P_GEBAEUDE,
P_GIB,
P_KAEMPFE,
P_TRAVEL,
P_GUARD,
P_ZAUBER,
P_PAUSE,
P_VORNE,
P_AGGRO,
P_CHICKEN,
P_LEVEL,
P_HELP,
P_FOREIGN,
P_AURA,
P_FOR,
P_AID,
P_MERCY,
P_AFTER,
P_BEFORE,
P_NUMBER,
P_ITEMS,
P_POTIONS,
P_GROUP,
P_FACTIONSTEALTH,
P_TREES,
P_XEPOTION,
P_XEBALLOON,
P_XELAEN,
MAXPARAMS,
NOPARAM = (param_t) - 1
};
typedef enum { /* Fehler und Meldungen im Report */
MSG_BATTLE,
MSG_EVENT,
MSG_MOVE,
MSG_INCOME,
MSG_COMMERCE,
MSG_PRODUCE,
MSG_ORCVERMEHRUNG,
MSG_MESSAGE,
MSG_COMMENT,
MSG_MAGIC,
MAX_MSG
} msg_t;
enum { /* Message-Level */
ML_IMPORTANT, /* Sachen, die IMO erscheinen _muessen_ */
ML_DEBUG,
ML_MISTAKE,
ML_WARN,
ML_INFO,
ML_MAX
};
extern const char *parameters[MAXPARAMS];
/* --------------- Reports Typen ------------------------------- */
enum {
O_REPORT, /* 1 */
O_COMPUTER, /* 2 */
O_ZUGVORLAGE, /* 4 */
O_SILBERPOOL, /* 8 */
O_STATISTICS, /* 16 */
O_DEBUG, /* 32 */
O_COMPRESS, /* 64 */
O_NEWS, /* 128 */
O_MATERIALPOOL, /* 256 */
O_ADRESSEN, /* 512 */
O_BZIP2, /* 1024 - compress as bzip2 */
O_SCORE, /* 2048 - punkte anzeigen? */
O_SHOWSKCHANGE, /* 4096 - Skillveränderungen anzeigen? */
O_XML, /* 8192 - XML report versenden */
MAXOPTIONS
};
#define want(i) (1<<i)
/** report options **/
#define want(option) (1<<option)
extern const char *options[MAXOPTIONS];
/* ------------------ Talente ---------------------------------- */
enum {
SK_ALCHEMY,
SK_CROSSBOW,
SK_MINING,
SK_LONGBOW,
SK_BUILDING,
SK_TRADE,
SK_LUMBERJACK,
SK_CATAPULT,
SK_HERBALISM,
SK_MAGIC,
SK_HORSE_TRAINING, /* 10 */
SK_RIDING,
SK_ARMORER,
SK_SHIPBUILDING,
SK_MELEE,
SK_SAILING,
SK_SPEAR,
SK_SPY,
SK_QUARRYING,
SK_ROAD_BUILDING,
SK_TACTICS, /* 20 */
SK_STEALTH,
SK_ENTERTAINMENT,
SK_WEAPONSMITH,
SK_CARTMAKER,
SK_OBSERVATION,
SK_TAXING,
SK_AUSDAUER,
SK_WEAPONLESS,
MAXSKILLS,
NOSKILL = (skill_t) -1
};
/* ------------- Typ von Einheiten ----------------------------- */
enum {
RC_DWARF, /* 0 - Zwerg */
RC_ELF,
RC_ORC,
RC_GOBLIN,
RC_HUMAN,
RC_TROLL,
RC_DAEMON,
RC_INSECT,
RC_HALFLING,
RC_CAT,
RC_AQUARIAN,
RC_URUK,
RC_SNOTLING,
RC_UNDEAD,
RC_ILLUSION,
RC_FIREDRAGON,
RC_DRAGON,
RC_WYRM,
RC_TREEMAN,
RC_BIRTHDAYDRAGON,
RC_DRACOID,
RC_SPECIAL,
RC_SPELL,
RC_IRONGOLEM,
RC_STONEGOLEM,
RC_SHADOW,
RC_SHADOWLORD,
RC_IRONKEEPER,
RC_ALP,
RC_TOAD,
RC_HIRNTOETER,
RC_PEASANT,
RC_WOLF = 32,
RC_SONGDRAGON = 37,
RC_SEASERPENT = 51,
RC_SHADOWKNIGHT,
RC_CENTAUR,
RC_SKELETON,
RC_SKELETON_LORD,
RC_ZOMBIE,
RC_ZOMBIE_LORD,
RC_GHOUL,
RC_GHOUL_LORD,
RC_MUS_SPIRIT,
RC_GNOME,
RC_TEMPLATE,
RC_CLONE,
MAXRACES,
NORACE = (race_t) - 1
};
/* movewhere error codes */
enum {
E_MOVE_OK = 0, /* possible to move */
E_MOVE_NOREGION, /* no region exists in this direction */
E_MOVE_BLOCKED /* cannot see this region, there is a blocking border. */
};
/* Richtungen */
enum {
D_NORTHWEST,
D_NORTHEAST,
D_EAST,
D_SOUTHEAST,
D_SOUTHWEST,
D_WEST,
MAXDIRECTIONS,
D_PAUSE,
D_SPECIAL,
NODIRECTION = (direction_t) - 1
};
/* Jahreszeiten, siehe auch res/timestrings */
enum {
SEASON_WINTER,
SEASON_SPRING,
SEASON_SUMMER,
SEASON_AUTUMN
};
/* Siegbedingungen */
#define VICTORY_NONE 0
#define VICTORY_MURDER 1
/* ------------------------------------------------------------- */
extern int shipspeed(const struct ship * sh, const struct unit * u);
extern int init_data(const char * filename);
/* MAXSPEED setzt die groesse fuer den Array, der die Kuesten Beschreibungen
* enthaelt. MAXSPEED muss 2x +3 so gross wie die groesste Geschw. sein
* (Zauberspruch) */
/* ------------------------------------------------------------- */
/* ------------------------------------------------------------- */
/* TODO
* werden diese hier eigendlich noch für irgendwas gebraucht?*/
/* Attribute: auf Einheiten */
/* Klassen */
enum {
A_KL_GEGENSTAND,
A_KL_EIGENSCHAFT
};
/* Eigenschaften (in i[0]) */
#define ZEIGE_PARTEI 1 /* Zeigt s[0] in eigenem Report an */
#define ZEIGE_ANDEREN 2 /* Zeigt s[1] in fremden Reports an */
#define TALENTMOD 4 /* Gegenstand verändert Talent
* i[2] um i[3] */
/* A_KL_EIGENSCHAFT */
enum {
A_TY_NOT_PARTEI_GETARNT, /* In i[0] die Pseudopartei?! */
A_TY_NOT_FLAGS, /* Verschiedene Eigenschaften in i[0] */
A_TY_EX_TYPNAME, /* Was soll als Typname erscheinen? s[0] =
* Singular, s[1] = Plural */
A_TY_EX_ZIELREGION,
A_TY_EX_BAUERNBLUT /* In i[0] die Zahl der max. geschützten
* Dämonen. */
};
/* A_TY_GESEHEN: fuer cansee() in i[0] steht drin, welche Partei uns
* sah, in i[1], wie gut (0,1 oder 2) */
/* Auf Regionen */
/* Klassen */
enum {
A_KL_MERKMAL,
A_KL_ZAUBER
};
/* A_KL_MERKMAL */
enum {
A_TY_MITHRIL,
A_TY_ADAMANTIUM,
A_TY_DIRECTION /* In s[0] describe_txt, in s[1] das command,
in i[0]-i[2] die Koordinaten des Ziels. */
};
/* Auf Schiffen */
/* Klassen */
enum {
A_KL_MERKMAL_SCHIFF
};
/* A_KL_MERKMAL */
enum {
A_TY_EX_KUESTE /* In i[0] steht die Richtung */
};
/* Auf Borders */
/* Klassen */
enum {
A_KL_BLOCK
};
enum {
A_TY_LOCK
};
#define DONT_HELP 0
#define HELP_MONEY 1 /* Mitversorgen von Einheiten */
#define HELP_FIGHT 2 /* Bei Verteidigung mithelfen */
@ -795,8 +140,6 @@ enum {
#define ALLIED_NOBLOCK 2
#define ALLIED_HELP 4
extern vmap region_map;
#define i2b(i) ((boolean)((i)?(true):(false)))
typedef struct ally {
@ -814,16 +157,6 @@ typedef struct strlist {
char * s;
} strlist;
#define FL_DH (1<<18) /* ehemals f->dh, u->dh, r->dh, etc... */
#define FL_MARK (1<<23) /* für markierende algorithmen, die das
* hinterher auch wieder löschen müssen!
* (FL_DH muss man vorher initialisieren,
* FL_MARK hinterher löschen) */
/* alle vierstelligen zahlen: */
#define MAX_UNIT_NR (36*36*36*36-1)
#define MAX_CONTAINER_NR (36*36*36*36-1)
#define fval(u, i) ((u)->flags & (i))
#define fset(u, i) ((u)->flags |= (i))
#define freset(u, i) ((u)->flags &= ~(i))
@ -919,7 +252,6 @@ int forbiddenid(int id);
int newcontainerid(void);
extern struct unit *createunit(struct region * r, struct faction * f, int number, const struct race * rc);
extern struct unit *create_unit(struct region * r1, struct faction * f, int number, const struct race * rc, int id, const char * dname, struct unit *creator);
extern void create_unitid(struct unit *u, int id);
extern boolean getunitpeasants;
extern struct unit *getunitg(const struct region * r, const struct faction * f);
@ -1054,11 +386,18 @@ extern int maxworkingpeasants(const struct region * r);
extern int wage(const struct region *r, const struct faction *f, const struct race * rc);
extern int maintenance_cost(const struct unit * u);
extern int movewhere(const struct unit *u, const char * token, struct region * r, struct region** resultp);
extern struct message * movement_error(struct unit * u, const char * token, struct order * ord, int error_code);
extern boolean move_blocked(const struct unit * u, const struct region *src, const struct region *dest);
extern void add_income(struct unit * u, int type, int want, int qty);
/* movewhere error codes */
enum {
E_MOVE_OK = 0, /* possible to move */
E_MOVE_NOREGION, /* no region exists in this direction */
E_MOVE_BLOCKED /* cannot see this region, there is a blocking border. */
};
extern int movewhere(const struct unit *u, const char * token, struct region * r, struct region** resultp);
extern const char * basepath(void);
extern const char * resourcepath(void);
extern void kernel_init(void);
@ -1122,7 +461,9 @@ extern int entertainmoney(const struct region * r);
extern int freadstr(FILE * F, char * str, size_t size);
extern int fwritestr(FILE * F, const char * str);
extern attrib_type at_guard;
extern void plagues(struct region * r, boolean ismagic);
extern struct attrib_type at_guard;
#if 1 /* disable to count all units */
# define count_unit(u) playerrace(u->race)

View file

@ -25,11 +25,14 @@
#include "region.h"
#include "terrain.h"
#include "unit.h"
#include "version.h"
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/goodies.h>
#include <util/lists.h>
#include <util/resolve.h>
#include <util/rng.h>
#include <util/variant.h>

View file

@ -38,9 +38,12 @@ typedef struct shortpwd {
#define FFL_ISNEW (1<<1)
#define FFL_RESTART (1<<2)
#define FFL_QUIT (1<<3)
/* #define FL_DH (1<<18) */
#define FFL_SELECT (1<<18) /* ehemals f->dh, u->dh, r->dh, etc... */
#define FFL_NOAID (1<<21) /* Hilfsflag Kampf */
/* #define FL_MARK (1<<23) */
#define FFL_MARK (1<<23) /* für markierende algorithmen, die das
* hinterher auch wieder löschen müssen!
* (FL_DH muss man vorher initialisieren,
* FL_MARK hinterher löschen) */
#define FFL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
#define FFL_OVERRIDE (1<<27) /* Override-Passwort wurde benutzt */
#define FFL_DBENTRY (1<<28) /* Partei ist in Datenbank eingetragen */

View file

@ -20,13 +20,15 @@
#include "unit.h"
#include "faction.h"
#include "save.h"
#include "version.h"
/* attrib includes */
#include <attributes/raceprefix.h>
/* util includes */
#include <resolve.h>
#include <base36.h>
#include <util/attrib.h>
#include <util/base36.h>
#include <util/resolve.h>
/* libc includes */
#include <stdlib.h>

View file

@ -24,7 +24,7 @@ typedef struct group {
struct group * next;
struct group * nexthash;
struct faction * f;
attrib *attribs;
struct attrib *attribs;
char * name;
struct ally * allies;
int flags;
@ -32,11 +32,11 @@ typedef struct group {
int members;
} group;
extern attrib_type at_group; /* attribute for units assigned to a group */
extern struct attrib_type at_group; /* attribute for units assigned to a group */
extern boolean join_group(struct unit * u, const char* name);
extern void free_group(group * g);
extern void free_group(struct group * g);
extern void write_groups(FILE * F, group * g);
extern void write_groups(FILE * F, struct group * g);
extern void read_groups(FILE * F, struct faction * f);
#ifdef __cplusplus

View file

@ -35,6 +35,7 @@
#include <triggers/timeout.h>
/* util includes */
#include <util/attrib.h>
#include <util/event.h>
#include <util/functions.h>
#include <util/goodies.h>
@ -76,8 +77,7 @@ enum {
H_GLACIER_1,
H_GLACIER_2,
H_GLACIER_3,
MAX_HERBS,
NOHERB = (herb_t) - 1
MAX_HERBS
};
static int

View file

@ -288,6 +288,9 @@
<File
RelativePath=".\terrain.h">
</File>
<File
RelativePath=".\types.h">
</File>
<File
RelativePath=".\unit.h">
</File>

View file

@ -42,6 +42,7 @@
#include "spellid.h"
#include "terrain.h"
#include "unit.h"
#include "version.h"
#include <triggers/timeout.h>
#include <triggers/shock.h>
@ -52,6 +53,7 @@
/* util includes */
#include <util/attrib.h>
#include <util/lists.h>
#include <util/resolve.h>
#include <util/rand.h>
#include <util/rng.h>

View file

@ -226,14 +226,14 @@ void magic(void);
void regeneration_magiepunkte(void);
extern attrib_type at_seenspell;
extern attrib_type at_mage;
extern attrib_type at_familiarmage;
extern attrib_type at_familiar;
extern attrib_type at_clonemage;
extern attrib_type at_clone;
extern attrib_type at_reportspell;
extern attrib_type at_icastle;
extern struct attrib_type at_seenspell;
extern struct attrib_type at_mage;
extern struct attrib_type at_familiarmage;
extern struct attrib_type at_familiar;
extern struct attrib_type at_clonemage;
extern struct attrib_type at_clone;
extern struct attrib_type at_reportspell;
extern struct attrib_type at_icastle;
typedef struct icastle_data {
const struct building_type * type;

View file

@ -50,6 +50,7 @@
#include <util/base36.h>
#include <util/goodies.h>
#include <util/language.h>
#include <util/lists.h>
#include <util/rand.h>
#include <util/rng.h>
@ -761,14 +762,14 @@ drifting_ships(region * r)
unit *u, *lastu = NULL;
message * msg = msg_message("ship_drift", "ship dir", sh, dir);
for (u=firstu;u;u=u->next) {
if (u->ship==sh && !fval(u->faction, FL_MARK)) {
fset(u->faction, FL_MARK);
if (u->ship==sh && !fval(u->faction, FFL_MARK)) {
fset(u->faction, FFL_MARK);
add_message(&u->faction->msgs, msg);
lastu = u->next;
}
}
for (u=firstu;u!=lastu;u=u->next) {
freset(u->faction, FL_MARK);
freset(u->faction, FFL_MARK);
}
msg_release(msg);
}
@ -2373,8 +2374,7 @@ move_hunters(void)
region *r;
for (r = regions; r; r = r->next) {
unit ** up = &r->units, * u;
for (u=r->units; u; u=u->next) freset(u, FL_DH);
unit ** up = &r->units;
while (*up!=NULL) {
unit * u = *up;

View file

@ -707,16 +707,3 @@ abkz(const char *s, size_t max)
return buf;
}
void
name_unit(unit *u)
{
char name[16];
if (u->race->generate_name) {
set_string(&u->name, (u->race->generate_name(u)));
} else {
sprintf(name, "%s %s", LOC(u->faction->locale, "unitdefault"), itoa36(u->no));
set_string(&u->name, name);
}
}

View file

@ -27,7 +27,6 @@ const char *drachen_name(const struct unit *u);
const char *dracoid_name(const struct unit *u);
const char *shadow_name(const struct unit *u);
const char *abkz(const char *s, size_t max);
void name_unit(struct unit *u);
#ifdef __cplusplus
}

View file

@ -12,11 +12,12 @@
#include <config.h>
#include "eressea.h"
#include "order.h"
#include "skill.h"
#include <util/bsdstring.h>
#include <util/language.h>
/* libc includes */
#include <assert.h>
@ -263,12 +264,10 @@ parse_order(const char * s, const struct locale * lang)
int persistent = 0;
int lindex;
#ifdef AT_PERSISTENT
while (*s=='@') {
persistent = 1;
++s;
}
#endif
sptr = s;
kwd = findkeyword(parse_token(&sptr), lang);
while (isspace(*(unsigned char*)sptr)) ++sptr;

View file

@ -69,6 +69,8 @@ extern boolean is_exclusive(const order *ord);
extern boolean is_repeated(const order * ord);
extern char * write_order(const order * ord, const struct locale * lang, char * buffer, size_t size);
#ifdef __cplusplus
}
#endif

View file

@ -99,7 +99,7 @@ free_nodes(node * root)
{
while (root!=NULL) {
region * r = root->r;
freset(r, FL_MARK);
freset(r, RF_MARK);
root = free_node(root);
}
}
@ -121,7 +121,7 @@ regions_in_range(struct region * start, int maxdist, boolean (*allowed)(const st
for (d=0;d!=MAXDIRECTIONS; ++d) {
region * rn = rconnect(r, d);
if (rn==NULL) continue;
if (fval(rn, FL_MARK)) continue; /* already been there */
if (fval(rn, RF_MARK)) continue; /* already been there */
if (allowed && !allowed(r, rn)) continue; /* can't go there */
/* add the region to the list of available ones. */
@ -129,7 +129,7 @@ regions_in_range(struct region * start, int maxdist, boolean (*allowed)(const st
/* make sure we don't go here again, and put the region into the set for
further BFS'ing */
fset(rn, FL_MARK);
fset(rn, RF_MARK);
*end = new_node(rn, depth, n);
end = &(*end)->next;
}
@ -150,7 +150,7 @@ internal_path_find(region *start, const region *target, int maxlen, boolean (*al
node * n = root;
boolean found = false;
assert(maxlen<=MAXDEPTH);
fset(start, FL_MARK);
fset(start, RF_MARK);
while (n!=NULL) {
region * r = n->r;
@ -159,7 +159,7 @@ internal_path_find(region *start, const region *target, int maxlen, boolean (*al
for (d=0;d!=MAXDIRECTIONS; ++d) {
region * rn = rconnect(r, d);
if (rn==NULL) continue;
if (fval(rn, FL_MARK)) continue; /* already been there */
if (fval(rn, RF_MARK)) continue; /* already been there */
if (!allowed(r, rn)) continue; /* can't go there */
if (rn==target) {
int i = depth;
@ -172,7 +172,7 @@ internal_path_find(region *start, const region *target, int maxlen, boolean (*al
found = true;
break;
} else {
fset(rn, FL_MARK);
fset(rn, RF_MARK);
*end = new_node(rn, depth, n);
end = &(*end)->next;
}
@ -188,7 +188,7 @@ internal_path_find(region *start, const region *target, int maxlen, boolean (*al
boolean
path_exists(region *start, const region *target, int maxlen, boolean (*allowed)(const region*, const region*))
{
assert((!fval(start, FL_MARK) && !fval(target, FL_MARK)) || !"Some Algorithm did not clear its FL_MARKs!");
assert((!fval(start, RF_MARK) && !fval(target, RF_MARK)) || !"Some Algorithm did not clear its RF_MARKs!");
if (start==target) return true;
if (internal_path_find(start, target, maxlen, allowed)!=NULL) return true;
return false;
@ -197,6 +197,6 @@ path_exists(region *start, const region *target, int maxlen, boolean (*allowed)(
region **
path_find(region *start, const region *target, int maxlen, boolean (*allowed)(const region*, const region*))
{
assert((!fval(start, FL_MARK) && !fval(target, FL_MARK)) || !"Did you call path_init()?");
assert((!fval(start, RF_MARK) && !fval(target, RF_MARK)) || !"Did you call path_init()?");
return internal_path_find(start, target, maxlen, allowed);
}

View file

@ -28,7 +28,9 @@
#include "faction.h"
/* util includes */
#include <resolve.h>
#include <util/attrib.h>
#include <util/resolve.h>
#include <util/lists.h>
/* libc includes */
#include <assert.h>

View file

@ -41,6 +41,7 @@
#include "skill.h"
#include "terrain.h"
#include "unit.h"
#include "version.h"
/* util includes */
#include <util/attrib.h>

View file

@ -40,6 +40,8 @@
#include "unit.h"
/* util includes */
#include <util/attrib.h>
#include <util/lists.h>
#include <util/resolve.h>
#include <util/rng.h>
@ -200,13 +202,14 @@ a_agedirection(attrib *a)
static int
a_readdirection(attrib *a, FILE *f)
{
char lbuf[16];
spec_direction *d = (spec_direction *)(a->data.v);
fscanf(f, "%hd %hd %d", &d->x, &d->y, &d->duration);
fscanf(f, "%s ", buf);
d->desc = strdup(cstring(buf));
fscanf(f, "%s ", buf);
d->keyword = strdup(cstring(buf));
d->active = true;
fscanf(f, "%15s ", lbuf);
d->desc = strdup(cstring(lbuf));
fscanf(f, "%15s ", lbuf);
d->keyword = strdup(cstring(lbuf));
d->active = true;
return AT_READ_OK;
}
@ -533,8 +536,6 @@ attrib_type at_travelunit = {
};
extern int laen_read(attrib * a, FILE * F);
#define LAEN_READ laen_read
#define LAEN_WRITE NULL
/***************/
/* at_laen */
@ -544,8 +545,8 @@ attrib_type at_laen = {
DEFAULT_INIT,
DEFAULT_FINALIZE,
DEFAULT_AGE,
LAEN_WRITE,
LAEN_READ,
NULL,
laen_read,
ATF_UNIQUE
};

View file

@ -46,7 +46,8 @@ extern "C" {
#define RF_COMBATDEBUG (1<<14)
#define RF_MAPPER_HIGHLIGHT (1<<14) /* only used by mapper, not stored */
#define RF_DH (1<<18)
#define RF_SELECT (1<<17)
#define RF_MARK (1<<18)
/* flags that speed up attribute access: */
#define RF_TRAVELUNIT (1<<19)
@ -146,16 +147,16 @@ int koor_distance(int ax, int ay, int bx, int by) ;
extern direction_t reldirection(const struct region * from, const struct region * to);
extern struct region * findregion(short x, short y);
extern attrib_type at_direction;
extern attrib_type at_moveblock;
extern struct attrib_type at_direction;
extern struct attrib_type at_moveblock;
/* new: */
extern attrib_type at_peasantluck;
extern attrib_type at_horseluck;
extern attrib_type at_chaoscount;
extern attrib_type at_woodcount;
extern attrib_type at_deathcount;
extern attrib_type at_travelunit;
extern attrib_type at_laen;
extern struct attrib_type at_peasantluck;
extern struct attrib_type at_horseluck;
extern struct attrib_type at_chaoscount;
extern struct attrib_type at_woodcount;
extern struct attrib_type at_deathcount;
extern struct attrib_type at_travelunit;
extern struct attrib_type at_laen;
void initrhash(void);
void rhash(struct region * r);

View file

@ -22,10 +22,9 @@
#include "reports.h"
/* kernel includes */
#include <kernel/curse.h>
#include <kernel/building.h>
#include <kernel/border.h>
#include <kernel/terrain.h>
#include <kernel/building.h>
#include <kernel/curse.h>
#include <kernel/faction.h>
#include <kernel/group.h>
#include <kernel/item.h>
@ -38,13 +37,16 @@
#include <kernel/region.h>
#include <kernel/ship.h>
#include <kernel/skill.h>
#include <kernel/terrain.h>
#include <kernel/unit.h>
/* util includes */
#include <util/attrib.h>
#include <util/bsdstring.h>
#include <util/base36.h>
#include <util/functions.h>
#include <util/goodies.h>
#include <util/lists.h>
/* libc includes */
#include <assert.h>
@ -1077,21 +1079,21 @@ get_regions_distance(region * root, int radius)
region_list * rptr, * rlist = NULL;
region_list ** rp = &rlist;
add_regionlist(rp, root);
fset(root, FL_MARK);
fset(root, RF_MARK);
while (*rp) {
region_list * r = *rp;
direction_t d;
rp = &r->next;
for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r->data, d);
if (rn!=NULL && !fval(rn, FL_MARK) && distance(rn, root)<=radius) {
if (rn!=NULL && !fval(rn, RF_MARK) && distance(rn, root)<=radius) {
add_regionlist(rp, rn);
fset(rn, FL_MARK);
fset(rn, RF_MARK);
}
}
}
for (rptr=rlist;rptr;rptr=rptr->next) {
freset(rptr->data, FL_MARK);
freset(rptr->data, RF_MARK);
}
return rlist;
}

View file

@ -47,6 +47,7 @@
#include "terrain.h"
#include "terrainid.h" /* only for conversion code */
#include "unit.h"
#include "version.h"
/* attributes includes */
#include <attributes/key.h>
@ -57,6 +58,7 @@
#include <util/bsdstring.h>
#include <util/event.h>
#include <util/goodies.h>
#include <util/lists.h>
#include <util/resolve.h>
#include <util/sql.h>
#include <util/rand.h>
@ -87,7 +89,36 @@ static region * current_region;
#ifdef RESOURCE_CONVERSION
int laen_read(attrib * a, FILE * F)
struct attrib_type at_resources = {
"resources", NULL, NULL, NULL, NULL, NULL, ATF_UNIQUE
};
static void
read_iron(struct region * r, int iron)
{
attrib * a = a_find(r->attribs, &at_resources);
assert(iron>=0);
if (a==NULL) {
a = a_add(&r->attribs, a_new(&at_resources));
a->data.sa[1] = -1;
}
a->data.sa[0] = (short)iron;
}
static void
read_laen(struct region * r, int laen)
{
attrib * a = a_find(r->attribs, &at_resources);
assert(laen>=0);
if (a==NULL) {
a = a_add(&r->attribs, a_new(&at_resources));
a->data.sa[0] = -1;
}
a->data.sa[1] = (short)laen;
}
int
laen_read(attrib * a, FILE * F)
{
int laen;
fscanf(F, "%d", &laen);
@ -760,36 +791,6 @@ read_items(FILE *F, item **ilist)
}
}
#ifdef RESOURCE_CONVERSION
struct attrib_type at_resources = {
"resources", NULL, NULL, NULL, NULL, NULL, ATF_UNIQUE
};
void
read_iron(struct region * r, int iron)
{
attrib * a = a_find(r->attribs, &at_resources);
assert(iron>=0);
if (a==NULL) {
a = a_add(&r->attribs, a_new(&at_resources));
a->data.sa[1] = -1;
}
a->data.sa[0] = (short)iron;
}
void
read_laen(struct region * r, int laen)
{
attrib * a = a_find(r->attribs, &at_resources);
assert(laen>=0);
if (a==NULL) {
a = a_add(&r->attribs, a_new(&at_resources));
a->data.sa[0] = -1;
}
a->data.sa[1] = (short)laen;
}
#endif
static void
read_alliances(FILE * F)
{
@ -939,7 +940,7 @@ lastturn(void)
}
void
fwriteorder(FILE * F, const order * ord, const struct locale * lang)
fwriteorder(FILE * F, const struct order * ord, const struct locale * lang)
{
write_order(ord, lang, buf, sizeof(buf));
if (buf[0]) fwritestr(F, buf);

View file

@ -56,10 +56,6 @@ extern void write_items(FILE *f, struct item *it);
extern const char * datapath(void);
#ifdef RESOURCE_CONVERSION
extern struct attrib_type at_resources;
#endif
extern void writeunit(FILE * stream, const struct unit * u);
extern struct unit * readunit(FILE * stream);

View file

@ -27,6 +27,7 @@
#include <util/base36.h>
#include <util/event.h>
#include <util/language.h>
#include <util/lists.h>
#include <util/umlaut.h>
#include <util/xml.h>

View file

@ -63,6 +63,7 @@ extern void st_register(const ship_type * type);
#define SF_DRIFTED 1<<0
#define SF_MOVED 1<<1
#define SF_DAMAGED 1<<2 /* for use in combat */
#define SF_SELECT 1<<3 /* previously FL_DH */
typedef struct ship {
struct ship *next;

View file

@ -24,6 +24,7 @@
#include "skill.h"
#include "curse.h"
#include "karma.h"
#include "item.h"
#include "magic.h"
#include "race.h"
@ -31,10 +32,10 @@
#include "terrain.h"
#include "terrainid.h"
#include "unit.h"
#include "karma.h"
#include <util/attrib.h>
#include <util/goodies.h>
#include <util/log.h>
#include <util/rng.h>
/* libc includes */

View file

@ -39,9 +39,9 @@ typedef struct skillmod_data {
int bonus;
int flags;
} skillmod_data;
extern attrib_type at_skillmod;
extern struct attrib_type at_skillmod;
extern int rc_skillmod(const struct race * rc, const struct region *r, skill_t sk);
extern int skillmod(const attrib * a, const struct unit * u, const struct region * r, skill_t sk, int value, int flags);
extern int skillmod(const struct attrib * a, const struct unit * u, const struct region * r, skill_t sk, int value, int flags);
extern void skill_init(void);
extern void skill_done(void);
extern struct attrib * make_skillmod(skill_t sk, unsigned int flags, skillmod_fun special, double multiplier, int bonus);

View file

@ -43,9 +43,10 @@
#include <attributes/racename.h>
/* util includes */
#include <util/vset.h>
#include <util/attrib.h>
#include <util/rand.h>
#include <util/rng.h>
#include <util/vset.h>
/* libc includes */
#include <assert.h>
@ -465,13 +466,12 @@ faction_skill(region * r, faction * f, skill_t sk)
int value = 0;
unit *u;
list_foreach(unit, r->units, u)
if (u->faction == f)
{
for (u=r->units; u; u=u->next) {
if (u->faction == f) {
int s = eff_skill(u, sk, r);
value = max(value, s);
}
list_next(u);
}
return value;
}

401
src/common/kernel/types.h Normal file
View file

@ -0,0 +1,401 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* based on:
*
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
* Atlantis v1.7 Copyright 1996 by Alex Schröder
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
* This program may not be sold or used commercially without prior written
* permission from the authors.
*/
#ifndef ERESSEA_TYPES_H
#define ERESSEA_TYPES_H
#include <util/variant.h>
typedef short terrain_t;
typedef short direction_t;
typedef short race_t;
typedef short magic_t;
typedef short skill_t;
typedef short typ_t;
typedef short item_t;
typedef unsigned int spellid_t;
struct attrib;
struct attrib_type;
struct building;
struct building_type;
struct curse;
struct equipment;
struct faction;
struct fighter;
struct item;
struct item_type;
struct locale;
struct luxury_type;
struct order;
struct plane;
struct potion_type;
struct race;
struct region;
struct region_list;
struct resource_type;
struct ship;
struct ship_type;
struct skill;
struct spell;
struct strlist;
struct terrain_type;
struct unit;
struct unit_list;
struct weapon_type;
typedef struct ursprung {
struct ursprung *next;
int id;
short x, y;
} ursprung;
/* ----------------- Befehle ----------------------------------- */
typedef unsigned char keyword_t;
enum {
K_KOMMENTAR,
K_BANNER,
K_WORK,
K_ATTACK,
K_STEAL,
K_BESIEGE,
K_NAME,
K_USE,
K_DISPLAY,
K_ENTER,
K_GUARD,
K_MAIL,
K_END,
K_DRIVE,
K_NUMBER,
K_WAR,
K_PEACE,
K_FOLLOW,
K_RESEARCH,
K_GIVE,
K_ALLY,
K_STATUS,
K_COMBAT,
K_BUY,
K_CONTACT,
K_TEACH,
K_STUDY,
K_LIEFERE,
K_MAKE,
K_MOVE,
K_PASSWORD,
K_RECRUIT,
K_RESERVE,
K_ROUTE,
K_SABOTAGE,
K_SEND,
K_SPY,
K_QUIT,
K_SETSTEALTH,
K_TRANSPORT,
K_TAX,
K_ENTERTAIN,
K_SELL,
K_LEAVE,
K_FORGET,
K_CAST,
K_RESHOW,
K_DESTROY,
K_BREED,
K_DEFAULT,
K_URSPRUNG,
K_EMAIL,
K_VOTE,
K_MAGIEGEBIET,
K_PIRACY,
K_RESTART,
K_GROUP,
K_SACRIFICE,
K_PRAY,
K_SORT,
K_SETJIHAD,
K_GM, /* perform GM commands */
K_INFO, /* set player-info */
K_PREFIX,
K_SYNONYM,
K_PLANT,
K_WEREWOLF,
K_XE,
K_ALLIANCE,
K_CLAIM,
K_PROMOTION,
MAXKEYWORDS,
NOKEYWORD = (keyword_t) - 1
};
/* ------------------ Status von Einheiten --------------------- */
typedef unsigned char status_t;
enum {
ST_AGGRO,
ST_FIGHT,
ST_BEHIND,
ST_CHICKEN,
ST_AVOID,
ST_FLEE
};
/* ----------------- Parameter --------------------------------- */
typedef unsigned char param_t;
enum {
P_LOCALE,
P_ANY,
P_EACH,
P_PEASANT,
P_BUILDING,
P_UNIT,
P_PRIVAT,
P_BEHIND,
P_CONTROL,
P_HERBS,
P_NOT,
P_NEXT,
P_FACTION,
P_GAMENAME,
P_PERSON,
P_REGION,
P_SHIP,
P_SILVER,
P_ROAD,
P_TEMP,
P_FLEE,
P_GEBAEUDE,
P_GIB,
P_KAEMPFE,
P_TRAVEL,
P_GUARD,
P_ZAUBER,
P_PAUSE,
P_VORNE,
P_AGGRO,
P_CHICKEN,
P_LEVEL,
P_HELP,
P_FOREIGN,
P_AURA,
P_FOR,
P_AID,
P_MERCY,
P_AFTER,
P_BEFORE,
P_NUMBER,
P_ITEMS,
P_POTIONS,
P_GROUP,
P_FACTIONSTEALTH,
P_TREES,
P_XEPOTION,
P_XEBALLOON,
P_XELAEN,
MAXPARAMS,
NOPARAM = (param_t) - 1
};
typedef enum { /* Fehler und Meldungen im Report */
MSG_BATTLE,
MSG_EVENT,
MSG_MOVE,
MSG_INCOME,
MSG_COMMERCE,
MSG_PRODUCE,
MSG_ORCVERMEHRUNG,
MSG_MESSAGE,
MSG_COMMENT,
MSG_MAGIC,
MAX_MSG
} msg_t;
enum { /* Message-Level */
ML_IMPORTANT, /* Sachen, die IMO erscheinen _muessen_ */
ML_DEBUG,
ML_MISTAKE,
ML_WARN,
ML_INFO,
ML_MAX
};
extern const char *parameters[MAXPARAMS];
/* --------------- Reports Typen ------------------------------- */
enum {
O_REPORT, /* 1 */
O_COMPUTER, /* 2 */
O_ZUGVORLAGE, /* 4 */
O_SILBERPOOL, /* 8 */
O_STATISTICS, /* 16 */
O_DEBUG, /* 32 */
O_COMPRESS, /* 64 */
O_NEWS, /* 128 */
O_MATERIALPOOL, /* 256 */
O_ADRESSEN, /* 512 */
O_BZIP2, /* 1024 - compress as bzip2 */
O_SCORE, /* 2048 - punkte anzeigen? */
O_SHOWSKCHANGE, /* 4096 - Skillveränderungen anzeigen? */
O_XML, /* 8192 - XML report versenden */
MAXOPTIONS
};
/* ------------------ Talente ---------------------------------- */
enum {
SK_ALCHEMY,
SK_CROSSBOW,
SK_MINING,
SK_LONGBOW,
SK_BUILDING,
SK_TRADE,
SK_LUMBERJACK,
SK_CATAPULT,
SK_HERBALISM,
SK_MAGIC,
SK_HORSE_TRAINING, /* 10 */
SK_RIDING,
SK_ARMORER,
SK_SHIPBUILDING,
SK_MELEE,
SK_SAILING,
SK_SPEAR,
SK_SPY,
SK_QUARRYING,
SK_ROAD_BUILDING,
SK_TACTICS, /* 20 */
SK_STEALTH,
SK_ENTERTAINMENT,
SK_WEAPONSMITH,
SK_CARTMAKER,
SK_OBSERVATION,
SK_TAXING,
SK_AUSDAUER,
SK_WEAPONLESS,
MAXSKILLS,
NOSKILL = (skill_t) -1
};
/* ------------- Typ von Einheiten ----------------------------- */
enum {
RC_DWARF, /* 0 - Zwerg */
RC_ELF,
RC_ORC,
RC_GOBLIN,
RC_HUMAN,
RC_TROLL,
RC_DAEMON,
RC_INSECT,
RC_HALFLING,
RC_CAT,
RC_AQUARIAN,
RC_URUK,
RC_SNOTLING,
RC_UNDEAD,
RC_ILLUSION,
RC_FIREDRAGON,
RC_DRAGON,
RC_WYRM,
RC_TREEMAN,
RC_BIRTHDAYDRAGON,
RC_DRACOID,
RC_SPECIAL,
RC_SPELL,
RC_IRONGOLEM,
RC_STONEGOLEM,
RC_SHADOW,
RC_SHADOWLORD,
RC_IRONKEEPER,
RC_ALP,
RC_TOAD,
RC_HIRNTOETER,
RC_PEASANT,
RC_WOLF = 32,
RC_SONGDRAGON = 37,
RC_SEASERPENT = 51,
RC_SHADOWKNIGHT,
RC_CENTAUR,
RC_SKELETON,
RC_SKELETON_LORD,
RC_ZOMBIE,
RC_ZOMBIE_LORD,
RC_GHOUL,
RC_GHOUL_LORD,
RC_MUS_SPIRIT,
RC_GNOME,
RC_TEMPLATE,
RC_CLONE,
MAXRACES,
NORACE = (race_t) - 1
};
/* Richtungen */
enum {
D_NORTHWEST,
D_NORTHEAST,
D_EAST,
D_SOUTHEAST,
D_SOUTHWEST,
D_WEST,
MAXDIRECTIONS,
D_PAUSE,
D_SPECIAL,
NODIRECTION = (direction_t) - 1
};
#define DONT_HELP 0
#define HELP_MONEY 1 /* Mitversorgen von Einheiten */
#define HELP_FIGHT 2 /* Bei Verteidigung mithelfen */
#define HELP_OBSERVE 4 /* Bei Wahrnehmung mithelfen */
#define HELP_GIVE 8 /* Dinge annehmen ohne KONTAKTIERE */
#define HELP_GUARD 16 /* Laesst Steuern eintreiben etc. */
#define HELP_FSTEALTH 32 /* Parteitarnung anzeigen. */
#define HELP_TRAVEL 64 /* Laesst Regionen betreten. */
#define HELP_ALL (127-HELP_TRAVEL-HELP_OBSERVE) /* Alle "positiven" HELPs zusammen */
/* HELP_OBSERVE deaktiviert */
/* ------------------------------------------------------------- */
/* Prototypen */
#define ALLIED_TAX 1
#define ALLIED_NOBLOCK 2
#define ALLIED_HELP 4
/* alle vierstelligen zahlen: */
#define MAX_UNIT_NR (36*36*36*36-1)
#define MAX_CONTAINER_NR (36*36*36*36-1)
#endif

View file

@ -40,11 +40,15 @@
#include "terrain.h"
#include <attributes/moved.h>
#include <attributes/otherfaction.h>
#include <attributes/racename.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/goodies.h>
#include <util/lists.h>
#include <util/resolve.h>
#include <util/rng.h>
#include <util/variant.h>
@ -57,6 +61,11 @@
#define FIND_FOREIGN_TEMP
attrib_type at_creator = {
"creator"
/* Rest ist NULL; temporäres, nicht alterndes Attribut */
};
const unit *
u_peasants(void)
{
@ -1259,6 +1268,133 @@ unitlist_insert(struct unit_list **ul, struct unit *u)
*ul = rl2;
}
static void
createunitid(unit *u, int id)
{
if (id<=0 || id > MAX_UNIT_NR || ufindhash(id) || dfindhash(id) || forbiddenid(id))
u->no = newunitid();
else
u->no = id;
uhash(u);
}
void
name_unit(unit *u)
{
char name[16];
if (u->race->generate_name) {
set_string(&u->name, (u->race->generate_name(u)));
} else {
sprintf(name, "%s %s", LOC(u->faction->locale, "unitdefault"), itoa36(u->no));
set_string(&u->name, name);
}
}
/** creates a new unit.
*
* @param dname: name, set to NULL to get a default.
* @param creator: unit to inherit stealth, group, building, ship, etc. from
*/
unit *
create_unit(region * r, faction * f, int number, const struct race *urace, int id, const char * dname, unit *creator)
{
unit * u = calloc(1, sizeof(unit));
order * deford = default_order(f->locale);
assert(urace);
assert(deford);
assert(f->alive);
u_setfaction(u, f);
set_order(&u->thisorder, NULL);
#ifdef LASTORDER
set_order(&u->lastorder, deford);
#else
addlist(&u->orders, deford);
#endif
u_seteffstealth(u, -1);
u->race = urace;
u->irace = urace;
set_number(u, number);
/* die nummer der neuen einheit muss vor name_unit generiert werden,
* da der default name immer noch 'Nummer u->no' ist */
createunitid(u, id);
/* zuerst in die Region setzen, da zb Drachennamen den Regionsnamen
* enthalten */
move_unit(u, r, NULL);
/* u->race muss bereits gesetzt sein, wird für default-hp gebraucht */
/* u->region auch */
u->hp = unit_max_hp(u) * number;
if (!dname) {
name_unit(u);
}
else set_string(&u->name, dname);
set_string(&u->display, "");
if (count_unit(u)) f->no_units++;
if (creator) {
attrib * a;
/* erbt Kampfstatus */
setstatus(u, creator->status);
/* erbt Gebäude/Schiff*/
if (creator->region==r) {
u->building = creator->building;
assert(creator->ship==NULL || fval(u->race, RCF_CANSAIL));
u->ship = creator->ship;
}
/* Tarnlimit wird vererbt */
if (fval(creator, UFL_STEALTH)) {
attrib * a = a_find(creator->attribs, &at_stealth);
if (a) {
int stealth = a->data.i;
a = a_add(&u->attribs, a_new(&at_stealth));
a->data.i = stealth;
}
}
/* Temps von parteigetarnten Einheiten sind wieder parteigetarnt */
if (fval(creator, UFL_PARTEITARNUNG)) {
fset(u, UFL_PARTEITARNUNG);
}
/* Daemonentarnung */
set_racename(&u->attribs, get_racename(creator->attribs));
if (fval(u->race, RCF_SHAPESHIFT) && fval(creator->race, RCF_SHAPESHIFT)) {
u->irace = creator->irace;
}
/* Gruppen */
if (fval(creator, UFL_GROUP)) {
a = a_find(creator->attribs, &at_group);
if (a) {
group * g = (group*)a->data.v;
a_add(&u->attribs, a_new(&at_group))->data.v = g;
fset(u, UFL_GROUP);
}
}
a = a_find(creator->attribs, &at_otherfaction);
if (a) {
a_add(&u->attribs, make_otherfaction(get_otherfaction(a)));
}
a = a_add(&u->attribs, a_new(&at_creator));
a->data.v = creator;
}
/* Monster sind grundsätzlich parteigetarnt */
if (f->no <= 0) fset(u, UFL_PARTEITARNUNG);
return u;
}
#ifdef HEROES
int
maxheroes(const struct faction * f)

View file

@ -48,7 +48,6 @@ struct item;
/* warning: von 512/1024 gewechslet, wegen konflikt mit NEW_FOLLOW */
#define UFL_LOCKED (1<<16) /* Einheit kann keine Personen aufnehmen oder weggeben, nicht rekrutieren. */
#define UFL_DH (1<<18) /* same as FL_DH */
#define UFL_STORM (1<<19) /* Kapitän war in einem Sturm */
#define UFL_FOLLOWING (1<<20)
#define UFL_FOLLOWED (1<<21)
@ -219,6 +218,10 @@ extern boolean learn_skill(struct unit * u, skill_t sk, double chance);
extern int invisible(const struct unit *target, const struct unit * viewer);
extern void stripunit(struct unit * u);
extern void name_unit(struct unit *u);
extern struct unit * create_unit(struct region * r1, struct faction * f, int number, const struct race * rc, int id, const char * dname, struct unit *creator);
extern struct attrib_type at_creator;
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,75 @@
/* vi: set ts=2:
+-------------------+
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2007 | Christian Schlittchen <corwin@amber.kn-bremen.de>
| |
+-------------------+
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
/* changes from->to: 72->73: struct unit::lock entfernt.
* 73->74: struct unit::flags eingeführt.
* 74->75: parteitarnung als flag.
* 75->76: #ifdef NEW_HP: hp
* 76->77: ship->damage
* 77->78: neue Message-Option "Orkvermehrung" (MAX_MSG +1)
* 78->79: showdata nicht mehr speichern
* 79->HEX_VERSION: hex
* 80->82: ATTRIB_VERSION
* 90: Ebenen
* 92: Magiegebiet-Auswahl f->magiegebiet
* 94: f->attribs wird gespeichert
* 100: NEWMAGIC, neue Message-Option "Zauber" (MAX_MSG +1)
* 108: Speichern von Timeouts
* 193: curse bekommen id aus struct unit-nummernraum
*/
#define TYPES_VERSION 117
#define ITEMTYPE_VERSION 190
#define NOFOREST_VERSION 191
#define REGIONAGE_VERSION 192
#define CURSE_NO_VERSION 193
#define EFFSTEALTH_VERSION 194
#define MAGE_ATTRIB_VERSION 195
#define GLOBAL_ATTRIB_VERSION 196
#define BASE36IDS_VERSION 197
#define NEWSOURCE_VERSION 197
#define NEWSTATUS_VERSION 198
#define NEWNAMES_VERSION 199
#define LOCALE_VERSION 300
#define GROUPATTRIB_VERSION 301
#define NEWRESOURCE_VERSION 303
#define GROWTREE_VERSION 305
#define RANDOMIZED_RESOURCES_VERSION 306 /* should be the same, but doesn't work */
#define NEWRACE_VERSION 307
#define INTERIM_VERSION 309
#define NEWSKILL_VERSION 309
#define WATCHERS_VERSION 310
#define OVERRIDE_VERSION 311
#define CURSETYPE_VERSION 312
#define ALLIANCES_VERSION 313
#define DBLINK_VERSION 314
#define CURSEVIGOURISFLOAT_VERSION 315
#define SAVEXMLNAME_VERSION 316
#define SAVEALLIANCE_VERSION 317
#define CLAIM_VERSION 318
#define BACTION_VERSION 319 /* building action gets a param string */
#define NOLASTORDER_VERSION 320 /* do not use lastorder */
#define SPELLNAME_VERSION 321 /* reference spells by name */
#define TERRAIN_VERSION 322 /* terrains are a full type and saved by name */
#define REGIONITEMS_VERSION 323 /* regions have items */
#define ATTRIBREAD_VERSION 324 /* remove a_readint */
#define CURSEFLAGS_VERSION 325 /* remove a_readint */
#define MIN_VERSION CURSETYPE_VERSION
#define REGIONOWNERS_VERSION 400
#ifdef ENEMIES
# define RELEASE_VERSION ENEMIES_VERSION
#else
# define RELEASE_VERSION CURSEFLAGS_VERSION
#endif

View file

@ -29,10 +29,12 @@ without prior permission by the authors of Eressea.
#include "calendar.h"
/* util includes */
#include <util/attrib.h>
#include <util/crmessage.h>
#include <util/functions.h>
#include <util/message.h>
#include <util/nrmessage.h>
#include <util/crmessage.h>
#include <util/language.h>
/* libxml includes */
#include <libxml/tree.h>

View file

@ -46,10 +46,12 @@
#include <kernel/unit.h>
/* util include */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/functions.h>
#include <util/goodies.h>
#include <util/lists.h>
#include <util/resolve.h>
#include <util/rng.h>
@ -341,6 +343,8 @@ guardian_faction(plane * pl, int id)
}
}
#define BLOCKSIZE 9
static void
block_create(short x1, short y1, char terrain)
{

View file

@ -28,6 +28,7 @@
/* util includes */
#include <util/base36.h>
#include <util/goodies.h>
#include <util/lists.h>
#include <util/rng.h>
#include <util/sql.h>
@ -82,10 +83,10 @@ recurse_regions(region *r, region_list **rlist, boolean(*fun)(const region *r))
rl->next = *rlist;
rl->data = r;
(*rlist) = rl;
fset(r, FL_MARK);
fset(r, RF_MARK);
for (d=0;d!=MAXDIRECTIONS;++d) {
region * nr = rconnect(r, d);
if (nr && !fval(nr, FL_MARK)) len += recurse_regions(nr, rlist, fun);
if (nr && !fval(nr, RF_MARK)) len += recurse_regions(nr, rlist, fun);
}
return len+1;
}
@ -145,7 +146,7 @@ fix_demand(region *r)
}
}
}
freset(r, FL_MARK); /* undo recursive marker */
freset(r, RF_MARK); /* undo recursive marker */
}
if (maxlux<2) {
int i;
@ -414,7 +415,7 @@ get_island(region * root, region_list ** rlist)
region_list ** rnext = rlist;
while (*rnext) rnext=&(*rnext)->next;
fset(root, FL_MARK);
fset(root, RF_MARK);
add_regionlist(rnext, root);
while (*rnext) {
@ -425,8 +426,8 @@ get_island(region * root, region_list ** rlist)
for (dir=0;dir!=MAXDIRECTIONS;++dir) {
region * r = rconnect(rcurrent, dir);
if (r!=NULL && r->land && !fval(r, FL_MARK)) {
fset(r, FL_MARK);
if (r!=NULL && r->land && !fval(r, RF_MARK)) {
fset(r, RF_MARK);
add_regionlist(rnext, r);
}
}
@ -434,7 +435,7 @@ get_island(region * root, region_list ** rlist)
rnext=rlist;
while (*rnext) {
region_list * rptr = *rnext;
freset(rptr->data, FL_MARK);
freset(rptr->data, RF_MARK);
rnext = &rptr->next;
}
}
@ -447,25 +448,25 @@ island_size(region * r)
region_list * island = NULL;
add_regionlist(&rlist, r);
island = rlist;
fset(r, FL_MARK);
fset(r, RF_MARK);
while (rlist) {
direction_t d;
r = rlist->data;
++size;
for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d);
if (rn && !fval(rn, FL_MARK) && rn->land) {
if (rn && !fval(rn, RF_MARK) && rn->land) {
region_list * rnew = malloc(sizeof(region_list));
rnew->data = rn;
rnew->next = rlist->next;
rlist->next = rnew;
fset(rn, FL_MARK);
fset(rn, RF_MARK);
}
}
rlist = rlist->next;
}
for (rlist=island;rlist;rlist=rlist->next) {
freset(rlist->data, FL_MARK);
freset(rlist->data, RF_MARK);
}
free_regionlist(island);
return size;
@ -525,14 +526,14 @@ autoseed(newfaction ** players, int nsize, boolean new_island)
unit * u;
for (u=r->units;u;u=u->next) {
f = u->faction;
if (!fval(f, FL_MARK)) {
if (!fval(f, FFL_MARK)) {
++psize;
fset(f, FL_MARK);
fset(f, FFL_MARK);
}
}
}
free_regionlist(rlist);
if (psize>0) for (f=factions;f;f=f->next) freset(f, FL_MARK);
if (psize>0) for (f=factions;f;f=f->next) freset(f, FFL_MARK);
if (psize<PLAYERS_PER_ISLAND) {
r = rmin;
}
@ -573,7 +574,7 @@ autoseed(newfaction ** players, int nsize, boolean new_island)
}
if (r!=NULL) {
add_regionlist(&rlist, r);
fset(r, FL_MARK);
fset(r, RF_MARK);
rsize = 1;
}
@ -585,20 +586,20 @@ autoseed(newfaction ** players, int nsize, boolean new_island)
while (i--) rnext=&(*rnext)->next;
rfind = *rnext;
r = rfind->data;
freset(r, FL_MARK);
freset(r, RF_MARK);
*rnext = rfind->next;
free(rfind);
--rsize;
for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d);
if (rn && fval(rn, FL_MARK)) continue;
if (rn && fval(rn, RF_MARK)) continue;
if (virgin_region(rn)) {
if (rn==NULL) {
rn = new_region(r->x + delta_x[d], r->y + delta_y[d]);
terraform(rn, T_OCEAN);
}
add_regionlist(&rlist, rn);
fset(rn, FL_MARK);
fset(rn, RF_MARK);
++rsize;
}
}
@ -727,7 +728,7 @@ autoseed(newfaction ** players, int nsize, boolean new_island)
while (rlist) {
region_list * self = rlist;
rlist = rlist->next;
freset(self->data, FL_MARK);
freset(self->data, RF_MARK);
free(self);
}
}

View file

@ -39,6 +39,7 @@
#include <util/base36.h>
#include <util/event.h>
#include <util/goodies.h>
#include <util/lists.h>
#include <util/umlaut.h>
#include <util/rng.h>
@ -285,14 +286,14 @@ gm_messageplane(const tnode * tnext, const char * str, void * data, struct order
faction * f;
region * r;
for (f=factions;f;f=f->next) {
freset(f, FL_DH);
freset(f, FFL_SELECT);
}
for (r=regions;r;r=r->next) {
unit * u;
if (rplane(r)!=p) continue;
for (u=r->units;u;u=u->next) if (!fval(u->faction, FL_DH)) {
for (u=r->units;u;u=u->next) if (!fval(u->faction, FFL_SELECT)) {
f = u->faction;
fset(f, FL_DH);
fset(f, FFL_SELECT);
add_message(&f->msgs, msg);
}
}

View file

@ -22,10 +22,10 @@ extern "C" {
#error "must define MUSEUM_MODULE to use this module"
#endif
extern attrib_type at_warden;
extern attrib_type at_museumexit;
extern attrib_type at_museumgivebackcookie;
extern attrib_type at_museumgiveback;
extern struct attrib_type at_warden;
extern struct attrib_type at_museumexit;
extern struct attrib_type at_museumgivebackcookie;
extern struct attrib_type at_museumgiveback;
typedef struct {
int warden_no;

View file

@ -30,8 +30,11 @@
#include <kernel/ship.h>
#include <kernel/unit.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
/* libc includes */
#include <base36.h>
#include <stdlib.h>
#include <string.h>

View file

@ -17,7 +17,7 @@ extern "C" {
#endif
#ifdef XECMD_MODULE
extern attrib_type at_xontormiaexpress;
extern struct attrib_type at_xontormiaexpress;
int xecmd(struct unit * u, struct order * ord);
#endif

View file

@ -47,3 +47,5 @@
#undef FUZZY_BASE36
#define SIMPLE_COMBAT
#define SIMPLE_ESCAPE
#define RESOURCE_CONVERSION /* support for data files < NEWRESOURCE_VERSION */

View file

@ -12,16 +12,20 @@
*/
#include <config.h>
#include <eressea.h>
#include <kernel/eressea.h>
#include "alp.h"
#include <unit.h>
#include <region.h>
#include <skill.h>
#include <magic.h>
#include <kernel/eressea.h>
#include <kernel/magic.h>
#include <kernel/region.h>
#include <kernel/skill.h>
#include <kernel/unit.h>
/* util includes */
#include <event.h>
#include <util/attrib.h>
#include <util/event.h>
#include <util/umlaut.h>
#include <triggers/createcurse.h>
#include <triggers/killunit.h>
#include <triggers/removecurse.h>
@ -101,9 +105,8 @@ sp_summon_alp(struct castorder *co)
* Regionsberichte von ihm. Er erhält aber später eine Mitteilung,
* sobald der Alp sein Opfer erreicht hat.
*/
alp = createunit(r, findfaction(MONSTER_FACTION), 1, new_race[RC_ALP]);
alp = create_unit(r, findfaction(MONSTER_FACTION), 1, new_race[RC_ALP], 0, "Alp", NULL);
set_level(alp, SK_STEALTH, 7);
set_string(&alp->name, "Alp");
setstatus(alp, ST_FLEE); /* flieht */
{

View file

@ -26,6 +26,7 @@
#include <util/nrmessage.h>
#include <util/base36.h>
#include <util/functions.h>
#include <util/language.h>
/* libc includes */
#include <string.h>

View file

@ -31,6 +31,7 @@
#include <kernel/skill.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/rand.h>
#include <util/rng.h>

View file

@ -23,8 +23,9 @@
#include <curse.h>
/* util includes */
#include <functions.h>
#include <base36.h>
#include <util/base36.h>
#include <util/functions.h>
#include <util/language.h>
/* libc includes */
#include <string.h>

View file

@ -59,11 +59,13 @@ extern void ct_register(const struct curse_type * ct);
#include <spells/alp.h>
/* util includes */
#include <util/umlaut.h>
#include <util/attrib.h>
#include <util/base36.h>
#include <util/umlaut.h>
#include <util/message.h>
#include <util/event.h>
#include <util/functions.h>
#include <util/lists.h>
#include <util/rand.h>
#include <util/variant.h>
#include <util/goodies.h>
@ -377,11 +379,11 @@ report_effect(region * r, unit * mage, message * seen, message * unseen)
unit * u;
/* melden, 1x pro Partei */
freset(mage->faction, FL_DH);
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
freset(mage->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
/* Bei Fernzaubern sieht nur die eigene Partei den Magier */
if (u->faction != mage->faction) {
@ -403,7 +405,7 @@ report_effect(region * r, unit * mage, message * seen, message * unseen)
}
/* Ist niemand von der Partei des Magiers in der Region, dem Magier
* nochmal gesondert melden */
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
add_message(&mage->faction->msgs, seen);
}
}
@ -802,19 +804,19 @@ sp_goodwinds(castorder *co)
create_curse(mage, &sh->attribs, ct_find("nodrift"), power, duration, zero_effect, 0);
/* melden, 1x pro Partei */
freset(mage->faction, FL_DH);
for(u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
freset(mage->faction, FFL_SELECT);
for(u = r->units; u; u = u->next ) freset(u->faction, FFL_SELECT);
for(u = r->units; u; u = u->next ) {
if (u->ship != sh ) /* nur den Schiffsbesatzungen! */
continue;
if (!fval(u->faction, FL_DH) ) {
if (!fval(u->faction, FFL_SELECT) ) {
message * m = msg_message("wind_effect", "mage ship", cansee(u->faction, r, mage, 0) ? mage:NULL, sh);
r_addmessage(r, u->faction, m);
msg_release(m);
fset(u->faction, FL_DH);
fset(u->faction, FFL_SELECT);
}
}
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
message * m = msg_message("wind_effect", "mage ship", mage, sh);
r_addmessage(r, mage->faction, m);
msg_release(m);
@ -1673,11 +1675,11 @@ sp_great_drought(castorder *co)
}
/* melden, 1x pro partei */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next) {
if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
sprintf(buf, "%s ruft das Feuer der Sonne auf %s hinab.",
cansee(u->faction, r, mage, 0)? unitname(mage) : "Jemand",
regionname(r, u->faction));
@ -1707,7 +1709,7 @@ sp_great_drought(castorder *co)
}
}
}
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
ADDMSG(&mage->faction->msgs, msg_message(
"drought_effect", "mage region", mage, r));
}
@ -1793,12 +1795,12 @@ sp_treewalkenter(castorder *co)
erfolg = cast_level;
/* Meldungen in der Ausgangsregion */
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = r->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_disappear", "unit", u);
r_addmessage(r, u2->faction, m);
}
@ -1807,12 +1809,12 @@ sp_treewalkenter(castorder *co)
if (m) msg_release(m);
/* Meldungen in der Zielregion */
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = rt->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_appear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -1927,12 +1929,12 @@ sp_treewalkexit(castorder *co)
/* Meldungen in der Ausgangsregion */
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for(u2 = r->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_disappear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -1942,12 +1944,12 @@ sp_treewalkexit(castorder *co)
/* Meldungen in der Zielregion */
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = rt->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_appear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -2037,10 +2039,10 @@ sp_homestone(castorder *co)
c_setflag(c, CURSE_NOAGE);
/* melden, 1x pro Partei in der Burg */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next) {
if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
if (u->building == mage->building) {
sprintf(buf, "Mit einem Ritual bindet %s die magischen Kräfte "
"der Erde in die Mauern von %s", unitname(mage),
@ -2086,16 +2088,16 @@ sp_drought(castorder *co)
}
/* melden, 1x pro Partei */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for(u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
sprintf(buf, "%s verflucht das Land, und eine Dürreperiode beginnt.",
cansee(u->faction, r, mage, 0) ? unitname(mage) : "Jemand");
addmessage(r, u->faction, buf, MSG_EVENT, ML_INFO);
}
}
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
sprintf(buf, "%s verflucht das Land, und eine Dürreperiode beginnt.",
unitname(mage));
addmessage(0, mage->faction, buf, MSG_MAGIC, ML_INFO);
@ -2171,15 +2173,15 @@ sp_fog_of_confusion(castorder *co)
if (!ctype) ctype = ct_find("disorientationzone");
c = create_curse(mage, &r2->attribs, ctype, power, duration, effect, 0);
for (u = r2->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r2->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r2->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
if (!m) m = msg_message("confusion_result", "mage", mage);
add_message(&u->faction->msgs, m);
}
}
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
if (!m) m = msg_message("confusion_result", "mage", mage);
add_message(&mage->faction->msgs, m);
}
@ -2272,8 +2274,8 @@ sp_stormwinds(castorder *co)
message * m = NULL;
/* melden vorbereiten */
freset(mage->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
freset(mage->faction, FFL_SELECT);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (n = 0; n < pa->length; n++) {
if (force<=0) break;
@ -2308,15 +2310,15 @@ sp_stormwinds(castorder *co)
for(u = r->units; u; u = u->next ) {
if (u->ship == sh ) {
/* nur den Schiffsbesatzungen! */
fset(u->faction, FL_DH);
fset(u->faction, FFL_SELECT);
}
}
}
/* melden, 1x pro Partei auf Schiff und für den Magier */
fset(mage->faction, FL_DH);
fset(mage->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) {
if (fval(u->faction, FL_DH)) {
freset(u->faction, FL_DH);
if (fval(u->faction, FFL_SELECT)) {
freset(u->faction, FFL_SELECT);
if (erfolg > 0) {
if (!m) {
m = msg_message("stormwinds_effect", "unit", mage);
@ -2382,10 +2384,10 @@ sp_earthquake(castorder *co)
}
/* melden, 1x pro Partei */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
sprintf(buf, "%s läßt die Erde in %s erzittern.",
cansee(u->faction, r, mage, 0) ? unitname(mage) : "Jemand",
regionname(r, u->faction));
@ -2494,11 +2496,11 @@ sp_forest_fire(castorder *co)
probability = destroyed * 0.001; /* Chance, dass es sich ausbreitet */
/* melden, 1x pro Partei */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for(u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
sprintf(buf, "%s erzeugt eine verheerende Feuersbrunst. %d %s "
"den Flammen zum Opfer.",
cansee(u->faction, r, mage, 0) ? unitname(mage) : "Jemand",
@ -2507,7 +2509,7 @@ sp_forest_fire(castorder *co)
addmessage(r, u->faction, buf, MSG_EVENT, ML_INFO);
}
}
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
sprintf(buf, "%s erzeugt eine verheerende Feuersbrunst. %d %s "
"den Flammen zum Opfer.", unitname(mage), destroyed+vernichtet_schoesslinge,
destroyed+vernichtet_schoesslinge == 1 ? "Baum fiel" : "Bäume fielen");
@ -3081,15 +3083,15 @@ sp_wisps(castorder *co)
a_add(&b->attribs, a_new(&at_countdown))->data.i = cast_level;
/* melden, 1x pro Partei */
{
message * seen = msg_message("wisps_effect", "mage region", mage, r);
message * unseen = msg_message("wisps_effect", "mage region", NULL, r);
report_effect(r, mage, seen, unseen);
msg_release(seen);
msg_release(unseen);
}
{
message * seen = msg_message("wisps_effect", "mage region", mage, r);
message * unseen = msg_message("wisps_effect", "mage region", NULL, r);
report_effect(r, mage, seen, unseen);
msg_release(seen);
msg_release(unseen);
}
return cast_level;
return cast_level;
}
/* ------------------------------------------------------------- */
@ -3226,7 +3228,7 @@ dc_age(struct curse * c)
unit * u = *up;
double damage = c->effect.f * u->number;
freset(u->faction, FL_DH);
freset(u->faction, FFL_SELECT);
if (u->number<=0 || target_resists_magic(mage, u, TYP_UNIT, 0)) {
up=&u->next;
continue;
@ -3320,14 +3322,14 @@ sp_deathcloud(castorder *co)
/* melden, 1x pro Partei */
for (u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
ADDMSG(&u->faction->msgs, msg_message("deathcloud_effect",
"mage region", cansee(u->faction, r, mage, 0) ? mage : NULL, r));
}
}
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
ADDMSG(&mage->faction->msgs, msg_message("deathcloud_effect",
"mage region", mage, r));
}
@ -3494,21 +3496,21 @@ sp_chaossuction(castorder *co)
"Wirbel");
new_border(&bt_chaosgate, r, rt);
freset(mage->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
freset(mage->faction, FFL_SELECT);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next) {
if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
sprintf(buf, "%s öffnete ein Chaostor.",
cansee(u->faction, r, mage, 0)?unitname(mage):"Jemand");
addmessage(r, u->faction, buf, MSG_EVENT, ML_INFO);
}
}
for (u = rt->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = rt->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = rt->units; u; u = u->next) {
if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
addmessage(r, u->faction, "Ein Wirbel aus blendendem Licht erscheint.",
MSG_EVENT, ML_INFO);
}
@ -3689,12 +3691,12 @@ sp_summonundead(castorder *co)
addmessage(0, mage->faction, buf, MSG_MAGIC, ML_INFO);
/* melden, 1x pro Partei */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
if (!fval(u->faction, FFL_SELECT) ) {
if (!m) m = msg_message("summonundead_effect", "unit", mage);
fset(u->faction, FL_DH);
fset(u->faction, FFL_SELECT);
add_message(&u->faction->msgs, m);
}
}
@ -3737,11 +3739,11 @@ sp_auraleak(castorder *co)
lost_aura = (int)(get_spellpoints(u)*lost);
change_spellpoints(u, -lost_aura);
}
freset(u->faction, FL_DH);
freset(u->faction, FFL_SELECT);
}
for (u = r->units; u; u = u->next) {
if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
if (cansee(u->faction, r, mage, 0)) {
sprintf(buf, "%s rief in %s einen Riss in dem Gefüge der Magie "
"hervor, der alle magische Kraft aus der Region riss.",
@ -4100,17 +4102,17 @@ sp_rallypeasantmob(castorder *co)
}
if (erfolg) {
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for(u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
sprintf(buf, "%s besänftigt den Bauernaufstand in %s.",
cansee(u->faction, r, mage, 0) ? unitname(mage) : "Jemand",
regionname(r, u->faction));
addmessage(r, u->faction, buf, MSG_MAGIC, ML_INFO);
}
}
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
sprintf(buf, "%s besänftigt den Bauernaufstand in %s.",
unitname(mage), regionname(r, u->faction));
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO);
@ -4179,16 +4181,16 @@ sp_raisepeasantmob(castorder *co)
create_curse(mage, &r->attribs, ct_find("riotzone"), cast_level, duration, anteil, 0);
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
ADDMSG(&u->faction->msgs, msg_message(
"sp_raisepeasantmob_effect", "mage region",
cansee(u->faction, r, mage, 0) ? mage : NULL, r ));
}
}
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
ADDMSG(&mage->faction->msgs, msg_message(
"sp_raisepeasantmob_effect", "mage region", mage, r));
}
@ -4328,11 +4330,11 @@ sp_song_of_peace(castorder *co)
create_curse(mage, &r->attribs, ct_find("peacezone"), force, duration, zero_effect, 0);
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
if (!fval(u->faction, FFL_SELECT) ) {
message * m = NULL;
fset(u->faction, FL_DH);
fset(u->faction, FFL_SELECT);
if (cansee(u->faction, r, mage, 0)) {
if (msg[0]==NULL) msg[0] = msg_message("song_of_peace_effect_0", "mage", mage);
m = msg[0];
@ -4381,11 +4383,11 @@ sp_generous(castorder *co)
effect.i = 2;
create_curse(mage,&r->attribs, ct_find("generous"), force, duration, effect, 0);
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
if (!fval(u->faction, FFL_SELECT) ) {
message * m = NULL;
fset(u->faction, FL_DH);
fset(u->faction, FFL_SELECT);
if (cansee(u->faction, r, mage, 0)) {
if (msg[0]==NULL) msg[0] = msg_message("song_of_peace_effect_0", "mage", mage);
m = msg[0];
@ -4802,10 +4804,10 @@ sp_raisepeasants(castorder *co)
a->data.ca[1] = 15; /* 15% */
a_add(&u2->attribs, a);
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
sprintf(buf, "%s wiegelt %d Bauern auf.",
cansee(u->faction, r, mage, 0) ? unitname(mage) : "Jemand",
u2->number);
@ -4838,10 +4840,10 @@ sp_depression(castorder *co)
create_curse(mage,&r->attribs, ct_find("depression"), force, duration, zero_effect, 0);
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
sprintf(buf, "%s sorgt für Trübsal unter den Bauern.",
cansee(u->faction, r, mage, 0) ? unitname(mage) : "Jemand");
addmessage(r, u->faction, buf, MSG_MAGIC, ML_INFO);
@ -5451,15 +5453,15 @@ sp_dream_of_confusion(castorder *co)
c = create_curse(mage, &r2->attribs,
ct_find("disorientationzone"), power, duration, effect, 0);
for (u = r2->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r2->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r2->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
if (!m) m = msg_message("confusion_result", "mage", mage);
add_message(&u->faction->msgs, m);
}
}
if (!fval(mage->faction, FL_DH)) {
if (!fval(mage->faction, FFL_SELECT)) {
if (!m) m = msg_message("confusion_result", "mage", mage);
add_message(&u->faction->msgs, m);
}
@ -5711,12 +5713,12 @@ sp_enterastral(castorder *co)
/* Meldungen in der Ausgangsregion */
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = r->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_disappear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -5726,12 +5728,12 @@ sp_enterastral(castorder *co)
/* Meldungen in der Zielregion */
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = rt->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_appear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -5845,12 +5847,12 @@ sp_pullastral(castorder *co)
/* Meldungen in der Ausgangsregion */
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = r->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_disappear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -5860,12 +5862,12 @@ sp_pullastral(castorder *co)
/* Meldungen in der Zielregion */
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = rt->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_appear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -5958,12 +5960,12 @@ sp_leaveastral(castorder *co)
/* Meldungen in der Ausgangsregion */
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = r->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_disappear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -5973,12 +5975,12 @@ sp_leaveastral(castorder *co)
/* Meldungen in der Zielregion */
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = rt->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_appear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -6077,12 +6079,12 @@ sp_fetchastral(castorder *co)
move_unit(u, rt, NULL);
/* Meldungen in der Ausgangsregion */
for (u2 = ro->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = ro->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = ro->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, ro, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_disappear", "unit", u);
r_addmessage(ro, u2->faction, m);
}
@ -6091,12 +6093,12 @@ sp_fetchastral(castorder *co)
if (m) msg_release(m);
/* Meldungen in der Zielregion */
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FFL_SELECT);
m = NULL;
for (u2 = rt->units; u2; u2 = u2->next ) {
if (!fval(u2->faction, FL_DH)) {
if (!fval(u2->faction, FFL_SELECT)) {
if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FL_DH);
fset(u2->faction, FFL_SELECT);
if (!m) m = msg_message("astral_appear", "unit", u);
r_addmessage(rt, u2->faction, m);
}
@ -6377,10 +6379,10 @@ sp_eternizewall(castorder *co)
}
/* melden, 1x pro Partei in der Burg */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next) {
if (!fval(u->faction, FL_DH)) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
if (u->building == b) {
sprintf(buf, "Mit einem Ritual bindet %s die magischen Kräfte "
"der Erde in die Mauern von %s", unitname(mage),
@ -6606,11 +6608,11 @@ sp_flying_ship(castorder *co)
sh->coast = NODIRECTION;
/* melden, 1x pro Partei */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT);
for(u = r->units; u; u = u->next ) {
/* das sehen natürlich auch die Leute an Land */
if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH);
if (!fval(u->faction, FFL_SELECT) ) {
fset(u->faction, FFL_SELECT);
if (!m) m = msg_message("flying_ship_result", "mage ship", mage, sh);
add_message(&u->faction->msgs, m);
}

View file

@ -16,15 +16,17 @@
#include "unitcurse.h"
/* kernel includes */
#include <kernel/curse.h>
#include <kernel/message.h>
#include <kernel/race.h>
#include <kernel/skill.h>
#include <kernel/unit.h>
#include <kernel/faction.h>
#include <kernel/objtypes.h>
#include <kernel/curse.h>
#include <kernel/version.h>
/* util includes */
#include <util/language.h>
#include <util/nrmessage.h>
#include <util/message.h>
#include <util/base36.h>

View file

@ -22,9 +22,10 @@
#include <faction.h> /* FIXME: resolve_faction */
/* util includes */
#include <resolve.h>
#include <event.h>
#include <base36.h>
#include <util/attrib.h>
#include <util/event.h>
#include <util/resolve.h>
#include <util/base36.h>
/* ansi includes */
#include <stdio.h>

View file

@ -21,9 +21,10 @@
#include <race.h>
/* util includes */
#include <event.h>
#include <resolve.h>
#include <base36.h>
#include <util/attrib.h>
#include <util/event.h>
#include <util/resolve.h>
#include <util/base36.h>
/* ansi includes */
#include <stdio.h>

View file

@ -22,9 +22,10 @@
#include <unit.h>
/* util includes */
#include <event.h>
#include <resolve.h>
#include <base36.h>
#include <util/attrib.h>
#include <util/event.h>
#include <util/resolve.h>
#include <util/base36.h>
/* libc includes */
#include <stdio.h>

View file

@ -17,13 +17,15 @@
#include "createcurse.h"
/* kernel includes */
#include <version.h>
#include <curse.h>
#include <unit.h>
/* util includes */
#include <event.h>
#include <resolve.h>
#include <base36.h>
#include <util/attrib.h>
#include <util/event.h>
#include <util/resolve.h>
#include <util/base36.h>
/* ansi includes */
#include <stdio.h>

View file

@ -23,9 +23,11 @@
#include <region.h>
/* util includes */
#include <event.h>
#include <resolve.h>
#include <base36.h>
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/log.h>
#include <util/resolve.h>
/* ansi includes */
#include <stdio.h>
@ -65,7 +67,7 @@ createunit_handle(trigger * t, void * data)
*/
createunit_data * td = (createunit_data*)t->data.v;
if (td->r!=NULL && td->f!=NULL) {
createunit(td->r, td->f, td->number, td->race);
create_unit(td->r, td->f, td->number, td->race, 0, NULL, NULL);
} else {
log_error(("could not perform createunit::handle()\n"));
}

View file

@ -19,8 +19,9 @@
#include <unit.h>
/* util includes */
#include <event.h>
#include <log.h>
#include <util/attrib.h>
#include <util/event.h>
#include <util/log.h>
/* libc includes */
#include <stdlib.h>

View file

@ -21,9 +21,10 @@
#include <unit.h>
/* util includes */
#include <event.h>
#include <resolve.h>
#include <base36.h>
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/resolve.h>
/* ansi includes */
#include <stdio.h>

View file

@ -21,9 +21,10 @@
#include <unit.h>
/* util includes */
#include <event.h>
#include <resolve.h>
#include <base36.h>
#include <util/attrib.h>
#include <util/event.h>
#include <util/resolve.h>
#include <util/base36.h>
/* ansi includes */
#include <stdio.h>

View file

@ -17,8 +17,9 @@
#include "timeout.h"
/* util includes */
#include <event.h>
#include <log.h>
#include <util/attrib.h>
#include <util/event.h>
#include <util/log.h>
#include <stdio.h>
#include <stdlib.h>

View file

@ -17,13 +17,14 @@
#include "unitmessage.h"
/* kernel includes */
#include <unit.h>
#include <kernel/unit.h>
/* util includes */
#include <resolve.h>
#include <event.h>
#include <base36.h>
#include <goodies.h>
#include <util/attrib.h>
#include <util/resolve.h>
#include <util/event.h>
#include <util/base36.h>
#include <util/goodies.h>
/* ansi includes */
#include <stdio.h>

View file

@ -15,6 +15,7 @@
#include <kernel/region.h>
#include <modules/autoseed.h>
#include <util/rng.h>
#include <util/lists.h>
#define ISLANDSIZE 20
#define TURNS_PER_ISLAND 4

View file

@ -49,6 +49,7 @@
#include <kernel/ship.h>
#include <kernel/terrain.h>
#include <kernel/xmlreader.h>
#include <kernel/version.h>
#include <spells/spells.h>
#include <attributes/attributes.h>
@ -551,14 +552,14 @@ paint_info_region(window * wnd, const state * st)
mvwaddnstr(win, line++, 1, "* factions:", size-5);
wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
for (u=r->units;u && line<maxline;u=u->next) {
if (!fval(u->faction, FL_MARK)) {
if (!fval(u->faction, FFL_MARK)) {
mvwprintw(win, line, 1, "%.4s ", itoa36(u->faction->no));
mvwaddnstr(win, line++, 6, u->faction->name, size-5);
fset(u->faction, FL_MARK);
fset(u->faction, FFL_MARK);
}
}
for (u=r->units;u && line<maxline;u=u->next) {
freset(u->faction, FL_MARK);
freset(u->faction, FFL_MARK);
}
}
if (r->units && (st->info_flags & IFL_UNITS)) {

View file

@ -19,7 +19,7 @@
*/
#include <config.h>
#include <eressea.h>
#include <types.h>
/* misc includes */
#include <attributes/key.h>
@ -41,6 +41,7 @@
#include <kernel/building.h>
#include <kernel/calendar.h>
#include <kernel/equipment.h>
#include <kernel/eressea.h>
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/magic.h>
@ -62,6 +63,7 @@
#include <kernel/terrain.h>
#include <kernel/terrainid.h>
#include <kernel/unit.h>
#include <kernel/version.h>
/* util includes */
#include <util/attrib.h>
@ -103,15 +105,15 @@ curse_emptiness(void)
if (r->age<=200) continue;
if (get_curse(r->attribs, ct)) continue;
while (u && u->faction->no==MONSTER_FACTION) u=u->next;
if (u==NULL) fset(r, FL_MARK);
if (u==NULL) fset(r, RF_MARK);
}
for (r=regions;r!=NULL;r=r->next) {
if (fval(r, FL_MARK)) {
if (fval(r, RF_MARK)) {
direction_t d;
for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r,d);
if (rn==NULL) continue;
if (fval(rn, FL_MARK) || get_curse(rn->attribs, ct)) {
if (fval(rn, RF_MARK) || get_curse(rn->attribs, ct)) {
break;
}
}
@ -121,7 +123,7 @@ curse_emptiness(void)
effect.i = 0;
c = create_curse(NULL, &r->attribs, ct, 100, 100, effect, 0);
}
freset(r, FL_MARK);
freset(r, RF_MARK);
}
}
return 0;
@ -452,13 +454,6 @@ get_timeout(trigger * td, trigger * tfind)
#include <triggers/shock.h>
#include <triggers/killunit.h>
extern struct attrib_type at_resources;
void
init_resourcefix(void)
{
at_register(&at_resources);
}
int
growing_trees(void)
{

View file

@ -19,7 +19,9 @@
#endif
// util includes
#include <util/attrib.h>
#include <util/base36.h>
#include <util/lists.h>
#include <util/log.h>
using namespace luabind;

View file

@ -27,7 +27,9 @@
#include <luabind/iterator_policy.hpp>
// util includes
#include <util/attrib.h>
#include <util/language.h>
#include <util/lists.h>
#include <util/base36.h>
#include <util/rand.h>
#include <util/rng.h>

View file

@ -12,8 +12,9 @@
#include <kernel/unit.h>
// util includes
#include <util/base36.h>
#include <util/attrib.h>
#include <util/base36.h>
#include <util/language.h>
// attrib includes
#include <attributes/attributes.h>

Some files were not shown because too many files have changed in this diff Show more