- WACH_WAFF

define removed, because it will never be turned off again.

- bewache_an()
  renamed to guard_on_cmd, guard_cmd renamed to guard_on_cmd. now uses parse()
  
- http://eressea.upb.de/mantis/bug_view_page.php?bug_id=0000242
  Hungernde Einheiten können Bewache nicht zurücknehmen.
  GUARD is a short command, should be allowed when hungry.
This commit is contained in:
Enno Rehling 2004-09-04 10:16:21 +00:00
parent fa1ab26cfe
commit eb10f3e429
8 changed files with 28 additions and 56 deletions

View File

@ -1098,9 +1098,7 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
&& !ucontact(u2, u) && !ucontact(u2, u)
&& !besieged(u2) && !besieged(u2)
&& !alliedunit(u2, u->faction, HELP_GUARD) && !alliedunit(u2, u->faction, HELP_GUARD)
#ifdef WACH_WAFF
&& armedmen(u2) && armedmen(u2)
#endif
) { ) {
add_message(&u->faction->msgs, add_message(&u->faction->msgs,
msg_feedback(u, u->thisorder, "region_guarded", "guard", u2)); msg_feedback(u, u->thisorder, "region_guarded", "guard", u2));

View File

@ -2565,16 +2565,12 @@ origin_cmd(unit * u, struct order * ord)
} }
static int static int
guard_cmd(unit * u, struct order * ord) guard_off_cmd(unit * u, struct order * ord)
{ {
init_tokens(ord); init_tokens(ord);
skip_token(); skip_token();
if (u->faction->age < IMMUN_GEGEN_ANGRIFF) { if (getparam(u->faction->locale) == P_NOT) {
cmistake(u, ord, 304, MSG_EVENT);
} else if (fval(u, UFL_HUNGER)) {
cmistake(u, ord, 223, MSG_EVENT);
} else if (getparam(u->faction->locale) == P_NOT) {
setguard(u, GUARD_NONE); setguard(u, GUARD_NONE);
} }
return 0; return 0;
@ -2765,7 +2761,7 @@ instant_orders(void)
if (name_cmd(u, ord)!=0) ord = NULL; if (name_cmd(u, ord)!=0) ord = NULL;
break; break;
case K_GUARD: case K_GUARD:
if (guard_cmd(u, ord)!=0) ord = NULL; if (guard_off_cmd(u, ord)!=0) ord = NULL;
break; break;
case K_RESHOW: case K_RESHOW:
if (reshow_cmd(u, ord)!=0) ord = NULL; if (reshow_cmd(u, ord)!=0) ord = NULL;
@ -2791,49 +2787,34 @@ remove_unequipped_guarded(void)
} }
} }
static void static int
bewache_an(void) guard_on_cmd(unit * u, struct order * ord)
{ {
region *r; if (fval(u, UFL_MOVED)) return 0;
unit *u;
/* letzte schnellen befehle - bewache */
for (r = regions; r; r = r->next) {
for (u = r->units; u; u = u->next) {
if (!fval(u, UFL_MOVED)) {
struct order * ord;
for (ord = u->orders; ord; ord = ord->next) {
if (get_keyword(ord) == K_GUARD) {
init_tokens(ord); init_tokens(ord);
skip_token(); skip_token();
if (getparam(u->faction->locale) == P_NOT) continue;
if (rterrain(r) != T_OCEAN) { /* GUARD NOT is handled in goard_off_cmd earlier in the turn */
if (getparam(u->faction->locale) == P_NOT) return 0;
if (rterrain(u->region) != T_OCEAN) {
if (!fval(u, RCF_ILLUSIONARY) && u->race != new_race[RC_SPELL]) { if (!fval(u, RCF_ILLUSIONARY) && u->race != new_race[RC_SPELL]) {
#ifdef WACH_WAFF
/* Monster der Monsterpartei dürfen immer bewachen */ /* Monster der Monsterpartei dürfen immer bewachen */
if (u->faction == findfaction(MONSTER_FACTION)) { if (u->faction == findfaction(MONSTER_FACTION)) {
guard(u, GUARD_ALL); guard(u, GUARD_ALL);
continue; } else if (!armedmen(u)) {
} ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "unit_unarmed", ""));
} else {
if (!armedmen(u)) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "unit_unarmed", ""));
continue;
}
#endif
guard(u, GUARD_ALL); guard(u, GUARD_ALL);
}
} else { } else {
cmistake(u, ord, 95, MSG_EVENT); cmistake(u, ord, 95, MSG_EVENT);
} }
} else { } else {
cmistake(u, ord, 2, MSG_EVENT); cmistake(u, ord, 2, MSG_EVENT);
} }
} return 0;
}
}
}
}
} }
static void static void
@ -3835,7 +3816,7 @@ processorders (void)
movement(); movement();
puts(" - Bewache (an)"); puts(" - Bewache (an)");
bewache_an(); parse(K_USE, guard_on_cmd, false);
puts(" - Zufallsbegegnungen"); puts(" - Zufallsbegegnungen");
encounters(); encounters();

View File

@ -303,7 +303,6 @@ extern void plagues(struct region * r, boolean ismagic);
#define BLOCKSIZE 9 #define BLOCKSIZE 9
/* Nur Bewaffnete bewachen */ /* Nur Bewaffnete bewachen */
#define WACH_WAFF
#undef TROLLSAVE #undef TROLLSAVE
/* Spezialtrank für Insekten */ /* Spezialtrank für Insekten */

View File

@ -781,9 +781,7 @@ is_guardian(unit * u2, unit *u, unsigned int mask)
&& u2->number && u2->number
&& !ucontact(u2, u) && !besieged(u2) && !ucontact(u2, u) && !besieged(u2)
&& alliedunit(u2, u->faction, HELP_GUARD) != HELP_GUARD && alliedunit(u2, u->faction, HELP_GUARD) != HELP_GUARD
#ifdef WACH_WAFF
&& armedmen(u2) && armedmen(u2)
#endif
&& cansee(u2->faction, u->region, u, 0) && cansee(u2->faction, u->region, u, 0)
) return true; ) return true;

View File

@ -206,7 +206,7 @@
Name="Text Files" Name="Text Files"
Filter=""> Filter="">
<File <File
RelativePath="..\commit.txt"> RelativePath="..\changelog.txt">
</File> </File>
<File <File
RelativePath="..\header.txt"> RelativePath="..\header.txt">

View File

@ -302,9 +302,7 @@ processturn(char *filename)
} }
processorders(); processorders();
score(); score();
#ifdef WACH_WAFF
remove_unequipped_guarded(); remove_unequipped_guarded();
#endif
korrektur_end(); korrektur_end();
if (!noreports) reports(); if (!noreports) reports();
free_units(); free_units();

View File

@ -352,9 +352,7 @@ process_orders()
#endif #endif
processorders(); processorders();
score(); score();
#ifdef WACH_WAFF
remove_unequipped_guarded(); remove_unequipped_guarded();
#endif
korrektur_end(); korrektur_end();
end = make_summary(true); end = make_summary(true);