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,10 +2845,13 @@ 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])
|
||||
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(new_race[i], 3)), pcomp(s->factionrace[i], o->factionrace[i]));
|
||||
fprintf(F, "%14svölker: %s\n", LOC(default_locale, rc_name(rc, 3)),
|
||||
pcomp(s->factionrace[i], o->factionrace[i]));
|
||||
}
|
||||
}
|
||||
|
||||
if(full) {
|
||||
|
@ -2869,15 +2872,21 @@ 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]));
|
||||
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++) if (s->poprace[i] && playerrace(new_race[i])
|
||||
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(new_race[i], 1)),
|
||||
rcomp(s->poprace[i],o->poprace[i]));
|
||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, 1)),
|
||||
rcomp(s->poprace[i], o->poprace[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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