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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user