forked from github/server
- GUARD_DISABLES_PRODUCTION
- Bewache wirkt nur noch, wenn der Bewacher den Bewachten sieht
This commit is contained in:
parent
d81be270aa
commit
4e076dd4ae
12 changed files with 434 additions and 399 deletions
|
@ -358,6 +358,9 @@ recruit(region * r, unit * u, strlist * S,
|
||||||
int recruitcost;
|
int recruitcost;
|
||||||
|
|
||||||
#if GUARD_DISABLES_RECRUIT == 1
|
#if GUARD_DISABLES_RECRUIT == 1
|
||||||
|
/* this is a very special case because the recruiting unit may be empty
|
||||||
|
* at this point and we have to look at the creating unit instead. This
|
||||||
|
* is done in cansee, which is called indirectly by is_guarded(). */
|
||||||
if(is_guarded(r, u, GUARD_RECRUIT)) {
|
if(is_guarded(r, u, GUARD_RECRUIT)) {
|
||||||
cmistake(u, S->s, 70, MSG_EVENT);
|
cmistake(u, S->s, 70, MSG_EVENT);
|
||||||
return;
|
return;
|
||||||
|
@ -464,7 +467,7 @@ recruit(region * r, unit * u, strlist * S,
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
count_max_migrants(faction * f)
|
count_max_migrants(faction * f)
|
||||||
{
|
{
|
||||||
int x = (int)(log10(count_all(f) / 50.0) * 20);
|
int x = (int)(log10(count_all(f) / 50.0) * 20);
|
||||||
|
@ -473,7 +476,7 @@ count_max_migrants(faction * f)
|
||||||
|
|
||||||
extern const char* resname(resource_t res, int i);
|
extern const char* resname(resource_t res, int i);
|
||||||
|
|
||||||
void
|
void
|
||||||
add_give(unit * u, unit * u2, int n, const resource_type * rtype, const char * cmd, int error)
|
add_give(unit * u, unit * u2, int n, const resource_type * rtype, const char * cmd, int error)
|
||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -491,7 +494,7 @@ add_give(unit * u, unit * u2, int n, const resource_type * rtype, const char * c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
addgive(unit * u, unit * u2, int n, resource_t res, const char * cmd, int error)
|
addgive(unit * u, unit * u2, int n, resource_t res, const char * cmd, int error)
|
||||||
{
|
{
|
||||||
add_give(u, u2, n, oldresourcetype[res], cmd, error);
|
add_give(u, u2, n, oldresourcetype[res], cmd, error);
|
||||||
|
@ -501,7 +504,7 @@ addgive(unit * u, unit * u2, int n, resource_t res, const char * cmd, int error)
|
||||||
|
|
||||||
/* Derzeit fallen nur Silber und Pferde an die Region
|
/* Derzeit fallen nur Silber und Pferde an die Region
|
||||||
* */
|
* */
|
||||||
void
|
void
|
||||||
give_peasants(int n, const item_type * itype, unit * src)
|
give_peasants(int n, const item_type * itype, unit * src)
|
||||||
{
|
{
|
||||||
region *r = src->region;
|
region *r = src->region;
|
||||||
|
@ -513,7 +516,7 @@ give_peasants(int n, const item_type * itype, unit * src)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
give_item(int want, const item_type * itype, unit * src, unit * dest, const char * cmd)
|
give_item(int want, const item_type * itype, unit * src, unit * dest, const char * cmd)
|
||||||
{
|
{
|
||||||
short error = 0;
|
short error = 0;
|
||||||
|
@ -547,7 +550,7 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, const char
|
||||||
handle_event(&src->attribs, "give", dest);
|
handle_event(&src->attribs, "give", dest);
|
||||||
handle_event(&dest->attribs, "receive", src);
|
handle_event(&dest->attribs, "receive", src);
|
||||||
#if defined(MUSEUM_PLANE) && defined(TODO)
|
#if defined(MUSEUM_PLANE) && defined(TODO)
|
||||||
TODO: Einen Trigger benutzen!
|
TODO: Einen Trigger benutzen!
|
||||||
if (a_find(dest->attribs, &at_warden)) {
|
if (a_find(dest->attribs, &at_warden)) {
|
||||||
/* warden_add_give(src, dest, itype, n); */
|
/* warden_add_give(src, dest, itype, n); */
|
||||||
}
|
}
|
||||||
|
@ -560,7 +563,7 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, const char
|
||||||
add_give(src, dest, n, item2resource(itype), cmd, error);
|
add_give(src, dest, n, item2resource(itype), cmd, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
givemen(int n, unit * u, unit * u2, const char * cmd)
|
givemen(int n, unit * u, unit * u2, const char * cmd)
|
||||||
{
|
{
|
||||||
ship *sh;
|
ship *sh;
|
||||||
|
@ -673,7 +676,7 @@ givemen(int n, unit * u, unit * u2, const char * cmd)
|
||||||
addgive(u, u2, n, R_PERSON, cmd, error);
|
addgive(u, u2, n, R_PERSON, cmd, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
giveunit(region * r, unit * u, unit * u2, strlist * S)
|
giveunit(region * r, unit * u, unit * u2, strlist * S)
|
||||||
{
|
{
|
||||||
int n = u->number;
|
int n = u->number;
|
||||||
|
@ -788,9 +791,9 @@ giveunit(region * r, unit * u, unit * u2, strlist * S)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
|
dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
|
||||||
/*
|
/*
|
||||||
* mode=0: give to any units
|
* mode=0: give to any units
|
||||||
* mode=1: give to other units and peasants only
|
* mode=1: give to other units and peasants only
|
||||||
* mode=2: give to own units only
|
* mode=2: give to own units only
|
||||||
|
@ -1044,7 +1047,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
|
||||||
cmistake(u, S->s, 123, MSG_COMMERCE);
|
cmistake(u, S->s, 123, MSG_COMMERCE);
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
forgetskill(unit * u)
|
forgetskill(unit * u)
|
||||||
{
|
{
|
||||||
skill_t talent;
|
skill_t talent;
|
||||||
|
@ -1062,7 +1065,7 @@ forgetskill(unit * u)
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
report_donations(void)
|
report_donations(void)
|
||||||
{
|
{
|
||||||
spende * sp;
|
spende * sp;
|
||||||
|
@ -1078,7 +1081,7 @@ report_donations(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_spende(faction * f1, faction * f2, int betrag, region * r)
|
add_spende(faction * f1, faction * f2, int betrag, region * r)
|
||||||
{
|
{
|
||||||
spende *sp;
|
spende *sp;
|
||||||
|
@ -1102,9 +1105,9 @@ add_spende(faction * f1, faction * f2, int betrag, region * r)
|
||||||
spenden = sp;
|
spenden = sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
maintain(building * b, boolean first)
|
maintain(building * b, boolean first)
|
||||||
/* first==false -> take money from wherever you can */
|
/* first==false -> take money from wherever you can */
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
region * r = b->region;
|
region * r = b->region;
|
||||||
|
@ -1199,7 +1202,7 @@ maintain(building * b, boolean first)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gebaeude_stuerzt_ein(region * r, building * b)
|
gebaeude_stuerzt_ein(region * r, building * b)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -1253,7 +1256,7 @@ gebaeude_stuerzt_ein(region * r, building * b)
|
||||||
destroy_building(b);
|
destroy_building(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
maintain_buildings(boolean crash)
|
maintain_buildings(boolean crash)
|
||||||
{
|
{
|
||||||
region * r;
|
region * r;
|
||||||
|
@ -1279,7 +1282,7 @@ maintain_buildings(boolean crash)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
economics(void)
|
economics(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
|
@ -1348,7 +1351,7 @@ economics(void)
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
manufacture(unit * u, const item_type * itype, int want)
|
manufacture(unit * u, const item_type * itype, int want)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
@ -1428,7 +1431,7 @@ typedef struct allocation_list {
|
||||||
static allocation_list * allocations;
|
static allocation_list * allocations;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
allocate_resource(unit * u, const resource_type * rtype, int want)
|
allocate_resource(unit * u, const resource_type * rtype, int want)
|
||||||
{
|
{
|
||||||
const item_type * itype = resource2item(rtype);
|
const item_type * itype = resource2item(rtype);
|
||||||
|
@ -1612,7 +1615,7 @@ typedef struct allocator {
|
||||||
|
|
||||||
static struct allocator * allocators;
|
static struct allocator * allocators;
|
||||||
|
|
||||||
static const allocator *
|
static const allocator *
|
||||||
get_allocator(const struct resource_type * type)
|
get_allocator(const struct resource_type * type)
|
||||||
{
|
{
|
||||||
const struct allocator * alloc = allocators;
|
const struct allocator * alloc = allocators;
|
||||||
|
@ -1620,7 +1623,7 @@ get_allocator(const struct resource_type * type)
|
||||||
return alloc;
|
return alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static allocator *
|
static allocator *
|
||||||
make_allocator(const struct resource_type * type, void (*allocate)(const struct allocator *, region *, allocation *))
|
make_allocator(const struct resource_type * type, void (*allocate)(const struct allocator *, region *, allocation *))
|
||||||
{
|
{
|
||||||
allocator * alloc = (allocator *)malloc(sizeof(allocator));
|
allocator * alloc = (allocator *)malloc(sizeof(allocator));
|
||||||
|
@ -1629,7 +1632,7 @@ make_allocator(const struct resource_type * type, void (*allocate)(const struct
|
||||||
return alloc;
|
return alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_allocator(allocator * alloc)
|
add_allocator(allocator * alloc)
|
||||||
{
|
{
|
||||||
alloc->next = allocators;
|
alloc->next = allocators;
|
||||||
|
@ -1641,7 +1644,7 @@ enum {
|
||||||
AFL_LOWSKILL = 1<<1
|
AFL_LOWSKILL = 1<<1
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
required(int want, double save)
|
required(int want, double save)
|
||||||
{
|
{
|
||||||
int norders = (int)(want * save);
|
int norders = (int)(want * save);
|
||||||
|
@ -1650,7 +1653,7 @@ required(int want, double save)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NEW_RESOURCEGROWTH
|
#if NEW_RESOURCEGROWTH
|
||||||
static void
|
static void
|
||||||
leveled_allocation(const allocator * self, region * r, allocation * alist)
|
leveled_allocation(const allocator * self, region * r, allocation * alist)
|
||||||
{
|
{
|
||||||
const resource_type * rtype = self->type;
|
const resource_type * rtype = self->type;
|
||||||
|
@ -1710,7 +1713,7 @@ leveled_allocation(const allocator * self, region * r, allocation * alist)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
attrib_allocation(const allocator * self, region * r, allocation * alist)
|
attrib_allocation(const allocator * self, region * r, allocation * alist)
|
||||||
{
|
{
|
||||||
allocation * al;
|
allocation * al;
|
||||||
|
@ -1750,7 +1753,7 @@ attrib_allocation(const allocator * self, region * r, allocation * alist)
|
||||||
assert(avail==0 || norders==0);
|
assert(avail==0 || norders==0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
split_allocations(region * r)
|
split_allocations(region * r)
|
||||||
{
|
{
|
||||||
allocation_list ** p_alist=&allocations;
|
allocation_list ** p_alist=&allocations;
|
||||||
|
@ -1794,7 +1797,7 @@ split_allocations(region * r)
|
||||||
allocations = NULL;
|
allocations = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_potion(unit * u, const potion_type * ptype, int want)
|
create_potion(unit * u, const potion_type * ptype, int want)
|
||||||
{
|
{
|
||||||
int built;
|
int built;
|
||||||
|
@ -1842,12 +1845,18 @@ create_potion(unit * u, const potion_type * ptype, int want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_item(unit * u, const item_type * itype, int want)
|
create_item(unit * u, const item_type * itype, int want)
|
||||||
{
|
{
|
||||||
if (fval(itype->rtype, RTF_LIMITED))
|
if (fval(itype->rtype, RTF_LIMITED)) {
|
||||||
|
#if GUARD_DISABLE_PRODUCTION == 1
|
||||||
|
if(is_guarded(r, u, GUARD_PRODUCE)) {
|
||||||
|
cmistake(u, findorder(u, u->thisorder), 70, MSG_EVENT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
allocate_resource(u, itype->rtype, want);
|
allocate_resource(u, itype->rtype, want);
|
||||||
else {
|
} else {
|
||||||
const potion_type * ptype = resource2potion(itype->rtype);
|
const potion_type * ptype = resource2potion(itype->rtype);
|
||||||
if (ptype!=NULL) create_potion(u, ptype, want);
|
if (ptype!=NULL) create_potion(u, ptype, want);
|
||||||
else if (itype->construction && itype->construction->materials) manufacture(u, itype, want);
|
else if (itype->construction && itype->construction->materials) manufacture(u, itype, want);
|
||||||
|
@ -1855,7 +1864,7 @@ create_item(unit * u, const item_type * itype, int want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make(region * r, unit * u)
|
make(region * r, unit * u)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -1887,10 +1896,7 @@ make(region * r, unit * u)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == P_HERBS) {
|
if (p == P_ROAD) {
|
||||||
herbsearch(r, u, m);
|
|
||||||
return;
|
|
||||||
} else if (p == P_ROAD) {
|
|
||||||
direction_t d;
|
direction_t d;
|
||||||
if(r->planep && fval(r->planep, PFL_NOBUILD)) {
|
if(r->planep && fval(r->planep, PFL_NOBUILD)) {
|
||||||
cmistake(u, findorder(u, u->thisorder), 275, MSG_PRODUCE);
|
cmistake(u, findorder(u, u->thisorder), 275, MSG_PRODUCE);
|
||||||
|
@ -1912,6 +1918,9 @@ make(region * r, unit * u)
|
||||||
}
|
}
|
||||||
continue_ship(r, u, m);
|
continue_ship(r, u, m);
|
||||||
return;
|
return;
|
||||||
|
} else if (p == P_HERBS) {
|
||||||
|
herbsearch(r, u, m);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stype = findshiptype(s, u->faction->locale);
|
stype = findshiptype(s, u->faction->locale);
|
||||||
|
@ -1942,7 +1951,7 @@ const attrib_type at_luxuries = {
|
||||||
"luxuries", NULL, NULL, NULL, NULL, NULL
|
"luxuries", NULL, NULL, NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
expandbuying(region * r, request * buyorders)
|
expandbuying(region * r, request * buyorders)
|
||||||
{
|
{
|
||||||
int max_products;
|
int max_products;
|
||||||
|
@ -2050,7 +2059,7 @@ attrib_type at_trades = {
|
||||||
NO_READ
|
NO_READ
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
buy(region * r, unit * u, request ** buyorders, const char * cmd)
|
buy(region * r, unit * u, request ** buyorders, const char * cmd)
|
||||||
{
|
{
|
||||||
int n, k;
|
int n, k;
|
||||||
|
@ -2145,7 +2154,7 @@ buy(region * r, unit * u, request ** buyorders, const char * cmd)
|
||||||
static int tax_per_size[7] =
|
static int tax_per_size[7] =
|
||||||
{0, 6, 12, 18, 24, 30, 36};
|
{0, 6, 12, 18, 24, 30, 36};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
expandselling(region * r, request * sellorders)
|
expandselling(region * r, request * sellorders)
|
||||||
{
|
{
|
||||||
int money, price, j, max_products;
|
int money, price, j, max_products;
|
||||||
|
@ -2290,7 +2299,7 @@ expandselling(region * r, request * sellorders)
|
||||||
if (taxcollected > 0) {
|
if (taxcollected > 0) {
|
||||||
change_money(maxowner, (int) taxcollected);
|
change_money(maxowner, (int) taxcollected);
|
||||||
add_income(maxowner, IC_TRADETAX, taxcollected, taxcollected);
|
add_income(maxowner, IC_TRADETAX, taxcollected, taxcollected);
|
||||||
/* sprintf(buf, "%s verdient %d Silber durch den Handel in %s.",
|
/* sprintf(buf, "%s verdient %d Silber durch den Handel in %s.",
|
||||||
unitname(maxowner), (int) taxcollected, regionid(r)); */
|
unitname(maxowner), (int) taxcollected, regionid(r)); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2318,7 +2327,7 @@ expandselling(region * r, request * sellorders)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sell(region * r, unit * u, request ** sellorders, const char * cmd)
|
sell(region * r, unit * u, request ** sellorders, const char * cmd)
|
||||||
{
|
{
|
||||||
const item_type * itype;
|
const item_type * itype;
|
||||||
|
@ -2443,7 +2452,7 @@ sell(region * r, unit * u, request ** sellorders, const char * cmd)
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
expandstealing(region * r, request * stealorders)
|
expandstealing(region * r, request * stealorders)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -2488,7 +2497,7 @@ expandstealing(region * r, request * stealorders)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
plant(region *r, unit *u, int raw)
|
plant(region *r, unit *u, int raw)
|
||||||
{
|
{
|
||||||
int n, i, skill, planted = 0;
|
int n, i, skill, planted = 0;
|
||||||
|
@ -2544,7 +2553,7 @@ plant(region *r, unit *u, int raw)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GROWING_TREES
|
#if GROWING_TREES
|
||||||
static void
|
static void
|
||||||
planttrees(region *r, unit *u, int raw)
|
planttrees(region *r, unit *u, int raw)
|
||||||
{
|
{
|
||||||
int n, i, skill, planted = 0;
|
int n, i, skill, planted = 0;
|
||||||
|
@ -2604,7 +2613,7 @@ planttrees(region *r, unit *u, int raw)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* züchte bäume */
|
/* züchte bäume */
|
||||||
void
|
void
|
||||||
breedtrees(region *r, unit *u, int raw)
|
breedtrees(region *r, unit *u, int raw)
|
||||||
{
|
{
|
||||||
int n, i, skill, planted = 0;
|
int n, i, skill, planted = 0;
|
||||||
|
@ -2663,7 +2672,7 @@ breedtrees(region *r, unit *u, int raw)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
pflanze(region *r, unit *u)
|
pflanze(region *r, unit *u)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
|
@ -2709,7 +2718,7 @@ pflanze(region *r, unit *u)
|
||||||
|
|
||||||
|
|
||||||
/* züchte pferde */
|
/* züchte pferde */
|
||||||
void
|
void
|
||||||
breedhorses(region *r, unit *u)
|
breedhorses(region *r, unit *u)
|
||||||
{
|
{
|
||||||
int n, c;
|
int n, c;
|
||||||
|
@ -2742,7 +2751,7 @@ breedhorses(region *r, unit *u)
|
||||||
"raised%u:unit%i:amount", u, gezuechtet));
|
"raised%u:unit%i:amount", u, gezuechtet));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
zuechte(region *r, unit *u)
|
zuechte(region *r, unit *u)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
|
@ -2781,7 +2790,7 @@ zuechte(region *r, unit *u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
rough_amount(int a, int m)
|
rough_amount(int a, int m)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -2799,7 +2808,7 @@ rough_amount(int a, int m)
|
||||||
return "sehr viele";
|
return "sehr viele";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
research(region *r, unit *u)
|
research(region *r, unit *u)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -2833,7 +2842,7 @@ research(region *r, unit *u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
wahrnehmung(region * r, faction * f)
|
wahrnehmung(region * r, faction * f)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -2854,7 +2863,7 @@ wahrnehmung(region * r, faction * f)
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
steal(region * r, unit * u, request ** stealorders)
|
steal(region * r, unit * u, request ** stealorders)
|
||||||
{
|
{
|
||||||
int n, i, id;
|
int n, i, id;
|
||||||
|
@ -2962,7 +2971,7 @@ steal(region * r, unit * u, request ** stealorders)
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
entertainmoney(const region *r)
|
entertainmoney(const region *r)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
@ -2980,7 +2989,7 @@ entertainmoney(const region *r)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
expandentertainment(region * r)
|
expandentertainment(region * r)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -3005,7 +3014,7 @@ expandentertainment(region * r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
entertain(region * r, unit * u)
|
entertain(region * r, unit * u)
|
||||||
{
|
{
|
||||||
int max_e;
|
int max_e;
|
||||||
|
@ -3046,7 +3055,7 @@ entertain(region * r, unit * u)
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
expandwork(region * r)
|
expandwork(region * r)
|
||||||
{
|
{
|
||||||
int n, earnings;
|
int n, earnings;
|
||||||
|
@ -3102,7 +3111,7 @@ expandwork(region * r)
|
||||||
rsetmoney(r, rmoney(r) + earnings);
|
rsetmoney(r, rmoney(r) + earnings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
work(region * r, unit * u)
|
work(region * r, unit * u)
|
||||||
{
|
{
|
||||||
request *o;
|
request *o;
|
||||||
|
@ -3129,7 +3138,7 @@ work(region * r, unit * u)
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
expandtax(region * r, request * taxorders)
|
expandtax(region * r, request * taxorders)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -3150,7 +3159,7 @@ expandtax(region * r, request * taxorders)
|
||||||
add_income(u, IC_TAX, u->wants, u->n);
|
add_income(u, IC_TAX, u->wants, u->n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tax(region * r, unit * u, request ** taxorders)
|
tax(region * r, unit * u, request ** taxorders)
|
||||||
{
|
{
|
||||||
/* Steuern werden noch vor der Forschung eingetrieben */
|
/* Steuern werden noch vor der Forschung eingetrieben */
|
||||||
|
@ -3206,7 +3215,7 @@ tax(region * r, unit * u, request ** taxorders)
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
produce(void)
|
produce(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
|
@ -3361,7 +3370,7 @@ produce(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
init_economy(void)
|
init_economy(void)
|
||||||
{
|
{
|
||||||
add_allocator(make_allocator(item2resource(olditemtype[I_HORSE]), attrib_allocation));
|
add_allocator(make_allocator(item2resource(olditemtype[I_HORSE]), attrib_allocation));
|
||||||
|
|
|
@ -688,7 +688,7 @@ horses(region * r)
|
||||||
rsethorses(r, (int)(horses*0.9));
|
rsethorses(r, (int)(horses*0.9));
|
||||||
} else if (maxhorses > 0) {
|
} else if (maxhorses > 0) {
|
||||||
int i;
|
int i;
|
||||||
int growth = (HORSEGROWTH * 200 * (maxhorses-horses))/maxhorses;
|
int growth = (RESOURCE_QUANTITY * HORSEGROWTH * 200 * (maxhorses-horses))/maxhorses;
|
||||||
|
|
||||||
if(a_find(r->attribs, &at_horseluck)) growth *= 2;
|
if(a_find(r->attribs, &at_horseluck)) growth *= 2;
|
||||||
/* printf("Horses: <%d> %d -> ", growth, horses); */
|
/* printf("Horses: <%d> %d -> ", growth, horses); */
|
||||||
|
@ -3029,6 +3029,7 @@ maxunits(faction *f)
|
||||||
return (int) (global.maxunits * (1 + 0.4 * fspecial(f, FS_ADMINISTRATOR)));
|
return (int) (global.maxunits * (1 + 0.4 * fspecial(f, FS_ADMINISTRATOR)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
new_units (void)
|
new_units (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1866,15 +1866,14 @@ report(FILE *F, faction * f, const faction_list * addresses,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f->age <= 2) {
|
if (f->age <= 2) {
|
||||||
/* doppelt gemoppelt und funktioniert nicht. */
|
|
||||||
if (f->age <= 1) {
|
if (f->age <= 1) {
|
||||||
ADDMSG(&f->msgs, msg_message("changepasswd",
|
ADDMSG(&f->msgs, msg_message("changepasswd",
|
||||||
"value", gc_add(strdup(f->passw))));
|
"value", gc_add(strdup(f->passw))));
|
||||||
}
|
}
|
||||||
/* Was tut das? */
|
|
||||||
RENDER(f, buf, sizeof(buf), ("newbie_password", "password", f->passw));
|
RENDER(f, buf, sizeof(buf), ("newbie_password", "password", f->passw));
|
||||||
rnl(F);
|
rnl(F);
|
||||||
centre(F, buf, true);
|
centre(F, buf, true);
|
||||||
|
rnl(F);
|
||||||
centre(F, LOC(f->locale, "newbie_info_1"), true);
|
centre(F, LOC(f->locale, "newbie_info_1"), true);
|
||||||
rnl(F);
|
rnl(F);
|
||||||
centre(F, LOC(f->locale, "newbie_info_2"), true);
|
centre(F, LOC(f->locale, "newbie_info_2"), true);
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "race.h"
|
#include "race.h"
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
|
#include "movement.h"
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <rand.h>
|
#include <rand.h>
|
||||||
|
@ -50,11 +51,17 @@ herbsearch(region * r, unit * u, int max)
|
||||||
{
|
{
|
||||||
int herbsfound;
|
int herbsfound;
|
||||||
const herb_type * whichherb;
|
const herb_type * whichherb;
|
||||||
|
|
||||||
if (eff_skill(u, SK_HERBALISM, r) == 0) {
|
if (eff_skill(u, SK_HERBALISM, r) == 0) {
|
||||||
cmistake(u, u->thisorder, 59, MSG_PRODUCE);
|
cmistake(u, u->thisorder, 59, MSG_PRODUCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(is_guarded(r, u, GUARD_PRODUCE)) {
|
||||||
|
cmistake(u, findorder(u, u->thisorder), 70, MSG_EVENT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
whichherb = rherbtype(r);
|
whichherb = rherbtype(r);
|
||||||
if (whichherb == NULL) {
|
if (whichherb == NULL) {
|
||||||
cmistake(u, u->thisorder, 108, MSG_PRODUCE);
|
cmistake(u, u->thisorder, 108, MSG_PRODUCE);
|
||||||
|
|
|
@ -796,9 +796,20 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
|
||||||
int n;
|
int n;
|
||||||
boolean cansee = false;
|
boolean cansee = false;
|
||||||
unit *u2;
|
unit *u2;
|
||||||
if (u->faction == f || omniscient(f)) cansee = true;
|
|
||||||
else if (old_race(u->race) == RC_SPELL || u->number == 0) return false;
|
if (u->faction == f || omniscient(f)) {
|
||||||
else {
|
return true;
|
||||||
|
} else if (old_race(u->race) == RC_SPELL) {
|
||||||
|
return false;
|
||||||
|
} else if (u->number == 0) {
|
||||||
|
attrib *a = a_find(u->attribs, &at_creator);
|
||||||
|
if(a) { /* u is an empty temporary unit. In this special case
|
||||||
|
we look at the creating unit. */
|
||||||
|
u = (unit *)a->data.v;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
n = eff_stealth(u, r) - modifier;
|
n = eff_stealth(u, r) - modifier;
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
for (u2 = r->units; u2; u2 = u2->next) {
|
||||||
if (u2->faction == f) {
|
if (u2->faction == f) {
|
||||||
|
@ -823,7 +834,6 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return cansee;
|
return cansee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1615,6 +1625,11 @@ createunit(region * r, faction * f, int number, const struct race * rc)
|
||||||
return create_unit(r, f, number, rc, 0, NULL, NULL);
|
return create_unit(r, f, number, rc, 0, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attrib_type at_creator = {
|
||||||
|
"creator"
|
||||||
|
/* Rest ist NULL; temporäres, nicht alterndes Attribut */
|
||||||
|
};
|
||||||
|
|
||||||
unit *
|
unit *
|
||||||
create_unit(region * r, faction * f, int number, const struct race *urace, int id, const char * dname, unit *creator)
|
create_unit(region * r, faction * f, int number, const struct race *urace, int id, const char * dname, unit *creator)
|
||||||
{
|
{
|
||||||
|
@ -1686,6 +1701,9 @@ create_unit(region * r, faction * f, int number, const struct race *urace, int i
|
||||||
if (a) {
|
if (a) {
|
||||||
a_add(&u->attribs, make_otherfaction(get_otherfaction(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 */
|
/* Monster sind grundsätzlich parteigetarnt */
|
||||||
if(f->no <= 0) fset(u, FL_PARTEITARNUNG);
|
if(f->no <= 0) fset(u, FL_PARTEITARNUNG);
|
||||||
|
|
|
@ -1107,6 +1107,7 @@ void cmistake(const struct unit * u, const char *cmd, int mno, int mtype);
|
||||||
|
|
||||||
extern struct attrib_type at_guard;
|
extern struct attrib_type at_guard;
|
||||||
extern struct attrib_type at_lighthouse;
|
extern struct attrib_type at_lighthouse;
|
||||||
|
extern struct attrib_type at_creator;
|
||||||
|
|
||||||
#define GUARD_NONE 0
|
#define GUARD_NONE 0
|
||||||
#define GUARD_TAX 1
|
#define GUARD_TAX 1
|
||||||
|
@ -1123,6 +1124,8 @@ extern struct attrib_type at_lighthouse;
|
||||||
/* Verhindert Unterhaltung auf Schiffen */
|
/* Verhindert Unterhaltung auf Schiffen */
|
||||||
#define GUARD_RECRUIT 64
|
#define GUARD_RECRUIT 64
|
||||||
/* Verhindert Rekrutieren */
|
/* Verhindert Rekrutieren */
|
||||||
|
#define GUARD_PRODUCE 128
|
||||||
|
/* Verhindert Abbau von Resourcen mit RTF_LIMITED */
|
||||||
#define GUARD_ALL 0xFFFF
|
#define GUARD_ALL 0xFFFF
|
||||||
|
|
||||||
extern void setguard(struct unit * u, unsigned int flags);
|
extern void setguard(struct unit * u, unsigned int flags);
|
||||||
|
|
|
@ -698,11 +698,11 @@ is_guardian(unit * u2, unit *u, unsigned int mask)
|
||||||
&& getguard(u2)&mask
|
&& getguard(u2)&mask
|
||||||
&& u2->number
|
&& u2->number
|
||||||
&& !ucontact(u2, u) && !besieged(u2)
|
&& !ucontact(u2, u) && !besieged(u2)
|
||||||
&& allied(u2, u->faction, HELP_GUARD)
|
&& allied(u2, u->faction, HELP_GUARD) != HELP_GUARD
|
||||||
!= HELP_GUARD
|
|
||||||
#ifdef WACH_WAFF
|
#ifdef WACH_WAFF
|
||||||
&& armedmen(u2)
|
&& armedmen(u2)
|
||||||
#endif
|
#endif
|
||||||
|
&& cansee(u2->faction, u->region, u, 0)
|
||||||
) return true;
|
) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
#define SKILLPOINTS 0
|
#define SKILLPOINTS 0
|
||||||
#define NEW_MIGRATION 1
|
#define NEW_MIGRATION 1
|
||||||
#define PEASANTS_DO_NOT_STARVE 0
|
#define PEASANTS_DO_NOT_STARVE 0
|
||||||
#define GUARD_DISABLES_RECRUIT 0
|
#define GUARD_DISABLES_RECRUIT 1
|
||||||
|
#define GUARD_DISABLES_PRODUCTION 1
|
||||||
|
|
||||||
#define RESOURCE_QUANTITY 1.0
|
#define RESOURCE_QUANTITY 1.0
|
||||||
|
|
||||||
|
|
|
@ -103,8 +103,7 @@ nr_render(const struct message * msg, const struct locale * lang, char * buffer,
|
||||||
if (m) {
|
if (m) {
|
||||||
strcpy(buffer, m);
|
strcpy(buffer, m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
log_error(("Couldn't render message %s\n", nrt->mtype->name));
|
log_error(("Couldn't render message %s\n", nrt->mtype->name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,6 +244,6 @@ extern char * strdup(const char *s);
|
||||||
#ifdef STRNCPY_HAS_ZEROTERMINATION
|
#ifdef STRNCPY_HAS_ZEROTERMINATION
|
||||||
# define strnzcpy(dst, src, len) strncpy(dst, src, len)
|
# define strnzcpy(dst, src, len) strncpy(dst, src, len)
|
||||||
#else
|
#else
|
||||||
# define strnzcpy(dst, src, len) (strncpy(dst, src, len), len?dst[len-1]=0:0, dst)
|
# define strnzcpy(dst, src, len) (strncpy(dst, src, len), len?dst[len]=0:0, dst)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
<text locale="en">very few </text>
|
<text locale="en">very few </text>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<string name="sehr viele">
|
||||||
|
<text locale="de">sehr viele</text>
|
||||||
|
<text locale="en">a great many </text>
|
||||||
|
</string>
|
||||||
|
|
||||||
<string name="prefix_Dunkel">
|
<string name="prefix_Dunkel">
|
||||||
<text locale="de">Dunkel</text>
|
<text locale="de">Dunkel</text>
|
||||||
<text locale="en">dark </text>
|
<text locale="en">dark </text>
|
||||||
|
|
|
@ -955,13 +955,6 @@
|
||||||
<text locale="en">Belts of Heroic Legends</text>
|
<text locale="en">Belts of Heroic Legends</text>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<string name="viele">
|
|
||||||
<text locale="en">many</text>
|
|
||||||
</string>
|
|
||||||
<string name="sehr viele">
|
|
||||||
<text locale="en">a great many</text>
|
|
||||||
</string>
|
|
||||||
|
|
||||||
<comment> intranslatables:</comment>
|
<comment> intranslatables:</comment>
|
||||||
<string name="h0">
|
<string name="h0">
|
||||||
<text locale="en">Flachwurz</text>
|
<text locale="en">Flachwurz</text>
|
||||||
|
|
Loading…
Reference in a new issue