forked from github/server
- Drachen in leeren Regionen suche ein neues Ziel.
- kleine Aufräumarbeiten.
This commit is contained in:
parent
6b72f8563b
commit
d778222324
|
@ -1037,10 +1037,12 @@ EnhancedQuit(void)
|
|||
static int
|
||||
quit(unit * u, struct order * ord)
|
||||
{
|
||||
const char * passwd;
|
||||
init_tokens(ord);
|
||||
skip_token(); /* skip keyword */
|
||||
|
||||
if (checkpasswd(u->faction, getstrtoken(), false)) {
|
||||
passwd = getstrtoken();
|
||||
if (checkpasswd(u->faction, passwd, false)) {
|
||||
if (EnhancedQuit()) {
|
||||
int f2_id = getid();
|
||||
|
||||
|
@ -1069,7 +1071,7 @@ quit(unit * u, struct order * ord)
|
|||
} else {
|
||||
cmistake(u, ord, 86, MSG_EVENT);
|
||||
log_warning(("STIRB mit falschem Passwort für Partei %s: %s\n",
|
||||
factionid(u->faction), ord));
|
||||
factionid(u->faction), passwd));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -812,11 +812,13 @@ check_overpopulated(unit *u)
|
|||
static void
|
||||
plan_dragon(unit * u)
|
||||
{
|
||||
attrib *ta;
|
||||
attrib * ta = a_find(u->attribs, &at_targetregion);
|
||||
region * r = u->region;
|
||||
region * tr = NULL;
|
||||
int horses = get_resource(u,R_HORSE);
|
||||
int capacity = walkingcapacity(u);
|
||||
item ** itmp = &u->items;
|
||||
boolean move = false;
|
||||
|
||||
if (horses > 0) {
|
||||
change_resource(u, R_HORSE, - min(horses,(u->number*2)));
|
||||
|
@ -832,7 +834,13 @@ plan_dragon(unit * u)
|
|||
}
|
||||
if (*itmp==itm) itmp=&itm->next;
|
||||
}
|
||||
if (rand() % 100 < 4) {
|
||||
|
||||
if (ta==NULL) {
|
||||
move |= (r->land==0 || r->land->peasants==0); /* when no peasants, move */
|
||||
move |= (r->land==0 || r->land->money==0); /* when no money, move */
|
||||
}
|
||||
move |= chance(0.04); /* 4% chance to change your mind */
|
||||
if (move) {
|
||||
/* dragon gets bored and looks for a different place to go */
|
||||
ta = set_new_dragon_target(u, u->region, DRAGON_RANGE);
|
||||
}
|
||||
|
|
|
@ -1552,6 +1552,29 @@ durchreisende(FILE * F, const region * r, const faction * f)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
buildingmaintenance(const building * b, const resource_type * rtype)
|
||||
{
|
||||
const building_type * bt = b->type;
|
||||
int c, cost=0;
|
||||
static boolean init = false;
|
||||
static const curse_type * nocost_ct;
|
||||
if (!init) { init = true; nocost_ct = ct_find("nocost"); }
|
||||
if (curse_active(get_curse(b->attribs, nocost_ct))) {
|
||||
return 0;
|
||||
}
|
||||
for (c=0;bt->maintenance && bt->maintenance[c].number;++c) {
|
||||
const maintenance * m = bt->maintenance + c;
|
||||
if (m->rtype==rtype) {
|
||||
if (fval(m, MTF_VARIABLE))
|
||||
cost += (b->size * m->number);
|
||||
else
|
||||
cost += m->number;
|
||||
}
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
static void
|
||||
order_template(FILE * F, faction * f)
|
||||
{
|
||||
|
|
|
@ -188,29 +188,6 @@ buildingtype(const building * b, int bsize)
|
|||
return s;
|
||||
}
|
||||
|
||||
int
|
||||
buildingmaintenance(const building * b, const resource_type * rtype)
|
||||
{
|
||||
const building_type * bt = b->type;
|
||||
int c, cost=0;
|
||||
static boolean init = false;
|
||||
static const curse_type * nocost_ct;
|
||||
if (!init) { init = true; nocost_ct = ct_find("nocost"); }
|
||||
if (curse_active(get_curse(b->attribs, nocost_ct))) {
|
||||
return 0;
|
||||
}
|
||||
for (c=0;bt->maintenance && bt->maintenance[c].number;++c) {
|
||||
const maintenance * m = bt->maintenance + c;
|
||||
if (m->rtype==rtype) {
|
||||
if (fval(m, MTF_VARIABLE))
|
||||
cost += (b->size * m->number);
|
||||
else
|
||||
cost += m->number;
|
||||
}
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
#define BMAXHASH 7919
|
||||
static building *buildhash[BMAXHASH];
|
||||
void
|
||||
|
|
|
@ -110,7 +110,6 @@ extern void add_buildinglist(building_list **bl, struct building *b);
|
|||
extern struct attrib_type at_building_generic_type;
|
||||
extern const char * buildingtype(const struct building * b, int bsize);
|
||||
extern const char * buildingname(const struct building * b);
|
||||
extern int buildingmaintenance(const building * b, const struct resource_type * rtype);
|
||||
extern int buildingcapacity(const struct building * b);
|
||||
extern struct building *new_building(const struct building_type * typ, struct region * r, const struct locale * lang);
|
||||
void build_building(struct unit * u, const struct building_type * typ, int size);
|
||||
|
|
Loading…
Reference in New Issue