- GUARD_DISABLES_PRODUCTION

- Bewache wirkt nur noch, wenn der Bewacher den Bewachten sieht
This commit is contained in:
Christian Schlittchen 2002-04-21 17:22:48 +00:00
parent d81be270aa
commit 4e076dd4ae
12 changed files with 434 additions and 399 deletions

View File

@ -358,6 +358,9 @@ recruit(region * r, unit * u, strlist * S,
int recruitcost;
#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)) {
cmistake(u, S->s, 70, MSG_EVENT);
return;
@ -1845,9 +1848,15 @@ create_potion(unit * u, const potion_type * ptype, int want)
static void
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);
else {
} else {
const potion_type * ptype = resource2potion(itype->rtype);
if (ptype!=NULL) create_potion(u, ptype, want);
else if (itype->construction && itype->construction->materials) manufacture(u, itype, want);
@ -1887,10 +1896,7 @@ make(region * r, unit * u)
return;
}
if (p == P_HERBS) {
herbsearch(r, u, m);
return;
} else if (p == P_ROAD) {
if (p == P_ROAD) {
direction_t d;
if(r->planep && fval(r->planep, PFL_NOBUILD)) {
cmistake(u, findorder(u, u->thisorder), 275, MSG_PRODUCE);
@ -1912,6 +1918,9 @@ make(region * r, unit * u)
}
continue_ship(r, u, m);
return;
} else if (p == P_HERBS) {
herbsearch(r, u, m);
return;
}
stype = findshiptype(s, u->faction->locale);

View File

@ -688,7 +688,7 @@ horses(region * r)
rsethorses(r, (int)(horses*0.9));
} else if (maxhorses > 0) {
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;
/* printf("Horses: <%d> %d -> ", growth, horses); */
@ -3029,6 +3029,7 @@ maxunits(faction *f)
return (int) (global.maxunits * (1 + 0.4 * fspecial(f, FS_ADMINISTRATOR)));
}
static void
new_units (void)
{

View File

@ -1866,15 +1866,14 @@ report(FILE *F, faction * f, const faction_list * addresses,
}
if (f->age <= 2) {
/* doppelt gemoppelt und funktioniert nicht. */
if (f->age <= 1) {
ADDMSG(&f->msgs, msg_message("changepasswd",
"value", gc_add(strdup(f->passw))));
}
/* Was tut das? */
RENDER(f, buf, sizeof(buf), ("newbie_password", "password", f->passw));
rnl(F);
centre(F, buf, true);
rnl(F);
centre(F, LOC(f->locale, "newbie_info_1"), true);
rnl(F);
centre(F, LOC(f->locale, "newbie_info_2"), true);

View File

@ -33,6 +33,7 @@
#include "race.h"
#include "unit.h"
#include "skill.h"
#include "movement.h"
/* util includes */
#include <rand.h>
@ -50,11 +51,17 @@ herbsearch(region * r, unit * u, int max)
{
int herbsfound;
const herb_type * whichherb;
if (eff_skill(u, SK_HERBALISM, r) == 0) {
cmistake(u, u->thisorder, 59, MSG_PRODUCE);
return;
}
if(is_guarded(r, u, GUARD_PRODUCE)) {
cmistake(u, findorder(u, u->thisorder), 70, MSG_EVENT);
return;
}
whichherb = rherbtype(r);
if (whichherb == NULL) {
cmistake(u, u->thisorder, 108, MSG_PRODUCE);

View File

@ -796,9 +796,20 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
int n;
boolean cansee = false;
unit *u2;
if (u->faction == f || omniscient(f)) cansee = true;
else if (old_race(u->race) == RC_SPELL || u->number == 0) return false;
else {
if (u->faction == f || omniscient(f)) {
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;
for (u2 = r->units; u2; u2 = u2->next) {
if (u2->faction == f) {
@ -823,7 +834,6 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
}
}
}
}
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);
}
attrib_type at_creator = {
"creator"
/* Rest ist NULL; temporäres, nicht alterndes Attribut */
};
unit *
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) {
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, FL_PARTEITARNUNG);

View File

@ -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_lighthouse;
extern struct attrib_type at_creator;
#define GUARD_NONE 0
#define GUARD_TAX 1
@ -1123,6 +1124,8 @@ extern struct attrib_type at_lighthouse;
/* Verhindert Unterhaltung auf Schiffen */
#define GUARD_RECRUIT 64
/* Verhindert Rekrutieren */
#define GUARD_PRODUCE 128
/* Verhindert Abbau von Resourcen mit RTF_LIMITED */
#define GUARD_ALL 0xFFFF
extern void setguard(struct unit * u, unsigned int flags);

View File

@ -698,11 +698,11 @@ is_guardian(unit * u2, unit *u, unsigned int mask)
&& getguard(u2)&mask
&& u2->number
&& !ucontact(u2, u) && !besieged(u2)
&& allied(u2, u->faction, HELP_GUARD)
!= HELP_GUARD
&& allied(u2, u->faction, HELP_GUARD) != HELP_GUARD
#ifdef WACH_WAFF
&& armedmen(u2)
#endif
&& cansee(u2->faction, u->region, u, 0)
) return true;
return false;

View File

@ -30,7 +30,8 @@
#define SKILLPOINTS 0
#define NEW_MIGRATION 1
#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

View File

@ -103,8 +103,7 @@ nr_render(const struct message * msg, const struct locale * lang, char * buffer,
if (m) {
strcpy(buffer, m);
return 0;
}
else {
} else {
log_error(("Couldn't render message %s\n", nrt->mtype->name));
}
}

View File

@ -244,6 +244,6 @@ extern char * strdup(const char *s);
#ifdef STRNCPY_HAS_ZEROTERMINATION
# define strnzcpy(dst, src, len) strncpy(dst, src, len)
#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

View File

@ -31,6 +31,11 @@
<text locale="en">very few </text>
</string>
<string name="sehr viele">
<text locale="de">sehr viele</text>
<text locale="en">a great many </text>
</string>
<string name="prefix_Dunkel">
<text locale="de">Dunkel</text>
<text locale="en">dark </text>

View File

@ -955,13 +955,6 @@
<text locale="en">Belts of Heroic Legends</text>
</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>
<string name="h0">
<text locale="en">Flachwurz</text>