Thanks for the replies. Using
PawnList is not an option, because I use that function for more than Pawns (DropAll(class 'CTFFlag') e.g.)
Speed is also not important due to its purpose - that function is called only once per undesired class and per map and before game starts.
bStatic or bNoDelete
Oh, I didn't consider these and have to test that. What about changing these values before dropping?
Code: Select all
log(self @ "DropAll: Dropping " @ A);
A.bStatic = false;
A.bNoDelete = false;
A.Destroy();
break;
Do_Until isn't doing anything there.
On every deleted object the foreach-loop is left by
break and then the variable containing that just destroyed object is compared with
None. So I have to investigate what happens to the value of a variable that points to an Actor that was destroyed meanwhile...
I used this Do-Until-construction because deleting or adding items to a list that is just iterated might confuse the iterator (see "Pitfalls" above also). As long as I don't know the implementation of that iterator IMO this Do-Until-constructions seems to be the only safe way to modify an iterated list.