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
|
static int
|
||||||
quit(unit * u, struct order * ord)
|
quit(unit * u, struct order * ord)
|
||||||
{
|
{
|
||||||
|
const char * passwd;
|
||||||
init_tokens(ord);
|
init_tokens(ord);
|
||||||
skip_token(); /* skip keyword */
|
skip_token(); /* skip keyword */
|
||||||
|
|
||||||
if (checkpasswd(u->faction, getstrtoken(), false)) {
|
passwd = getstrtoken();
|
||||||
|
if (checkpasswd(u->faction, passwd, false)) {
|
||||||
if (EnhancedQuit()) {
|
if (EnhancedQuit()) {
|
||||||
int f2_id = getid();
|
int f2_id = getid();
|
||||||
|
|
||||||
|
@ -1069,7 +1071,7 @@ quit(unit * u, struct order * ord)
|
||||||
} else {
|
} else {
|
||||||
cmistake(u, ord, 86, MSG_EVENT);
|
cmistake(u, ord, 86, MSG_EVENT);
|
||||||
log_warning(("STIRB mit falschem Passwort für Partei %s: %s\n",
|
log_warning(("STIRB mit falschem Passwort für Partei %s: %s\n",
|
||||||
factionid(u->faction), ord));
|
factionid(u->faction), passwd));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -812,11 +812,13 @@ check_overpopulated(unit *u)
|
||||||
static void
|
static void
|
||||||
plan_dragon(unit * u)
|
plan_dragon(unit * u)
|
||||||
{
|
{
|
||||||
attrib *ta;
|
attrib * ta = a_find(u->attribs, &at_targetregion);
|
||||||
|
region * r = u->region;
|
||||||
region * tr = NULL;
|
region * tr = NULL;
|
||||||
int horses = get_resource(u,R_HORSE);
|
int horses = get_resource(u,R_HORSE);
|
||||||
int capacity = walkingcapacity(u);
|
int capacity = walkingcapacity(u);
|
||||||
item ** itmp = &u->items;
|
item ** itmp = &u->items;
|
||||||
|
boolean move = false;
|
||||||
|
|
||||||
if (horses > 0) {
|
if (horses > 0) {
|
||||||
change_resource(u, R_HORSE, - min(horses,(u->number*2)));
|
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 (*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 */
|
/* dragon gets bored and looks for a different place to go */
|
||||||
ta = set_new_dragon_target(u, u->region, DRAGON_RANGE);
|
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
|
static void
|
||||||
order_template(FILE * F, faction * f)
|
order_template(FILE * F, faction * f)
|
||||||
{
|
{
|
||||||
|
|
|
@ -188,29 +188,6 @@ buildingtype(const building * b, int bsize)
|
||||||
return s;
|
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
|
#define BMAXHASH 7919
|
||||||
static building *buildhash[BMAXHASH];
|
static building *buildhash[BMAXHASH];
|
||||||
void
|
void
|
||||||
|
|
|
@ -110,7 +110,6 @@ extern void add_buildinglist(building_list **bl, struct building *b);
|
||||||
extern struct attrib_type at_building_generic_type;
|
extern struct attrib_type at_building_generic_type;
|
||||||
extern const char * buildingtype(const struct building * b, int bsize);
|
extern const char * buildingtype(const struct building * b, int bsize);
|
||||||
extern const char * buildingname(const struct building * b);
|
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 int buildingcapacity(const struct building * b);
|
||||||
extern struct building *new_building(const struct building_type * typ, struct region * r, const struct locale * lang);
|
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);
|
void build_building(struct unit * u, const struct building_type * typ, int size);
|
||||||
|
|
Loading…
Reference in New Issue