Fix wizmakemap to consider monster birth counts and uniques

Also add a new wizmode command #wizborn to show those.
This commit is contained in:
Pasi Kallinen
2020-03-07 21:33:31 +02:00
parent 2a37fe5a3b
commit f5d9324f28
7 changed files with 52 additions and 5 deletions

View File

@@ -780,10 +780,15 @@ boolean pre, wiztower;
if (pre) {
rm_mapseen(ledger_no(&u.uz));
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
int ndx = monsndx(mtmp->data);
if (mtmp->isgd) { /* vault is going away; get rid of guard */
mtmp->isgd = 0;
mongone(mtmp);
}
if (mtmp->data->geno & G_UNIQ)
g.mvitals[ndx].mvflags &= ~(G_EXTINCT);
if (g.mvitals[ndx].born)
g.mvitals[ndx].born--;
if (DEADMONSTER(mtmp))
continue;
if (mtmp->isshk)
@@ -802,11 +807,6 @@ boolean pre, wiztower;
g.context.achieveo.soko_prize_oid = 0;
}
}
/* TODO?
* Reduce 'born' tally for each monster about to be discarded
* by savelev(), otherwise replacing heavily populated levels
* tends to make their inhabitants become extinct.
*/
}
if (Punished) {
ballrelease(FALSE);
@@ -1890,6 +1890,8 @@ struct ext_func_tab extcmdlist[] = {
dowhatis, IFBURIED | GENERALCMD },
{ 'w', "wield", "wield (put in use) a weapon", dowield },
{ M('w'), "wipe", "wipe off your face", dowipe, AUTOCOMPLETE },
{ '\0', "wizborn", "show stats of monsters created",
doborn, IFBURIED | WIZMODECMD },
#ifdef DEBUG
{ '\0', "wizbury", "bury objs under and around you",
wiz_debug_cmd_bury, IFBURIED | AUTOCOMPLETE | WIZMODECMD },

View File

@@ -2062,6 +2062,39 @@ dovanquished()
return 0;
}
/* #wizborn extended command */
int
doborn()
{
static const char fmt[] = "%4i %4i %c %-30s";
int i;
winid datawin = create_nhwindow(NHW_TEXT);
char buf[BUFSZ];
int nborn = 0, ndied = 0;
putstr(datawin, 0, "died born");
for (i = LOW_PM; i < NUMMONS; i++)
if (g.mvitals[i].born || g.mvitals[i].died
|| (g.mvitals[i].mvflags & G_GONE)) {
Sprintf(buf, fmt,
g.mvitals[i].died, g.mvitals[i].born,
((g.mvitals[i].mvflags & G_GONE) == G_EXTINCT) ? 'E' :
((g.mvitals[i].mvflags & G_GONE) == G_GENOD) ? 'G' : ' ',
mons[i].mname);
putstr(datawin, 0, buf);
nborn += g.mvitals[i].born;
ndied += g.mvitals[i].died;
}
putstr(datawin, 0, "");
Sprintf(buf, fmt, ndied, nborn, ' ', "");
display_nhwindow(datawin, FALSE);
destroy_nhwindow(datawin);
return 0;
}
/* high priests aren't unique but are flagged as such to simplify something */
#define UniqCritterIndx(mndx) ((mons[mndx].geno & G_UNIQ) \
&& mndx != PM_HIGH_PRIEST)