(EF_IS_GAME_STATE): New.
(xdump, main): Use it. (EF_MAX): Change to largest table ID + 1. This is now possible because the changes above get rid of the assumption that empfile[0..EF_MAX-1] is only game state. Code can now work on any table using the advertized empfile interface, not just on game state. (my_ef_byname): Remove, use ef_byname().
This commit is contained in:
parent
0f6c4296b1
commit
01c248cb59
3 changed files with 26 additions and 33 deletions
|
@ -80,19 +80,6 @@
|
|||
/* FIXME document dump format */
|
||||
/* FIXME don't dump stuff that's useless due to options */
|
||||
|
||||
/*
|
||||
* Search empfile[] for element named NAME, return its index.
|
||||
* Return M_NOTFOUND if there are no matches, M_NOTUNIQUE if there are
|
||||
* several.
|
||||
* FIXME Merge into ef_byname(). ef_byname() stops at EF_MAX!
|
||||
*/
|
||||
static int
|
||||
my_ef_byname(char *name)
|
||||
{
|
||||
return stmtch(name, empfile, offsetof(struct empfile, name),
|
||||
sizeof(empfile[0]));
|
||||
}
|
||||
|
||||
/*
|
||||
* Evaluate a attribute of an object into VAL, return VAL.
|
||||
* TYPE is the attribute's type.
|
||||
|
@ -379,11 +366,12 @@ xdump(void)
|
|||
if (!p)
|
||||
return RET_SYN;
|
||||
|
||||
type = my_ef_byname(p);
|
||||
if (type >= EF_MAX || (meta && type >=0))
|
||||
return xdchr(type, meta);
|
||||
else if (type >= 0) {
|
||||
return xditem(type, player->argp[2]);
|
||||
type = ef_byname(p);
|
||||
if (type >= 0) {
|
||||
if (meta || !EF_IS_GAME_STATE(type))
|
||||
return xdchr(type, meta);
|
||||
else
|
||||
return xditem(type, player->argp[2]);
|
||||
} else if (!strncmp(p, "opt", strlen(p))) {
|
||||
return xdopt();
|
||||
} else if (!strncmp(p, "ver", strlen(p))) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue