Attached is a sample file.
Here's the code behind the add function used from within D4BlackList.
Code: Select all
//--------------------------------------------------------------------------
// Adds a monster to the black list
void Add(Name mon, bool parent = false)
{
// Make sure it's an actual thing that can be added, as in an actual class
// that's an actor.
Class<Actor> check = mon;
if (!check)
{
String thing = mon;
Console.Printf("Bad actor %s", thing);
return;
}
Array<String> Test;
if (parent) Test.Copy(PList);
else Test.Copy(List);
String thing = mon;
if (Test.Size() > 0)
{
//If it's already in, do nothing.
for (int i = 0; i < Test.Size(); i++)
{
if (mon == Test[i])
{
Console.Printf("%s already in", thing);
return;
}
}
}
Test.Push(mon);
Console.Printf("Added %s", thing);
if (parent) Test.Move(PList);
else Test.Move(List);
}
Code: Select all
Added LostSoul
LostSoul already in
If I change it to cycle through (P)List directly, however, it'll work:
Code: Select all
//--------------------------------------------------------------------------
// Adds a monster to the black list
void Add(Name mon, bool parent = false)
{
// Make sure it's an actual thing that can be added, as in an actual class
// that's an actor.
Class<Actor> check = mon;
if (!check)
{
String thing = mon;
Console.Printf("Bad actor %s", thing);
return;
}
String thing = mon;
if (parent)
{
if (PList.Size() > 0)
{
//If it's already in, do nothing.
for (int i = 0; i < PList.Size(); i++)
{
if (mon == PList[i])
{
Console.Printf("%s already in", thing);
return;
}
}
}
PList.Push(mon);
}
else
{
if (List.Size() > 0)
{
//If it's already in, do nothing.
for (int i = 0; i < List.Size(); i++)
{
if (mon == List[i])
{
Console.Printf("%s already in", thing);
return;
}
}
}
List.Push(mon);
}
}