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);
|
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++) {
|
||||||
&& i != RC_TEMPLATE && i != RC_CLONE) {
|
const race * rc = new_race[i];
|
||||||
fprintf(F, "%14svölker: %s\n",
|
if (s->factionrace[i] && rc && playerrace(rc)
|
||||||
LOC(default_locale, rc_name(new_race[i], 3)), pcomp(s->factionrace[i], o->factionrace[i]));
|
&& 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) {
|
if(full) {
|
||||||
fprintf(F, "\n");
|
fprintf(F, "\n");
|
||||||
|
@ -2867,19 +2870,25 @@ report_summary(summary * s, summary * o, boolean full)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(F, "\n");
|
fprintf(F, "\n");
|
||||||
if (full) {
|
if (full) {
|
||||||
for (i = 0; i < MAXRACES; i++) if (s->poprace[i]) {
|
for (i = 0; i < MAXRACES; i++) {
|
||||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(new_race[i], 1)),
|
const race * rc = new_race[i];
|
||||||
rcomp(s->poprace[i],o->poprace[i]));
|
if (s->poprace[i]) {
|
||||||
}
|
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, 1)),
|
||||||
} else {
|
rcomp(s->poprace[i], o->poprace[i]));
|
||||||
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)),
|
} else {
|
||||||
rcomp(s->poprace[i],o->poprace[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(rc, 1)),
|
||||||
|
rcomp(s->poprace[i], o->poprace[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (full) {
|
if (full) {
|
||||||
fprintf(F, "\nWaffen: %s\n", pcomp(s->waffen,o->waffen));
|
fprintf(F, "\nWaffen: %s\n", pcomp(s->waffen,o->waffen));
|
||||||
|
|
|
@ -154,7 +154,7 @@ addplayer(region *r, faction * f)
|
||||||
race_t urc;
|
race_t urc;
|
||||||
do {
|
do {
|
||||||
urc = (race_t)(rand() % MAXRACES);
|
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];
|
u->irace = new_race[urc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -375,6 +375,10 @@ read_seenspell(attrib * a, FILE * f)
|
||||||
fscanf(f, "%d", &mtype);
|
fscanf(f, "%d", &mtype);
|
||||||
sp = find_spell((magic_t)mtype, buf);
|
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;
|
a->data.v = sp;
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
@ -393,12 +397,12 @@ attrib_type at_seenspell = {
|
||||||
static boolean
|
static boolean
|
||||||
already_seen(const faction * f, const spell * sp)
|
already_seen(const faction * f, const spell * sp)
|
||||||
{
|
{
|
||||||
attrib *a;
|
attrib *a;
|
||||||
|
|
||||||
for (a = a_find(f->attribs, &at_seenspell); a; a=a->nexttype) {
|
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
|
void
|
||||||
|
|
|
@ -3,6 +3,7 @@ extern "C" {
|
||||||
#include <lua50/lauxlib.h>
|
#include <lua50/lauxlib.h>
|
||||||
#include <lua50/lualib.h>
|
#include <lua50/lualib.h>
|
||||||
}
|
}
|
||||||
|
#include <boost/version.hpp>
|
||||||
#if BOOST_VERSION < 103300
|
#if BOOST_VERSION < 103300
|
||||||
# define LUABIND_OLD
|
# define LUABIND_OLD
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue