forked from github/server
clarify dragon planning code (bug 2159)
This commit is contained in:
parent
d91c9fb880
commit
efc87a16e3
|
@ -685,14 +685,13 @@ static order *plan_dragon(unit * u)
|
|||
/* dragon gets bored and looks for a different place to go */
|
||||
ta = set_new_dragon_target(u, u->region, DRAGON_RANGE);
|
||||
}
|
||||
else
|
||||
ta = a_find(u->attribs, &at_targetregion);
|
||||
if (ta != NULL) {
|
||||
tr = (region *)ta->data.v;
|
||||
if (tr == NULL || !path_exists(u->region, tr, DRAGON_RANGE, allowed_dragon)) {
|
||||
ta = set_new_dragon_target(u, u->region, DRAGON_RANGE);
|
||||
if (ta)
|
||||
if (ta) {
|
||||
tr = findregion(ta->data.sa[0], ta->data.sa[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tr != NULL) {
|
||||
|
|
|
@ -1547,6 +1547,7 @@ static void mkreportdir(const char *rpath) {
|
|||
abort();
|
||||
}
|
||||
}
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
int write_reports(faction * f, time_t ltime)
|
||||
|
@ -1563,11 +1564,7 @@ int write_reports(faction * f, time_t ltime)
|
|||
}
|
||||
prepare_report(&ctx, f);
|
||||
get_addresses(&ctx);
|
||||
mkreportdir(path);
|
||||
if (errno) {
|
||||
log_warning("errno was %d before writing reports", errno);
|
||||
errno = 0;
|
||||
}
|
||||
mkreportdir(path); // FIXME: too many mkdir calls! init_reports is enough
|
||||
log_debug("Reports for %s:", factionname(f));
|
||||
for (rtype = report_types; rtype != NULL; rtype = rtype->next) {
|
||||
if (f->options & rtype->flag) {
|
||||
|
@ -1662,7 +1659,7 @@ int reports(void)
|
|||
report_donations();
|
||||
remove_empty_units();
|
||||
|
||||
mkreportdir(rpath);
|
||||
mkreportdir(rpath); // FIXME: init_reports already does this?
|
||||
sprintf(path, "%s/reports.txt", rpath);
|
||||
mailit = fopen(path, "w");
|
||||
if (mailit == NULL) {
|
||||
|
|
Loading…
Reference in New Issue