undead could still not give away items to peasants.

This commit is contained in:
Enno Rehling 2003-09-21 08:47:28 +00:00
parent cae86ae4d5
commit 6873e0d870
2 changed files with 448 additions and 443 deletions

View File

@ -1,23 +1,23 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* *
* Eressea PB(E)M host Copyright (C) 1998-2003 * Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de) * Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de) * Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) * Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
* *
* based on: * based on:
* *
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace * Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
* Atlantis v1.7 Copyright 1996 by Alex Schröder * Atlantis v1.7 Copyright 1996 by Alex Schröder
* *
* This program may not be used, modified or distributed without * This program may not be used, modified or distributed without
* prior permission by the authors of Eressea. * prior permission by the authors of Eressea.
* This program may not be sold or used commercially without prior written * This program may not be sold or used commercially without prior written
* permission from the authors. * permission from the authors.
*/ */
#define RESERVE_DONATIONS 1 /* shall we reserve objects given to us by other factions? */ #define RESERVE_DONATIONS 1 /* shall we reserve objects given to us by other factions? */
#define RESERVE_GIVE 1 /* reserve anything that's given from one unit to another? */ #define RESERVE_GIVE 1 /* reserve anything that's given from one unit to another? */
@ -300,7 +300,7 @@ expandrecruit(region * r, request * recruitorders)
n++; n++;
} }
} }
/* set_number(u, u->number + 1); */ /* set_number(u, u->number + 1); */
u->race = rc; u->race = rc;
u->n++; u->n++;
} }
@ -511,7 +511,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
* */ * */
static void static void
give_peasants(int n, const item_type * itype, unit * src) give_peasants(int n, const item_type * itype, unit * src)
{ {
@ -803,11 +803,11 @@ giveunit(region * r, unit * u, unit * u2, strlist * S)
static void static void
dogive(region * r, unit * u, strlist * S, int mode) dogive(region * r, unit * u, strlist * S, 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
*/ */
{ {
unit *u2; unit *u2;
const char *s; const char *s;
@ -911,7 +911,7 @@ dogive(region * r, unit * u, strlist * S, int mode)
/* Übergabe aller Kräuter */ /* Übergabe aller Kräuter */
if (findparam(s, u->faction->locale) == P_HERBS) { if (findparam(s, u->faction->locale) == P_HERBS) {
boolean given = false; boolean given = false;
if (!(u->race->ec_flags & GIVEITEM)) { if (!(u->race->ec_flags & GIVEITEM) && u2!=NULL) {
ADDMSG(&u->faction->msgs, ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_nogive", "race", u->race)); msg_error(u, S->s, "race_nogive", "race", u->race));
return; return;
@ -972,7 +972,7 @@ dogive(region * r, unit * u, strlist * S, int mode)
} }
if (*s == 0) { if (*s == 0) {
if (!(u->race->ec_flags & GIVEITEM)) { if (!(u->race->ec_flags & GIVEITEM) && u2!=NULL) {
ADDMSG(&u->faction->msgs, ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_nogive", "race", u->race)); msg_error(u, S->s, "race_nogive", "race", u->race));
return; return;
@ -1010,7 +1010,7 @@ dogive(region * r, unit * u, strlist * S, int mode)
return; return;
} }
if (!(u->race->ec_flags & GIVEITEM)) { if (!(u->race->ec_flags & GIVEITEM) && u2!=NULL) {
ADDMSG(&u->faction->msgs, ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_nogive", "race", u->race)); msg_error(u, S->s, "race_nogive", "race", u->race));
return; return;
@ -1060,7 +1060,7 @@ dogive(region * r, unit * u, strlist * S, int mode)
} }
if (u2!=NULL) { if (u2!=NULL) {
if (!(u->race->ec_flags & GIVEITEM)) { if (!(u->race->ec_flags & GIVEITEM) && u2!=NULL) {
ADDMSG(&u->faction->msgs, ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_nogive", "race", u->race)); msg_error(u, S->s, "race_nogive", "race", u->race));
return; return;
@ -1137,7 +1137,7 @@ add_spende(faction * f1, faction * f2, int betrag, region * r)
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;

View File

@ -304,14 +304,19 @@ destroy_road(unit *u, int n, const char *cmd)
int road = rroad(r, d); int road = rroad(r, d);
region * r2 = rconnect(r,d); region * r2 = rconnect(r,d);
willdo = min(willdo, road); willdo = min(willdo, road);
if (willdo==0) {
/* TODO: error message */
}
#if 0 #if 0
salvage = willdo / divy; salvage = willdo / divy;
change_item(u, I_STONE, salvage); change_item(u, I_STONE, salvage);
#endif #endif
rsetroad(r, d, road - willdo); rsetroad(r, d, road - willdo);
if (road!=0 && road <= willdo) {
add_message(&u->faction->msgs, new_message( add_message(&u->faction->msgs, new_message(
u->faction, "destroy_road%u:unit%r:from%r:to", u, r, r2)); u->faction, "destroy_road%u:unit%r:from%r:to", u, r, r2));
} }
}
} }
void void