First I am not arguing, Just giving my opinion. Since I am not going to the length of looking at the functions, nothing is definitive.
Zarathustra217 wrote...
Well, I profiled it at some point and it turned out that if you were looking for just one object type, using the GetFirst/NextObjectInShape was faster than cycling with GetFirst/NextObjectInArea. The difference was rather marginal though,...
I can see it being both slower and faster. It is all dependent on how many items are in the area and the mix/ratio of object types. Both functions are itterators so will not have the same major drag as GetNearestObject. The main advantage of GetFirst/NextObjectInShape is the "type filter" as you stated. Being handled by the function in bulding the list allows it to happen much faster then the VM instruction equivalent. I myself would go with First/NextInArea but that is just my prefferance.
[/quote] ...but my main point is really that I think it's easy to overrate how much performance is lost in simple geometrical tasks in NWN.[/quote]
I agree with that 100%, I myself would still use GetNearestObjectByTag, If I was just looking for the closest single object. I would not however use it to itterare through objects since it builds and destroys its distance chart every time the function runs. ( I know we all agree on that one.) The problem with that function is not that it does a simple geometrical tasks, It is that it does a simple geometrical tasks way to often, along with allocating/deallocating memory on every itteration just to rebuild the same list again.. and again. ( Again Im beating a dead horse.)
But then, we are splitting hairs here. To Rolo, I simply used 400.0 meters to make sure every object in the area gets included. I expect that the GetFirst/NextObjectInShape function doesn't work by drawing out any actual cube but calculate per object if it'll be within the range.
I would guess you are right. I view the function as a wrapper around GetFirst/NextInArea with a distance Location check. does not really matter how it was done though since it is an itterator, Meaning that the Checks only have to be done once per object, reguardless of the number of itterations.
P.S. and after reading the mess i wrote above, I should have just said; Apples and Oranges, Both functions will work. Just pick one.