forked from github/server
fixing a few crashes when new_race[i] is null.
error handling for missing seenspells.
This commit is contained in:
parent
a032e94382
commit
bf6dbe4b26
|
@ -2845,11 +2845,14 @@ report_summary(summary * s, summary * o, boolean full)
|
|||
fprintf(F, "Aktive Vulkane: %d\n\n", s->active_volcanos);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXRACES; i++) if (s->factionrace[i] && playerrace(new_race[i])
|
||||
&& i != RC_TEMPLATE && i != RC_CLONE) {
|
||||
fprintf(F, "%14svölker: %s\n",
|
||||
LOC(default_locale, rc_name(new_race[i], 3)), pcomp(s->factionrace[i], o->factionrace[i]));
|
||||
}
|
||||
for (i = 0; i < MAXRACES; i++) {
|
||||
const race * rc = new_race[i];
|
||||
if (s->factionrace[i] && rc && playerrace(rc)
|
||||
&& i != RC_TEMPLATE && i != RC_CLONE) {
|
||||
fprintf(F, "%14svölker: %s\n", LOC(default_locale, rc_name(rc, 3)),
|
||||
pcomp(s->factionrace[i], o->factionrace[i]));
|
||||
}
|
||||
}
|
||||
|
||||
if(full) {
|
||||
fprintf(F, "\n");
|
||||
|
@ -2867,19 +2870,25 @@ report_summary(summary * s, summary * o, boolean full)
|
|||
}
|
||||
}
|
||||
|
||||
fprintf(F, "\n");
|
||||
if (full) {
|
||||
for (i = 0; i < MAXRACES; i++) if (s->poprace[i]) {
|
||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(new_race[i], 1)),
|
||||
rcomp(s->poprace[i],o->poprace[i]));
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < MAXRACES; i++) if (s->poprace[i] && playerrace(new_race[i])
|
||||
&& i != RC_TEMPLATE && i != RC_CLONE) {
|
||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(new_race[i], 1)),
|
||||
rcomp(s->poprace[i],o->poprace[i]));
|
||||
}
|
||||
}
|
||||
fprintf(F, "\n");
|
||||
if (full) {
|
||||
for (i = 0; i < MAXRACES; i++) {
|
||||
const race * rc = new_race[i];
|
||||
if (s->poprace[i]) {
|
||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, 1)),
|
||||
rcomp(s->poprace[i], o->poprace[i]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < MAXRACES; i++) {
|
||||
const race * rc = new_race[i];
|
||||
if (s->poprace[i] && playerrace(rc)
|
||||
&& i != RC_TEMPLATE && i != RC_CLONE) {
|
||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, 1)),
|
||||
rcomp(s->poprace[i], o->poprace[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (full) {
|
||||
fprintf(F, "\nWaffen: %s\n", pcomp(s->waffen,o->waffen));
|
||||
|
|
|
@ -154,7 +154,7 @@ addplayer(region *r, faction * f)
|
|||
race_t urc;
|
||||
do {
|
||||
urc = (race_t)(rand() % MAXRACES);
|
||||
} while (urc == RC_DAEMON || !playerrace(new_race[urc]));
|
||||
} while (new_race[urc]==NULL || urc == RC_DAEMON || !playerrace(new_race[urc]));
|
||||
u->irace = new_race[urc];
|
||||
}
|
||||
|
||||
|
|
|
@ -375,6 +375,10 @@ read_seenspell(attrib * a, FILE * f)
|
|||
fscanf(f, "%d", &mtype);
|
||||
sp = find_spell((magic_t)mtype, buf);
|
||||
}
|
||||
if (sp==NULL) {
|
||||
log_error(("could not find seenspell '%s'\n", buf));
|
||||
return AT_READ_FAIL;
|
||||
}
|
||||
a->data.v = sp;
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
@ -393,12 +397,12 @@ attrib_type at_seenspell = {
|
|||
static boolean
|
||||
already_seen(const faction * f, const spell * sp)
|
||||
{
|
||||
attrib *a;
|
||||
attrib *a;
|
||||
|
||||
for (a = a_find(f->attribs, &at_seenspell); a; a=a->nexttype) {
|
||||
if (a->data.v==sp) return true;
|
||||
if (a->data.v==sp) return true;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -3,6 +3,7 @@ extern "C" {
|
|||
#include <lua50/lauxlib.h>
|
||||
#include <lua50/lualib.h>
|
||||
}
|
||||
#include <boost/version.hpp>
|
||||
#if BOOST_VERSION < 103300
|
||||
# define LUABIND_OLD
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue