Oops on invalid actor and victim arguments in nreport()

Replaces the existing, silent recovery from invalid victim argument.
This commit is contained in:
Markus Armbruster 2011-01-30 16:12:14 +01:00
parent 38e59474b1
commit 05b3e1b8d8

View file

@ -59,12 +59,13 @@ void
nreport(natid actor, int event, natid victim, int times)
{
int nice;
struct natstr *natp;
struct newscache *ncp;
if (CANT_HAPPEN((unsigned)event > N_MAX_VERB
|| rpt[event].r_newstory[0] == rpt[0].r_newstory[0]))
return;
if (CANT_HAPPEN(actor >= MAXNOC || victim >= MAXNOC))
return;
ncp = ncache(actor, event, victim, times);
putnews(ncp->id, &ncp->news);
@ -83,9 +84,7 @@ nreport(natid actor, int event, natid victim, int times)
return;
if (!chance((double)-nice * times / 20.0))
return;
if (!(natp = getnatp(victim)))
return;
if (getrel(natp, actor) < HOSTILE)
if (getrel(getnatp(victim), actor) < HOSTILE)
return;
setrel(victim, actor, HOSTILE);