add todo list for entities

Add some commands to support an entity TODO list. Entity errors during
map load are automatically added to the list. The list is saved and
restored with xmaps. A keybind (no default key assigned) to scroll
through TODO entities was added.

The list is indented as a means for automated map check scripts to
return a list of entities to fix.

cleartodoentities [index]
  Clear list of TODO entities. The list is also deleted, when a new map
  is loaded.
  If an entity number is given as an argument, only entries for this
  entity are cleared.

addtodoentity index comment
  Add the entity #index to the TODO list. Add optional comment.

enumtodoentities
  Returns a list of TODO entities. Returns entity index number and comment
  for every entry.

DOCREF enumtodoentities addtodoentity cleartodoentities
This commit is contained in:
ac-stef
2016-11-05 17:42:30 +01:00
parent 88320bd095
commit e12d25dc95
6 changed files with 110 additions and 11 deletions
+36
View File
@@ -524,6 +524,42 @@ void enumentities(char *type)
}
COMMAND(enumentities, "s");
vector<int> todoents;
vector<char *> todoentdescs;
void cleartodoentities(const char *n)
{
int ni = n ? ATOI(n) : -1;
if(!n || !*n || ni < 0)
{
todoents.setsize(0);
todoentdescs.deletearrays();
}
else loopvrev(todoents) if(todoents[i] == ni)
{
todoents.remove(i);
delstring(todoentdescs.remove(i));
}
}
COMMAND(cleartodoentities, "s");
void addtodoentity(int n, const char *desc)
{
todoents.add(n);
todoentdescs.add(newstring(desc));
}
COMMANDF(addtodoentity, "is", (int *n, const char *desc) { if(ents.inrange(*n)) addtodoentity(*n, desc); });
void enumtodoentities()
{
vector<char> res;
loopv(todoents) cvecprintf(res, "%d %s\n", todoents[i], escapestring(todoentdescs[i], true));
if(!res.length()) res.add('\0');
else res.last() = '\0';
result(res.getbuf());
}
COMMAND(enumtodoentities, "");
void scalecomp(uchar &c, int intens)
{
int n = c*intens/100;