forked from github/server
Generalisierung der Tests fuer lange Befehle, (Insekten, Meermenschen auf See usw.) damit ich die nicht ueberall vergesse.
This commit is contained in:
parent
eb1d2373e8
commit
c722a382a2
|
@ -1604,20 +1604,20 @@ 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_DISABLES_PRODUCTION == 1
|
#if GUARD_DISABLES_PRODUCTION == 1
|
||||||
if(is_guarded(u->region, u, GUARD_PRODUCE)) {
|
if(is_guarded(u->region, u, GUARD_PRODUCE)) {
|
||||||
cmistake(u, u->thisorder, 70, MSG_EVENT);
|
cmistake(u, u->thisorder, 70, MSG_EVENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#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);
|
||||||
else cmistake(u, u->thisorder, 125, MSG_PRODUCE);
|
else cmistake(u, u->thisorder, 125, MSG_PRODUCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1632,13 +1632,6 @@ make_cmd(unit * u, struct order * ord)
|
||||||
const char *s;
|
const char *s;
|
||||||
const struct locale * lang = u->faction->locale;
|
const struct locale * lang = u->faction->locale;
|
||||||
|
|
||||||
if (u->number==0) return 0;
|
|
||||||
|
|
||||||
if (fval(r->terrain, SEA_REGION) && u->race != new_race[RC_AQUARIAN]) {
|
|
||||||
cmistake(u, ord, 242, MSG_INCOME);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
init_tokens(ord);
|
init_tokens(ord);
|
||||||
skip_token();
|
skip_token();
|
||||||
s = getstrtoken();
|
s = getstrtoken();
|
||||||
|
|
|
@ -3688,14 +3688,18 @@ claim_cmd(unit * u, struct order * ord)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROC_THISORDER = 1<<0,
|
||||||
|
PROC_LONGORDER = 1<<1
|
||||||
|
};
|
||||||
typedef struct processor {
|
typedef struct processor {
|
||||||
struct processor * next;
|
struct processor * next;
|
||||||
int priority;
|
int priority;
|
||||||
enum { PR_GLOBAL, PR_REGION_PRE, PR_UNIT, PR_ORDER, PR_REGION_POST } type;
|
enum { PR_GLOBAL, PR_REGION_PRE, PR_UNIT, PR_ORDER, PR_REGION_POST } type;
|
||||||
|
unsigned int flags;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
keyword_t kword;
|
keyword_t kword;
|
||||||
boolean thisorder;
|
|
||||||
int (*process)(struct unit *, struct order *);
|
int (*process)(struct unit *, struct order *);
|
||||||
} per_order;
|
} per_order;
|
||||||
struct {
|
struct {
|
||||||
|
@ -3736,13 +3740,13 @@ add_proc(int priority, const char * name, int type)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_proc_order(int priority, keyword_t kword, int (*parser)(struct unit *, struct order *), boolean thisorder, const char * name)
|
add_proc_order(int priority, keyword_t kword, int (*parser)(struct unit *, struct order *), unsigned int flags, const char * name)
|
||||||
{
|
{
|
||||||
processor * proc = add_proc(priority, name, PR_ORDER);
|
processor * proc = add_proc(priority, name, PR_ORDER);
|
||||||
if (proc) {
|
if (proc) {
|
||||||
proc->data.per_order.process = parser;
|
proc->data.per_order.process = parser;
|
||||||
proc->data.per_order.kword = kword;
|
proc->data.per_order.kword = kword;
|
||||||
proc->data.per_order.thisorder = thisorder;
|
proc->flags = flags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3827,13 +3831,31 @@ process(void)
|
||||||
porder = punit;
|
porder = punit;
|
||||||
while (porder && porder->priority==prio && porder->type==PR_ORDER) {
|
while (porder && porder->priority==prio && porder->type==PR_ORDER) {
|
||||||
order ** ordp = &u->orders;
|
order ** ordp = &u->orders;
|
||||||
if (porder->data.per_order.thisorder) ordp = &u->thisorder;
|
if (porder->flags & PROC_THISORDER) ordp = &u->thisorder;
|
||||||
while (*ordp) {
|
while (*ordp) {
|
||||||
order * ord = *ordp;
|
order * ord = *ordp;
|
||||||
if (get_keyword(ord) == porder->data.per_order.kword) {
|
if (get_keyword(ord) == porder->data.per_order.kword) {
|
||||||
porder->data.per_order.process(u, ord);
|
if (u->number==0) {
|
||||||
|
ord = NULL;
|
||||||
|
} else if (porder->flags & PROC_LONGORDER) {
|
||||||
|
if (u->race == new_race[RC_INSECT] && r_insectstalled(r) && !is_cursed(u->attribs, C_KAELTESCHUTZ,0)) {
|
||||||
|
ord = NULL;
|
||||||
|
} else if (LongHunger(u)) {
|
||||||
|
cmistake(u, ord, 224, MSG_MAGIC);
|
||||||
|
ord = NULL;
|
||||||
|
} else if (fval(u, UFL_LONGACTION)) {
|
||||||
|
cmistake(u, ord, 52, MSG_PRODUCE);
|
||||||
|
ord = NULL;
|
||||||
|
} else if (fval(r->terrain, SEA_REGION) && u->race != new_race[RC_AQUARIAN] && !(u->race->flags & RCF_SWIM)) {
|
||||||
|
cmistake(u, ord, 242, MSG_INCOME);
|
||||||
|
ord = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ord) {
|
||||||
|
porder->data.per_order.process(u, ord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (*ordp==ord) ordp=&ord->next;
|
if (!ord || *ordp==ord) ordp=&(*ordp)->next;
|
||||||
}
|
}
|
||||||
porder = porder->next;
|
porder = porder->next;
|
||||||
}
|
}
|
||||||
|
@ -3876,28 +3898,28 @@ processorders (void)
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
add_proc_unit(p, &setdefaults, "Default-Befehle");
|
add_proc_unit(p, &setdefaults, "Default-Befehle");
|
||||||
add_proc_order(p, K_BANNER, &banner_cmd, false, NULL);
|
add_proc_order(p, K_BANNER, &banner_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_EMAIL, &email_cmd, false, NULL);
|
add_proc_order(p, K_EMAIL, &email_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_PASSWORD, &password_cmd, false, NULL);
|
add_proc_order(p, K_PASSWORD, &password_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_SEND, &send_cmd, false, NULL);
|
add_proc_order(p, K_SEND, &send_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_GROUP, &group_cmd, false, NULL);
|
add_proc_order(p, K_GROUP, &group_cmd, 0, NULL);
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
add_proc_unit(p, &reset_moved, "Instant-Befehle");
|
add_proc_unit(p, &reset_moved, "Instant-Befehle");
|
||||||
add_proc_order(p, K_QUIT, &quit_cmd, false, NULL);
|
add_proc_order(p, K_QUIT, &quit_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_URSPRUNG, &origin_cmd, false, NULL);
|
add_proc_order(p, K_URSPRUNG, &origin_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_ALLY, &ally_cmd, false, NULL);
|
add_proc_order(p, K_ALLY, &ally_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_PREFIX, &prefix_cmd, false, NULL);
|
add_proc_order(p, K_PREFIX, &prefix_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_SYNONYM, &synonym_cmd, false, NULL);
|
add_proc_order(p, K_SYNONYM, &synonym_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_SETSTEALTH, &setstealth_cmd, false, NULL);
|
add_proc_order(p, K_SETSTEALTH, &setstealth_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_STATUS, &status_cmd, false, NULL);
|
add_proc_order(p, K_STATUS, &status_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_COMBAT, &combatspell_cmd, false, NULL);
|
add_proc_order(p, K_COMBAT, &combatspell_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_DISPLAY, &display_cmd, false, NULL);
|
add_proc_order(p, K_DISPLAY, &display_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_NAME, &name_cmd, false, NULL);
|
add_proc_order(p, K_NAME, &name_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_GUARD, &guard_off_cmd, false, NULL);
|
add_proc_order(p, K_GUARD, &guard_off_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_RESHOW, &reshow_cmd, false, NULL);
|
add_proc_order(p, K_RESHOW, &reshow_cmd, 0, NULL);
|
||||||
#ifdef KARMA_MODULE
|
#ifdef KARMA_MODULE
|
||||||
add_proc_order(p, K_WEREWOLF, &setwere_cmd, false, NULL);
|
add_proc_order(p, K_WEREWOLF, &setwere_cmd, 0, NULL);
|
||||||
#endif /* KARMA_MODULE */
|
#endif /* KARMA_MODULE */
|
||||||
|
|
||||||
if (alliances!=NULL) {
|
if (alliances!=NULL) {
|
||||||
|
@ -3907,12 +3929,12 @@ processorders (void)
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
add_proc_global(p, &age_factions, "Parteienalter++");
|
add_proc_global(p, &age_factions, "Parteienalter++");
|
||||||
add_proc_order(p, K_MAIL, &mail_cmd, false, "Botschaften");
|
add_proc_order(p, K_MAIL, &mail_cmd, 0, "Botschaften");
|
||||||
add_proc_order(p, K_CLAIM, &claim_cmd, false, NULL);
|
add_proc_order(p, K_CLAIM, &claim_cmd, 0, NULL);
|
||||||
|
|
||||||
p+=10; /* all claims must be done before we can USE */
|
p+=10; /* all claims must be done before we can USE */
|
||||||
add_proc_region(p, &enter_1, "Kontaktieren & Betreten (1. Versuch)");
|
add_proc_region(p, &enter_1, "Kontaktieren & Betreten (1. Versuch)");
|
||||||
add_proc_order(p, K_USE, &use_cmd, false, "Benutzen");
|
add_proc_order(p, K_USE, &use_cmd, 0, "Benutzen");
|
||||||
|
|
||||||
if (alliances!=NULL) {
|
if (alliances!=NULL) {
|
||||||
p+=10; /* in case USE changes it */
|
p+=10; /* in case USE changes it */
|
||||||
|
@ -3925,7 +3947,7 @@ processorders (void)
|
||||||
add_proc_global(p, &gmcommands, "GM Kommandos");
|
add_proc_global(p, &gmcommands, "GM Kommandos");
|
||||||
|
|
||||||
p += 10; /* in case it has any effects on allincevictories */
|
p += 10; /* in case it has any effects on allincevictories */
|
||||||
add_proc_order(p, K_LEAVE, &leave_cmd, false, "Verlassen");
|
add_proc_order(p, K_LEAVE, &leave_cmd, 0, "Verlassen");
|
||||||
|
|
||||||
if (!nobattle) {
|
if (!nobattle) {
|
||||||
#ifdef KARMA_MODULE
|
#ifdef KARMA_MODULE
|
||||||
|
@ -3941,7 +3963,7 @@ processorders (void)
|
||||||
|
|
||||||
p+=10; /* can't allow reserve before siege (weapons) */
|
p+=10; /* can't allow reserve before siege (weapons) */
|
||||||
add_proc_region(p, &enter_1, "Kontaktieren & Betreten (2. Versuch)");
|
add_proc_region(p, &enter_1, "Kontaktieren & Betreten (2. Versuch)");
|
||||||
add_proc_order(p, K_RESERVE, &reserve_cmd, false, "Reservieren");
|
add_proc_order(p, K_RESERVE, &reserve_cmd, 0, "Reservieren");
|
||||||
add_proc_unit(p, &follow_unit, "Folge auf Einheiten setzen");
|
add_proc_unit(p, &follow_unit, "Folge auf Einheiten setzen");
|
||||||
|
|
||||||
p+=10; /* rest rng again before economics */
|
p+=10; /* rest rng again before economics */
|
||||||
|
@ -3960,13 +3982,14 @@ processorders (void)
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
if (!global.disabled[K_TEACH]) {
|
if (!global.disabled[K_TEACH]) {
|
||||||
add_proc_region(p, &teaching, "Lehren");
|
add_proc_order(p, K_TEACH, &teach_cmd, PROC_THISORDER|PROC_LONGORDER, "Lehren");
|
||||||
}
|
}
|
||||||
add_proc_order(p, K_STUDY, &learn_cmd, true, "Lernen");
|
p+=10;
|
||||||
|
add_proc_order(p, K_STUDY, &learn_cmd, PROC_THISORDER|PROC_LONGORDER, "Lernen");
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
add_proc_global(p, &produce, "Arbeiten, Handel, Rekruten");
|
add_proc_global(p, &produce, "Arbeiten, Handel, Rekruten");
|
||||||
add_proc_order(p, K_MAKE, &make_cmd, true, "Produktion");
|
add_proc_order(p, K_MAKE, &make_cmd, PROC_THISORDER|PROC_LONGORDER, "Produktion");
|
||||||
add_proc_postregion(p, &split_allocations, "Produktion II");
|
add_proc_postregion(p, &split_allocations, "Produktion II");
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
|
@ -3979,10 +4002,10 @@ processorders (void)
|
||||||
add_proc_global(p, &movement, "Bewegungen");
|
add_proc_global(p, &movement, "Bewegungen");
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
add_proc_order(p, K_GUARD, &guard_on_cmd, false, "Bewache (an)");
|
add_proc_order(p, K_GUARD, &guard_on_cmd, 0, "Bewache (an)");
|
||||||
#ifdef XECMD_MODULE
|
#ifdef XECMD_MODULE
|
||||||
/* can do together with guard */
|
/* can do together with guard */
|
||||||
add_proc_order(p, K_LEAVE, &xecmd, false, "Zeitung");
|
add_proc_order(p, K_LEAVE, &xecmd, 0, "Zeitung");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
|
@ -4018,9 +4041,9 @@ processorders (void)
|
||||||
add_proc_global(p, &declare_war, "Krieg & Frieden");
|
add_proc_global(p, &declare_war, "Krieg & Frieden");
|
||||||
#endif
|
#endif
|
||||||
#ifdef HEROES
|
#ifdef HEROES
|
||||||
add_proc_order(p, K_PROMOTION, &promotion_cmd, false, "Heldenbeförderung");
|
add_proc_order(p, K_PROMOTION, &promotion_cmd, 0, "Heldenbeförderung");
|
||||||
#endif
|
#endif
|
||||||
add_proc_order(p, K_NUMBER, &renumber_cmd, false, "Neue Nummern (Einheiten)");
|
add_proc_order(p, K_NUMBER, &renumber_cmd, 0, "Neue Nummern (Einheiten)");
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
add_proc_global(p, &renumber_factions, "Neue Nummern");
|
add_proc_global(p, &renumber_factions, "Neue Nummern");
|
||||||
|
|
|
@ -238,22 +238,33 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
int
|
||||||
teach(unit * u, struct order * ord)
|
teach_cmd(unit * u, struct order * ord)
|
||||||
{
|
{
|
||||||
|
static const curse_type * gbdream_ct = NULL;
|
||||||
|
|
||||||
region * r = u->region;
|
region * r = u->region;
|
||||||
int teaching, i, j, count, academy=0;
|
int teaching, i, j, count, academy=0;
|
||||||
unit *u2;
|
unit *u2;
|
||||||
skill_t sk = NOSKILL;
|
skill_t sk = NOSKILL;
|
||||||
|
|
||||||
|
if (gbdream_ct==0) gbdream_ct = ct_find("gbdream");
|
||||||
|
if (gbdream_ct) {
|
||||||
|
if (get_curse(u->region->attribs, gbdream_ct)) {
|
||||||
|
ADDMSG(&u->faction->msgs,
|
||||||
|
msg_feedback(u, ord, "gbdream_noteach", ""));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((u->race->flags & RCF_NOTEACH) || fval(u, UFL_WERE)) {
|
if ((u->race->flags & RCF_NOTEACH) || fval(u, UFL_WERE)) {
|
||||||
cmistake(u, ord, 274, MSG_EVENT);
|
cmistake(u, ord, 274, MSG_EVENT);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r->planep && fval(r->planep, PFL_NOTEACH)) {
|
if (r->planep && fval(r->planep, PFL_NOTEACH)) {
|
||||||
cmistake(u, ord, 273, MSG_EVENT);
|
cmistake(u, ord, 273, MSG_EVENT);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
teaching = u->number * 30 * TEACHNUMBER;
|
teaching = u->number * 30 * TEACHNUMBER;
|
||||||
|
@ -267,7 +278,7 @@ teach(unit * u, struct order * ord)
|
||||||
ADDMSG(&u->faction->msgs, msg_message("teachdumb",
|
ADDMSG(&u->faction->msgs, msg_message("teachdumb",
|
||||||
"teacher amount", u, j));
|
"teacher amount", u, j));
|
||||||
}
|
}
|
||||||
if (teaching == 0) return;
|
if (teaching == 0) return 0;
|
||||||
|
|
||||||
|
|
||||||
u2 = 0;
|
u2 = 0;
|
||||||
|
@ -436,6 +447,7 @@ teach(unit * u, struct order * ord)
|
||||||
academy = academy/30; /* anzahl gelehrter wochen, max. 10 */
|
academy = academy/30; /* anzahl gelehrter wochen, max. 10 */
|
||||||
learn_skill(u, sk, academy/30.0/TEACHNUMBER);
|
learn_skill(u, sk, academy/30.0/TEACHNUMBER);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -460,23 +472,6 @@ learn_cmd(unit * u, order * ord)
|
||||||
else learn_newskills = 1;
|
else learn_newskills = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u->number==0) return 0;
|
|
||||||
if (fval(r->terrain, SEA_REGION)) {
|
|
||||||
/* sonderbehandlung aller die auf Ozeanen lernen können */
|
|
||||||
if (u->race!=new_race[RC_AQUARIAN] && !(u->race->flags & RCF_SWIM)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (fval(u, UFL_LONGACTION)) return 0;
|
|
||||||
|
|
||||||
if (u->race == new_race[RC_INSECT] && r_insectstalled(r)
|
|
||||||
&& !is_cursed(u->attribs, C_KAELTESCHUTZ,0)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (fval(u, UFL_LONGACTION)) {
|
|
||||||
cmistake(u, ord, 52, MSG_PRODUCE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if ((u->race->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) {
|
if ((u->race->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) {
|
||||||
sprintf(buf, "%s können nichts lernen", LOC(default_locale, rc_name(u->race, 1)));
|
sprintf(buf, "%s können nichts lernen", LOC(default_locale, rc_name(u->race, 1)));
|
||||||
mistake(u, ord, buf, MSG_EVENT);
|
mistake(u, ord, buf, MSG_EVENT);
|
||||||
|
@ -744,51 +739,3 @@ learn_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
teaching(region *r)
|
|
||||||
{
|
|
||||||
/* das sind alles befehle, die 30 tage brauchen, und die in thisorder
|
|
||||||
* stehen! von allen 30-tage befehlen wird einfach der letzte verwendet
|
|
||||||
* (dosetdefaults).
|
|
||||||
*
|
|
||||||
* lehren vor lernen. */
|
|
||||||
|
|
||||||
unit *u;
|
|
||||||
|
|
||||||
for (u = r->units; u; u = u->next) {
|
|
||||||
|
|
||||||
if (u->race == new_race[RC_SPELL] || fval(u, UFL_LONGACTION))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fval(r->terrain, SEA_REGION)
|
|
||||||
&& u->race != new_race[RC_AQUARIAN]
|
|
||||||
&& !(u->race->flags & RCF_SWIM))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (u->race == new_race[RC_INSECT] && r_insectstalled(r)
|
|
||||||
&& !is_cursed(u->attribs, C_KAELTESCHUTZ,0)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (get_keyword(u->thisorder)) {
|
|
||||||
case K_TEACH:
|
|
||||||
if (fval(u, UFL_LONGACTION)) {
|
|
||||||
cmistake(u, u->thisorder, 52, MSG_PRODUCE);
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
static const curse_type * gbdream_ct = NULL;
|
|
||||||
if (gbdream_ct==0) gbdream_ct = ct_find("gbdream");
|
|
||||||
if (gbdream_ct) {
|
|
||||||
if (get_curse(u->region->attribs, gbdream_ct)) {
|
|
||||||
ADDMSG(&u->faction->msgs,
|
|
||||||
msg_feedback(u, u->thisorder, "gbdream_noteach", ""));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
teach(u, u->thisorder);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void teaching(struct region * r);
|
extern int teach_cmd(struct unit * u, struct order * ord);
|
||||||
extern int learn_cmd(struct unit * u, struct order * ord);
|
extern int learn_cmd(struct unit * u, struct order * ord);
|
||||||
|
|
||||||
extern magic_t getmagicskill(void);
|
extern magic_t getmagicskill(void);
|
||||||
|
|
|
@ -49,41 +49,41 @@
|
||||||
void
|
void
|
||||||
herbsearch(region * r, unit * u, int max)
|
herbsearch(region * r, unit * u, int max)
|
||||||
{
|
{
|
||||||
int herbsfound;
|
int herbsfound;
|
||||||
const item_type * whichherb;
|
const item_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)) {
|
if(is_guarded(r, u, GUARD_PRODUCE)) {
|
||||||
cmistake(u, u->thisorder, 70, MSG_EVENT);
|
cmistake(u, u->thisorder, 70, MSG_EVENT);
|
||||||
return;
|
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);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max) max = min(max, rherbs(r));
|
if (max) max = min(max, rherbs(r));
|
||||||
else max = rherbs(r);
|
else max = rherbs(r);
|
||||||
herbsfound = ntimespprob(eff_skill(u, SK_HERBALISM, r) * u->number,
|
herbsfound = ntimespprob(eff_skill(u, SK_HERBALISM, r) * u->number,
|
||||||
(double)rherbs(r)/100.0L, -0.01L);
|
(double)rherbs(r)/100.0L, -0.01L);
|
||||||
herbsfound = min(herbsfound, max);
|
herbsfound = min(herbsfound, max);
|
||||||
rsetherbs(r, rherbs(r)-herbsfound);
|
rsetherbs(r, rherbs(r)-herbsfound);
|
||||||
|
|
||||||
if (herbsfound) {
|
if (herbsfound) {
|
||||||
produceexp(u, SK_HERBALISM, u->number);
|
produceexp(u, SK_HERBALISM, u->number);
|
||||||
i_change(&u->items, whichherb, herbsfound);
|
i_change(&u->items, whichherb, herbsfound);
|
||||||
ADDMSG(&u->faction->msgs, msg_message("herbfound",
|
ADDMSG(&u->faction->msgs, msg_message("herbfound",
|
||||||
"unit region amount herb", u, r, herbsfound, whichherb->rtype));
|
"unit region amount herb", u, r, herbsfound, whichherb->rtype));
|
||||||
} else {
|
} else {
|
||||||
ADDMSG(&u->faction->msgs, msg_message("researchherb_none",
|
ADDMSG(&u->faction->msgs, msg_message("researchherb_none",
|
||||||
"unit region", u, u->region));
|
"unit region", u, u->region));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -270,7 +270,7 @@ give_starting_equipment(struct unit *u)
|
||||||
boolean
|
boolean
|
||||||
r_insectstalled(const region * r)
|
r_insectstalled(const region * r)
|
||||||
{
|
{
|
||||||
return fval(r->terrain, ARCTIC_REGION);
|
return fval(r->terrain, ARCTIC_REGION);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
Loading…
Reference in New Issue