dnameof now returns string

This commit is contained in:
Zeno Rogue 2020-03-07 04:38:07 +01:00
parent 35dbeea702
commit 0291c2ade3
2 changed files with 5 additions and 5 deletions

View File

@ -677,7 +677,7 @@ int read_cheat_args() {
PHASE(3) cheat(); start_game(); if(WDIM == 3) { drawthemap(); bfs(); }
shift(); eMonster m = readMonster(args());
shift(); int q = argi();
printf("m = %s q = %d\n", dnameof(m), q);
printf("m = %s q = %d\n", dnameof(m).c_str(), q);
restoreGolems(q, m, 7);
}
else if(argis("-MK")) {

View File

@ -10,10 +10,10 @@
#include "hyper.h"
namespace hr {
EX const char *dnameof(eMonster m) { return minf[m].name; }
EX const char *dnameof(eLand l) { return linf[l].name; }
EX const char *dnameof(eWall w) { return winf[w].name; }
EX const char *dnameof(eItem i) { return iinf[i].name; }
EX const string dnameof(eMonster m) { return m >= 0 && m < motypes ? minf[m].name : format("[MONSTER %d]", m); }
EX const string dnameof(eLand l) { return l >= 0 && l < landtypes ? linf[l].name : format("[LAND %d]", l); }
EX const string dnameof(eWall w) { return w >= 0 && w < walltypes ? winf[w].name : format("[WALL %d]", w); }
EX const string dnameof(eItem i) { return i >= 0 && i < ittypes ? iinf[i].name : format("[ITEM %d]", i); }
#if HDR
#define NUMLAN 7